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.

PIC reading a keypad / sleep

Status
Not open for further replies.

fastbike

Junior Member level 1
Joined
Feb 16, 2005
Messages
17
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,281
Location
South of the Equator
Activity points
1,460
Hi,

I'm reading a 4 x 7 matrix membrane keypad . I'm using a PIC16F88 and use the PortB4:7 pins for the colums and the PortA0:7 pins for the rows.

I've set my code to setup the column pins as inputs, held high by the internal pullups. The rows are set as outputs and set to low.

In my main code loop I scan PortB4:7 looking for a low column pin - the idea is that when a key is pressed the PortB pin will go low.
If this happens I then set that column as an output (low), set the rows as input (held high with external pullups) and look for the row that is low.

This works well.

My problem is this:
I want to use the SLEEP command so I can turn the PIC off to save battery power. I want to wake it up using the interrupt on PortB function.

However, when I enable the RBIE bit, my code stops working or works intermittently.

I'm clearing the RBIF flag in the interrupt procedure. I've tried setting a 50mSec delay to debounce the key before I clear the flag but find this makes little difference.

Have I overlooked something simple ?
 

Hi,


Are using the pin RA5? I looked at the datasheet and I saw that this pin is only input, so it doesn't can be used to scan your keyboard.

You must disable the PORTB interrupt when reading the keys status, are you doing this?

why you don't use the timer to read the status? you make 1 scan per 10ms, if the key are pressured 2 or 3 times you can do the action for this key.

Look at the schematic for RA5 pin:
 

Hi,

Microchip have few ideas on how to do that, and all of them will save you a lot of design time and power on your bettary at the end.
Read some of them at: **broken link removed**

If you will need more info, post it here.
Good luck.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top