vreg
Member level 4
- Joined
- Oct 16, 2012
- Messages
- 70
- Helped
- 1
- Reputation
- 2
- Reaction score
- 1
- Trophy points
- 1,288
- Activity points
- 1,935
Hi,
I want to interface a 4x3 keypad to AT89C51 microcontroller using interrupts (not polling).
My idea is to use the pins p1.5 - p1.7 as interrupt inputs and using the ports p1.0 - p1.3 to detect the exact key pressed (by setting them first as 0111, then 1011, etc... till the corresponding row is found) after getting the interrupt from the column pins.
However, I am not sure how to write the interrupt service routine to do this. The vector address for keyboard interrupts is given in the datasheet as 003Bh.
Please help on how to write the code (preferably assembly).
I want to interface a 4x3 keypad to AT89C51 microcontroller using interrupts (not polling).
My idea is to use the pins p1.5 - p1.7 as interrupt inputs and using the ports p1.0 - p1.3 to detect the exact key pressed (by setting them first as 0111, then 1011, etc... till the corresponding row is found) after getting the interrupt from the column pins.
However, I am not sure how to write the interrupt service routine to do this. The vector address for keyboard interrupts is given in the datasheet as 003Bh.
Please help on how to write the code (preferably assembly).