CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Old version kbd.c

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Joshua Lai



Joined: 19 Jul 2004
Posts: 42
Location: Malaysia, PJ

View user's profile Send private message Send e-mail

Old version kbd.c
PostPosted: Tue Sep 06, 2005 10:52 am     Reply with quote

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.
dromero



Joined: 05 Sep 2005
Posts: 3

View user's profile Send private message

Re: Old version kbd.c
PostPosted: Tue Sep 06, 2005 1:59 pm     Reply with quote

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
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

Re: Old version kbd.c
PostPosted: Tue Sep 06, 2005 2:41 pm     Reply with quote

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!
Joshua Lai



Joined: 19 Jul 2004
Posts: 42
Location: Malaysia, PJ

View user's profile Send private message Send e-mail

PostPosted: Sat Sep 17, 2005 3:42 am     Reply with quote

Testing which compiler?

But... my compiler cannot compile the driver.
Joshua Lai



Joined: 19 Jul 2004
Posts: 42
Location: Malaysia, PJ

View user's profile Send private message Send e-mail

PostPosted: Mon Sep 19, 2005 11:33 pm     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group