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

#ifdef, what device?

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



Joined: 05 Aug 2006
Posts: 52

View user's profile Send private message Visit poster's website AIM Address MSN Messenger

#ifdef, what device?
PostPosted: Sun Oct 15, 2006 1:16 am     Reply with quote

Hi,

I want to have my code load different (well obv) settings based on what PIC has been used when compiled, i.e. 16f877A or something else.

What's the pre-processor arg to check for this?

something along the lines of,

#ifdef <16f877a>
...
...
#elif <16f648A>
..
..
#endif


I have a couple hardware profiles that are selected by commenting out some defines. I *could* in each setup a define such as #define _16F877A, and follow with the ifdefs. Was wondering if there was something inbuild that would already 'realise' what device was being used via the #device para in the include files for the devices.

Thanks!
Ttelmah
Guest







PostPosted: Sun Oct 15, 2006 3:07 am     Reply with quote

#if getenv("DEVICE")=="16F877A"
... code for this device
#else

etc..

Best Wishes
Douglas Kennedy



Joined: 07 Sep 2003
Posts: 755
Location: Florida

View user's profile Send private message AIM Address

PostPosted: Sun Oct 15, 2006 7:05 am     Reply with quote

I prefer Ttelmah solution however this also works
#if __device__ ==8720
both are in the manual. It is better to look things up in the manual before posting perhaps you missed them or didn't search under key word device
bsodmike



Joined: 05 Aug 2006
Posts: 52

View user's profile Send private message Visit poster's website AIM Address MSN Messenger

PostPosted: Sun Oct 15, 2006 11:32 am     Reply with quote

Thanks, the getenv() method seems the cleanest, cheers!

Mike
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