Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Interrupt Triggered KeyPad

Status
Not open for further replies.

Paradigm

Member level 1
Joined
Oct 13, 2011
Messages
36
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,648
Dear All,

I have a 4x4 keypad and wishes to put my MCU to sleep. Therefore I am thinking of having an interrupt triggered scanning keypad instead of doing constant polling.

How should I connect the hardware of the keypad? How many interrupt do I need? What must I do inside the service routine to detect the keypress

Thanks a lot for any help.
 

You don't give us enough information. What is your hardware? If you are using a 4x4 keypad then, assuming there is no extra circuitry, you will need at least 4 interrupts: All four rows are driven high, and the four column inputs would be interrupts. But you will still need to do a scan after the interrupt occurs to determine which of the four switches in the column was pressed.

If you are willing to use extra hardware, then there are other approaches.
 

Hi Paradigm;

If your proc has PORT Change Interrupt (at least on 4 pins like almost all PICs on PORTB) and it can wake-up from SLEEP (see your datasheet) then it is possible using only one interrupt (this).

For example set all 4 keypad columns to zero and pull up (as usual) the rows to VCC. If the 4 rows are connected to the 4 input pins capable PORT Change Interrupt, interrupt occurs (the proc returns from SLEEP) when any key pressed, because the PORT (any of the 4 pins/bits) is changed.

Then, as barry wrote, you will still need to do a scan (even in the interrupt routine) to determine which switch was pressed.

A word of advice: use a short delay (15..20 msec, for debouncing) before scan the switches.
zuisti
 

Hi Zuisti, which model of PIC provide PORT change interrupt? Can advise? Thanks a lot
 

Hi Zuisti, which model of PIC provide PORT change interrupt?

As I wrote almost all (14+ pins) PICs have this feature (on PORTB.4...7).
For example:
PIC16F628A, F87, F88, F877A ...
PIC18F2620
an so on
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top