View previous topic :: View next topic |
Author |
Message |
lgeorge123
Joined: 05 Dec 2004 Posts: 31
|
display keypad value to a lcd |
Posted: Thu Jan 19, 2006 8:25 am |
|
|
I wrote a c program to display keypad value in a certain format . there are two cases:
1>> when I press '.' then a value, say 7, lcd display '0.7V' or
2>> when I press '1' then a value, say 2, lcd dispaly '1.2V' .
I compile this c program well and connect to power supply, 'hello' is display but whatever i press the keypad , no data is display.
#include <16f877.h>
#include "c:\program files\picc\drivers\kbd.c"
#use delay(clock=4000000)
#include <lcd.c>
#fuses XT,NOWDT,NOPROTECT,NOLVP
char c,c1;
void main(void)
{
port_b_pullups(true);
kbd_init();
lcd_init();
lcd_putc('\f');
printf(lcd_putc,"hello");
while(1)
{
c = kbd_getc();
if(c!=0)
{
switch(c)
{
case '.': c1=kbd_getc();
if(c1!=0)
{
lcd_putc('\n');
printf(lcd_putc,"0.%cV",c1);}
break;
case '1': c2=kbd_getc();
if(c2!=0)
{
lcd_putc('\n');
printf(lcd_putc,"1.%cV",c2);
}
break;
}
}
}
} |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Jan 19, 2006 9:25 pm |
|
|
What port is the LCD connected to ?
What port is the keypad connected to ?
Port B or Port D ? |
|
|
lgeorge123
Joined: 05 Dec 2004 Posts: 31
|
DISPLAY KEYPAD VALUE TO LCD |
Posted: Thu Jan 19, 2006 9:54 pm |
|
|
lcd to portb, keypad to portd
I sure both keypad and lcd hardware are functional well. |
|
|
lgeorge123
Joined: 05 Dec 2004 Posts: 31
|
display keypad to lcd |
Posted: Thu Jan 19, 2006 9:57 pm |
|
|
Sorry, lcd is to portd, keypad is to portb. |
|
|
lgeorge123
Joined: 05 Dec 2004 Posts: 31
|
display keypad value to lcd |
Posted: Thu Jan 19, 2006 10:03 pm |
|
|
I also write a simple to test the keypad working or not.
main()
{
port_b_pullups(true);
while(1)
{
c=kbd_getc();
if(c!=0)
{lcd_putc('\n');
lcd_putc(c);}
}
it display all value whatever I enter using the same hardware. |
|
|
|