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

PCWHD has problems with asm declaration

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



Joined: 28 Aug 2007
Posts: 106

View user's profile Send private message

PCWHD has problems with asm declaration
PostPosted: Thu Mar 19, 2009 2:36 pm     Reply with quote

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
Code:

NOP;



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

View user's profile Send private message

PostPosted: Thu Mar 19, 2009 3:04 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Mar 19, 2009 3:10 pm     Reply with quote

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

View user's profile Send private message

Thank you!!
PostPosted: Thu Mar 19, 2009 3:30 pm     Reply with quote

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







PostPosted: Fri Mar 20, 2009 5:34 am     Reply with quote

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