Design a simple interface to a single switch using one pin f
Design a simple interface to a single switch using one pin from Port P. You should get an interrupt each time the switch changes from being open to closed or from closed to open. In other words, you want interrupts on both rising and falling edges. You also want there to be a high pulse on Port T bit 7 each time the switch changes state. You may assume that the switch starts in the open state which produces 5V. Your solution must use key wakeup interrupts on port P.
Draw a schematic for your design. Consider whether you need pull-ups or not. You do not need to draw connection for PT7, but simply label it on your microcontroller module.
Show the initialization ritual that is called by the main program. Note that since interrupts are used, you should initialize relevant registers on Port P properly.
Show the interrupt handler that is called when the switch changes state. You do not need to write the main program as the interrupt handler should do everything specified anyway.
Solution
The outputs are designed so that they give at least 2.4V at 2.6 mA load. This 2.6 mA figure is for ordinary LS-TLL circuits used, the LSI implementations used in many computers can give more or less. For example quite popular (few years ago) UM82C11-C parallel port chip can only source 2 mA.
Simple current sinking load connection:
When taking current from PC parallel port, keep the load low, only up to few milliamperes. Trying to toke too much current (for example shorting pins to ground) can fry the parallel port. I have not killed any parallel port (yet) in this method, but I have had in cases where too much load has made the parallel port IC very hot. Be careful.
If you have an external +5 volt supply, you have another option for connection: use the Data Out pins to sink up to 24 mA from your +5 volt supply. This can be made with a circuit like this:
