View previous topic :: View next topic |
Author |
Message |
Joshua Lai
Joined: 19 Jul 2004 Posts: 42 Location: Malaysia, PJ
|
Old version kbd.c |
Posted: Tue Sep 06, 2005 10:52 am |
|
|
Dear PCM compiler:
I am using an old PCM compiler (version 2.7.1) The kbd.c file in the examples folder start with this line:
#define kbd =6
I found a new version keypad driver (kbdd.c) which start as follow:
#if defined(__PCH__)
#if defined use_portb_kbd
#byte kbd = 0xF81 // This puts the entire structure
#else
#byte kbd = 0xF83 // This puts the entire structure
#endif
#else
#if defined use_portb_kbd
#byte kbd = 6 // on to port B (at address 6)
#else
#byte kbd = 8 // on to port D (at address 8)
#endif
#endif
#if defined use_portb_kbd
#define set_tris_kbd(x) set_tris_b(x)
#else
#define set_tris_kbd(x) set_tris_d(x)
#endif
I copied the new keypad driver into the example folder but my PCM compiler cannot compile it. The error happens at (__PCH__).
What I intend to do is using a keypad on port C. In the old keypad driver I changed the first line to:
#define kbd = 7
I also changed all “set_tris_b” into “set_tris_c”. But it does not work. |
|
![](templates/subSilver/images/spacer.gif) |
dromero
Joined: 05 Sep 2005 Posts: 3
|
Re: Old version kbd.c |
Posted: Tue Sep 06, 2005 1:59 pm |
|
|
Joshua Lai wrote: | Dear PCM compiler:
I am using an old PCM compiler (version 2.7.1) The kbd.c file in the examples folder start with this line:
#define kbd =6
I found a new version keypad driver (kbdd.c) which start as follow:
#if defined(__PCH__)
#if defined use_portb_kbd
#byte kbd = 0xF81 // This puts the entire structure
#else
#byte kbd = 0xF83 // This puts the entire structure
#endif
#else
#if defined use_portb_kbd
#byte kbd = 6 // on to port B (at address 6)
#else
#byte kbd = 8 // on to port D (at address 8)
#endif
#endif
#if defined use_portb_kbd
#define set_tris_kbd(x) set_tris_b(x)
#else
#define set_tris_kbd(x) set_tris_d(x)
#endif
I copied the new keypad driver into the example folder but my PCM compiler cannot compile it. The error happens at (__PCH__).
What I intend to do is using a keypad on port C. In the old keypad driver I changed the first line to:
#define kbd = 7
I also changed all “set_tris_b” into “set_tris_c”. But it does not work. |
It looks like your setup is expecting the PCH compiler, where you have PCM. Try deleting the first line: #if defined(__PCH__), and then set use_portb_kbd to TRUE |
|
![](templates/subSilver/images/spacer.gif) |
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
Re: Old version kbd.c |
Posted: Tue Sep 06, 2005 2:41 pm |
|
|
dromero wrote: | Joshua Lai wrote: | Dear PCM compiler:
I am using an old PCM compiler (version 2.7.1) The kbd.c file in the examples folder start with this line:
#define kbd =6
I found a new version keypad driver (kbdd.c) which start as follow:
#if defined(__PCH__)
#if defined use_portb_kbd
#byte kbd = 0xF81 // This puts the entire structure
#else
#byte kbd = 0xF83 // This puts the entire structure
#endif
#else
#if defined use_portb_kbd
#byte kbd = 6 // on to port B (at address 6)
#else
#byte kbd = 8 // on to port D (at address 8)
#endif
#endif
#if defined use_portb_kbd
#define set_tris_kbd(x) set_tris_b(x)
#else
#define set_tris_kbd(x) set_tris_d(x)
#endif
I copied the new keypad driver into the example folder but my PCM compiler cannot compile it. The error happens at (__PCH__).
What I intend to do is using a keypad on port C. In the old keypad driver I changed the first line to:
#define kbd = 7
I also changed all “set_tris_b” into “set_tris_c”. But it does not work. |
It looks like your setup is expecting the PCH compiler, where you have PCM. Try deleting the first line: #if defined(__PCH__), and then set use_portb_kbd to TRUE |
Wrong, that's a test to see which compiler and then use the right registers! |
|
![](templates/subSilver/images/spacer.gif) |
Joshua Lai
Joined: 19 Jul 2004 Posts: 42 Location: Malaysia, PJ
|
|
Posted: Sat Sep 17, 2005 3:42 am |
|
|
Testing which compiler?
But... my compiler cannot compile the driver. |
|
![](templates/subSilver/images/spacer.gif) |
Joshua Lai
Joined: 19 Jul 2004 Posts: 42 Location: Malaysia, PJ
|
|
Posted: Mon Sep 19, 2005 11:33 pm |
|
|
I deleted everything at top and just put 2 lines:
Quote: |
#byte kbd = 7
#define set_tris_kbd(x) set_tris_c(x)
|
It works perfectly !!
Before this I just tried using 2 pull-up resistors because I have no enough 10k, it will work only i put all 4 pull-up resistors on row pins. |
|
![](templates/subSilver/images/spacer.gif) |
|