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

Pre-Processor Question

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



Joined: 23 May 2007
Posts: 2
Location: Phoenix, AZ

View user's profile Send private message

Pre-Processor Question
PostPosted: Wed May 23, 2007 9:46 pm     Reply with quote

I have just started using the CCS compiler. I am using PCWH 4.032 along with MPLAB 7.50. I can't seem to find a statement similar to EQU that would be used if programming in assembly.

I want to use something like Bank1 equ 0xFE. Then when the code is compiled it would substitute 0xFE everywhere it saw Bank1. I can't use #define because it only accepts strings.

If I use something like int Bank1 = 0xFE; that assigns the variable Bank1 to a RAM location. The code will run using this type of statement, but the CCS book says the code will run significantly slower using variable assignments. I want the Pre-Processor to handle the assignment without having to use any RAM or ROM. It is also kind of strange that #define can only accept a string as an argument.

Any help would be appreciated. I'm sure there is a way to do what I am trying to accomplish but I can't find it.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed May 23, 2007 9:58 pm     Reply with quote

Quote:
It is also kind of strange that #define can only accept a string as an argument.

Where did you see this ? It's certainly not the case.
Look in any CCS driver file. Look in most Example files.


Anyway, I think you may want to look in the CCS manual under
the sections on #byte and #locate.
rbuck



Joined: 23 May 2007
Posts: 2
Location: Phoenix, AZ

View user's profile Send private message

PostPosted: Thu May 24, 2007 8:12 am     Reply with quote

I had an error somewhere in my code. When I tried to compile the code, I kept getting an error message "numerical argument expected". What I was doing was this:
#define Bank1 0xFE
Then later in the code I had this statement:
output_c(Bank1); This is the line the error message was referring to.

I finally deleted it and started over. Now the #define 0xFE works and when I look at the .sym file, no RAM or ROM is being used for the #define. I never did find what was causing the compiler error message. Something dumb on my part.

Thanks for the help, and I will look at the other 2 references you mentioned.
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