View previous topic :: View next topic |
Author |
Message |
Guest02 Guest
|
Keypad 4x3 and 16F877 |
Posted: Mon Mar 30, 2009 12:27 pm |
|
|
I made one 4x3 keypad with standard switches like on PICDEM 2 board.
Hardware is made something like this
http://www.elektrotekno.com/userpix/6181_1_2.jpg
and i put 4x 10K resistors to row0,1,2,3.
If i use this code, when i press number 7,8,9 different LED on picdem lights up but there is no message on LCD. I don't know what's wrong.
The LED - B3 wont light up regardless what i click.
Because i don't get visual reply from picdem i don't know what is with other switches. Are they working or not?
Code: | #include <16F877.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=4000000)
#include "trans_LCD.c"
#include "trans_KEY.c"
void main() {
char k;
lcd_init();
kbd_init();
lcd_putc("\fReady...\n");
while (TRUE) {
k=kbd_getc();
if(k!=0)
if(k=='*')
lcd_putc('\f');
else
lcd_putc(k);
}
} |
|
|
|
Guest02 Guest
|
|
Posted: Mon Mar 30, 2009 12:28 pm |
|
|
I use whole B port for this ... except B7 |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Mar 30, 2009 12:44 pm |
|
|
Quote: | #include "trans_LCD.c"
#include "trans_KEY.c" |
Post where you got these drivers from.
Quote: | and i put 4x 10K resistors to row0,1,2,3. |
The pull-up connections should look like this:
Code: |
+5 volts
|
|
| | 10K
| | resistor
|_|
|
To PIC pin ------o------ To Keypad row pin
|
Post a list of the connections between the PIC pins and the keypad
and the LCD. |
|
|
Guest02 Guest
|
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Apr 02, 2009 12:22 am |
|
|
Your schematic shows the resistors are connected to ground.
That's wrong. Those are "pull-down" resistors. I told you to
use Pull-Up resistors. My schematic shows a connection
to +5 volts. Change your circuit to connect the resistors to +5v. |
|
|
John P
Joined: 17 Sep 2003 Posts: 331
|
|
Posted: Thu Apr 02, 2009 6:48 am |
|
|
If you're using Port B, why fool around with resistors at all? Use the internal pullups, that's what Microchip put them there for. |
|
|
|