View previous topic :: View next topic |
Author |
Message |
richi-d
Joined: 28 Aug 2007 Posts: 106
|
PCWHD has problems with asm declaration |
Posted: Thu Mar 19, 2009 2:36 pm |
|
|
Hi,
I'm working for a long time with CCS and had PCB, PCM and PCH compilers. Now I updated to PCWHD but there is always the same error at my older code:
*** Error 95 "Main.c" Line 88(7,8): Expecting an opcode mnemonic
*** Error 51 "Main.c" Line 88(7,8): A numeric expression must appear here
The error is showed here
In the top of my main.c I have:
Code: |
#define NOP #asm NOP #endasm;
|
Any ideas? Whats wrong in my declaration |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Mar 19, 2009 3:04 pm |
|
|
The test program shown below compiles OK in vs. 4.068. But it fails to
compile in several versions after that including the current vs. 4.089.
Report it to CCS support. Tell them your version and the error message.
Give them a test program. Tell them that it worked in earlier versions.
Code: | #include <16F877.H>
#fuses XT, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock=4000000)
#define NOP #asm nop #endasm
//================================
void main()
{
NOP;
while(1);
} |
|
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Thu Mar 19, 2009 3:10 pm |
|
|
I don't know what has been changed here, but the problem apparently comes from using the reserved asm word NOP also as the macro name. Seriously, you wouldn't expect this to work with a macro expanding to plain C code. If you change the macro name to _NOP, it's O.K.
B.T.W.: CCS loves to apply incompatible changes to the compiler from time to time, that require revision of previously working applications. The only clean solution is to freeze CCS C version with a project until a major revision, I think. |
|
|
richi-d
Joined: 28 Aug 2007 Posts: 106
|
Thank you!! |
Posted: Thu Mar 19, 2009 3:30 pm |
|
|
That works... No Problem, I will use the Replace-function to do that...
But I hope that I get no other hidden problems with the new compiler!! |
|
|
Ttelmah Guest
|
|
Posted: Fri Mar 20, 2009 5:34 am |
|
|
I'd actually expect this to work, _if you enable case significance_, but not otherwise. The fact that it did on earlier compilers, suggests that the compiler was treating macros as having some case significance, even if this is disabled. I'd actually say the 'new' behaviour, is more correct....
Best Wishes |
|
|
|