![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
MikeW
Joined: 15 Sep 2003 Posts: 184 Location: Warrington UK
|
using #define before the processor is defined |
Posted: Tue Jan 01, 2019 6:45 am |
|
|
I am trying to generalise Ttelmah's excellent SSD1306 driver.
Rather than define the processor and fuses at the top of the main program,
I want to have a multiple choice of processor and fuses etc, and select at the top of the main program file.
It won't allow that, any help ?
Code: | /*
#include <18F13K22.h>
#fuses INTRC_IO, PLLEN, NOXINST, NOMCLR, NOLVP, STVREN, PCLKEN, NOFCMEN
#fuses NOIESO, NOPUT, BORV22, NODEBUG, NOPROTECT, NOWDT, WDT512
#fuses HFOFST, NOCPD, NOCPB, NOWRTD, NOWRTC, NOWRTB
#USE DELAY(INTERNAL=32MHz)
#USE I2C(I2C1, MASTER, FAST=400000, FORCE_HW)
*/
#define 18F13K22
#include "SSD1306_Processorand Fuses_Header.h"// replaces the above to allow for diferent processors |
|
|
![](templates/subSilver/images/spacer.gif) |
MikeW
Joined: 15 Sep 2003 Posts: 184 Location: Warrington UK
|
|
Posted: Tue Jan 01, 2019 6:48 am |
|
|
Found it, the compiler won't allow the number, if I change it to
Code: |
#define P18F13K22 or PIC_P18F13K22 | it compiles. |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19387
|
|
Posted: Tue Jan 01, 2019 8:19 am |
|
|
That's not 'the compiler'. That's C....
The 'name' of the macro, is required to be a valid C identifier.
The first rule for identifiers, is that the first character can only be
a-z, A-Z or _ |
|
![](templates/subSilver/images/spacer.gif) |
|
|
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
|