PortB-Change interrupt (part 3) and keypad
Posted: Tue Aug 11, 2009 12:23 pm
The quest continues.
The target is to find a way to use PortB-change interrupts to react to a 4x3 keypad hit.
Consider this schematic:
Row A to D are connected to RB4 -7
Culomn 1 to 3 are connected to RB1 -3
(This leaves RB0 free for other use)
Here is an elementary test in Flowcode: Simulating the program in Flowcode gives no reaction on the interrupt at all.
When I run the code in Proteus and in hardware, keys 3,6,9 and # are reacting and return the correct keynumber, the other keys don't react.
After a hardware reset, no key is reacting anymore.
After a switch off/on, keys 3,6,9 and # are reacting again.
One of the problems can be that PortB-Change interrupt will react on a change condition of RB4 - 7.
Like the hardware is setup now, without pull-up or pull-down resistors, a change condition cannot be detected.
I experimented with pull-downs on RB4 - 7, but without result.
Did anybody tried this before and found a working solution?
Best regards,
Eric
The target is to find a way to use PortB-change interrupts to react to a 4x3 keypad hit.
Consider this schematic:
Row A to D are connected to RB4 -7
Culomn 1 to 3 are connected to RB1 -3
(This leaves RB0 free for other use)
Here is an elementary test in Flowcode: Simulating the program in Flowcode gives no reaction on the interrupt at all.
When I run the code in Proteus and in hardware, keys 3,6,9 and # are reacting and return the correct keynumber, the other keys don't react.
After a hardware reset, no key is reacting anymore.
After a switch off/on, keys 3,6,9 and # are reacting again.
One of the problems can be that PortB-Change interrupt will react on a change condition of RB4 - 7.
Like the hardware is setup now, without pull-up or pull-down resistors, a change condition cannot be detected.
I experimented with pull-downs on RB4 - 7, but without result.
Did anybody tried this before and found a working solution?
Best regards,
Eric