View previous topic :: View next topic |
Author |
Message |
bsodmike
Joined: 05 Aug 2006 Posts: 52
|
#ifdef, what device? |
Posted: Sun Oct 15, 2006 1:16 am |
|
|
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
|
|
Posted: Sun Oct 15, 2006 3:07 am |
|
|
#if getenv("DEVICE")=="16F877A"
... code for this device
#else
etc..
Best Wishes |
|
|
Douglas Kennedy
Joined: 07 Sep 2003 Posts: 755 Location: Florida
|
|
Posted: Sun Oct 15, 2006 7:05 am |
|
|
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
|
|
Posted: Sun Oct 15, 2006 11:32 am |
|
|
Thanks, the getenv() method seems the cleanest, cheers!
Mike |
|
|
|