View previous topic :: View next topic |
Author |
Message |
bhaven
Joined: 26 Sep 2005 Posts: 10
|
About the problem of Keypad |
Posted: Wed Mar 01, 2006 11:23 am |
|
|
I am using PIC16f877 in my project i have attached a 4x3 keypad in my proj. to port B . I am scanning each row by keeping a coloumn high for 10msec. When i power on the circuit it starts taking the values on its own . Pin 33,34,35 are attached to coloumns and rest are attached to rows(pin 40 is not used ). I have used the SET_TRIS_B register and declared the Pin 33,34,35 as output pins and rest as input pins. Simulation is running fine absolutely no problem but it fails in the actual hardware.
What is to be done . Please can you suggest me something . Its really very important for me . Please Reply. |
|
![](templates/subSilver/images/spacer.gif) |
C Turner
Joined: 10 Nov 2003 Posts: 40 Location: Utah
|
About the problem of Keypad |
Posted: Wed Mar 01, 2006 12:00 pm |
|
|
Without at least a snippet of example code, it's hard to tell exactly what is going on.
At first glance, I note that you don't mention pullup/down resistors anywhere.
Were I to do this, I might use the PIC's own Port-B pullup resistors on the row inputs and scanning the columns by pulling low (and going to input mode for the inactive column) - not forgetting to do the necessary debouncing as well.
You mention that you are keeping the column high for 10 msec - and that implies that you *must* have pulldown resistors on the rows: If not, then it's unlikely that anything will work! (This may just be one of those cases where simulations fail to track real-world situations at all...)
CT |
|
![](templates/subSilver/images/spacer.gif) |
bhaven
Joined: 26 Sep 2005 Posts: 10
|
Re: About the problem of Keypad |
Posted: Wed Mar 01, 2006 11:59 pm |
|
|
C Turner wrote: | Without at least a snippet of example code, it's hard to tell exactly what is going on.
At first glance, I note that you don't mention pullup/down resistors anywhere.
Were I to do this, I might use the PIC's own Port-B pullup resistors on the row inputs and scanning the columns by pulling low (and going to input mode for the inactive column) - not forgetting to do the necessary debouncing as well.
You mention that you are keeping the column high for 10 msec - and that implies that you *must* have pulldown resistors on the rows: If not, then it's unlikely that anything will work! (This may just be one of those cases where simulations fail to track real-world situations at all...)
CT |
i have used the pull resistors externally. The delay of 10 msec mentioned is for the debouncing effect. How can i enable/disable the internal resistors of the port B of PIC16F877. Please can you suggest something. Please Reply. |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Mar 02, 2006 12:50 am |
|
|
Do you have the CCS compiler ? If so, you should have the KBD.C
driver and the EX_LCDKB.C example file.
Look in these folders:
c:\Program Files\Picc\Drivers
c:\Program Files\Picc\Examples
If you don't have the CCS compiler, or have the demo, then look here:
This page has the schematic:
http://www.blitzlogic.com/lcd.htm
This page has the CCS source code:
http://www.blitzlogic.com/kbd_C.htm
If you look closely at the kbd driver file in the link above, you will
see this function:
kbd_init()
It contains the code to enable pull-ups on Port B. |
|
![](templates/subSilver/images/spacer.gif) |
|