View previous topic :: View next topic |
Author |
Message |
D.e
Joined: 28 Dec 2009 Posts: 3
|
Problem with CCSs keypad driver KBD.C |
Posted: Mon Dec 28, 2009 6:11 pm |
|
|
Hi all,
I have got a problem with CCSs keypad driver "kbd.c". I couldn't use it. I connected the wires like this
and I have changed the "kbd.c"
Code: | #else ////////////////////////////////////////////////// For the black keypad
#define COL0 (1 << 1)
#define COL1 (1 << 2)
#define COL2 (1 << 3)
#define ROW0 (1 << 4)
#define ROW1 (1 << 5)
#define ROW2 (1 << 6)
#define ROW3 (1 << 7)
#endif |
And my main code is Code: |
#include<16f877.h>
#use delay(clock=4M)
#fuses XT,NOWDT
#use rs232(baud=9600, xmit=PIN_B1)
#include<KBD.c>
void main()
{
char c;
printf("Hello\r\n");
while(TRUE)
{
c=kbd_getc( );
if(c!='\0')
printf("Key:%c\r\n", c );
delay_ms(20);
}
} |
But it didn't work. I don't know what is wrong. Can anybody help me? |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Dec 28, 2009 6:35 pm |
|
|
That's not the correct way to use the kbd.c keypad driver.
Look in this CCS example file to see how to do it:
Quote: | c:\program files\picc\examples\ex_lcdkb.c |
Note that they don't use a delay_ms() statement in the while loop.
If you still have a problem, then post your compiler version. |
|
![](templates/subSilver/images/spacer.gif) |
Guest
|
|
Posted: Tue Dec 29, 2009 6:18 am |
|
|
Thank you for your help.
My compiler version is 4.013. I have compiled and tried "ex_lcdkb.c" but it didn't work again.I only see "Ready..." on the lcd screen.
I defined "use_portb_lcd TRUE" and "use_portd_kbd TRUE" and my connections and bit masks are seen in my first post.
Are they true? |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah Guest
|
|
Posted: Tue Dec 29, 2009 9:13 am |
|
|
The obvious thing is what are the resistors connected to?. The symbol appears to be the triangle, normally used for GND. They need to connect to Vcc/Vdd.
Best Wishes |
|
![](templates/subSilver/images/spacer.gif) |
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Tue Dec 29, 2009 10:11 am |
|
|
Compiler v4.013 is very unstable. It was one of the first v4 compiler versions and contained many bugs. If you download an illegal version, then at least take one of the stable versions... |
|
![](templates/subSilver/images/spacer.gif) |
|