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 support@ccsinfo.com

using #define before the processor is defined

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



Joined: 15 Sep 2003
Posts: 184
Location: Warrington UK

View user's profile Send private message

using #define before the processor is defined
PostPosted: Tue Jan 01, 2019 6:45 am     Reply with quote

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
MikeW



Joined: 15 Sep 2003
Posts: 184
Location: Warrington UK

View user's profile Send private message

PostPosted: Tue Jan 01, 2019 6:48 am     Reply with quote

Found it, the compiler won't allow the number, if I change it to
Code:

#define P18F13K22 or PIC_P18F13K22
it compiles.
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Tue Jan 01, 2019 8:19 am     Reply with quote

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 _
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