View previous topic :: View next topic |
Author |
Message |
rbuck
Joined: 23 May 2007 Posts: 2 Location: Phoenix, AZ
|
Pre-Processor Question |
Posted: Wed May 23, 2007 9:46 pm |
|
|
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
|
|
Posted: Wed May 23, 2007 9:58 pm |
|
|
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
|
|
Posted: Thu May 24, 2007 8:12 am |
|
|
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. |
|
|
|