This page is subject to change without notice -- please reload it
in your browser if an item that might affect you may have changed.
You will only get credit for this lab if the TA checks you off for the lab assignments listed below no later than Friday, December XX.
You must do this lab with your lab group, or individually if you are not part of a lab team. All team members must participate in the design and construction, and all must be present for the evaluation.
The purpose of this project is to build and use a commercial microcontroller. Many such microprocessors are available -- I have selected the PIC 12F675. The datasheet for this processor is available from Microchip.
Study the PIC datasheet carefully, noting its capabilities. The instructor has written a control program so you can use the PIC to control the elevator from project 4. To run it, you must connect pins as follows (the number of each pin is followed by its description).
In addition, connect a 10uF capacitor across power and ground (check carefully that the part of the capacitor labeled "-" is the one connected to ground: if you connect it incorrectly the capacitor may short-circuit power to ground). The diode feeds current to the capacitor but doesn't allow it to flow back towards the power bus. The capacitor stores the electric energy, forming a tiny power supply that will be stable even when the voltage on the main power bus varies, which will happen when the motor starts to draw current. Without this diode and capacitor setup, the microcontroller will behave erratically.
The instructor's program is here.
After you have implemented this circuit and tested it, first using LEDs, then on the actual elevator, you must modify the instructor's program as follows. Currently, if a button is pressed while the elevator is moving in the opposite direction, that button is ignored. For example, if I press "down" while the elevator is moving up, the "down" button is ignored.
It would be better to remember that the button had been pressed, then reverse direction as soon as the floor is reached that we are currently going towards. To continue the example, as soon as the second floor was reached, the elevator would go down again immediately, without any need to press the "down" button again.
Modify the instructor's program to do this, convince yourself and the TA that it works, enter it on the MPLAB IDE (part of the Flash Starter Kit), program your PIC, and test your program using the LEDs and switches. Only test this using the LEDs, since the elevator is a little too fast to support proper testing of this program.