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

comments in macro

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







comments in macro
PostPosted: Thu Feb 26, 2004 3:59 am     Reply with quote

Do someone knows how may I put comments inside micro?

I try something like this:

#define display()\ //Macro for....
output_b(0b11111111);\ // Mask PORTB.
output_high(PIN_A5);\ // set "a" segment.
delay_cycles(80);\ //.......
PORTA=(PORTA&0b11111000)|temp0_interrupt; // Select current display.


When I clear the comments everything is allright, but when I have comments the problems come.
Ttelmah
Guest







Re: comments in macro
PostPosted: Thu Feb 26, 2004 5:31 am     Reply with quote

radi wrote:
Do someone knows how may I put comments inside micro?

I try something like this:

#define display()\ //Macro for....
output_b(0b11111111);\ // Mask PORTB.
output_high(PIN_A5);\ // set "a" segment.
delay_cycles(80);\ //.......
PORTA=(PORTA&0b11111000)|temp0_interrupt; // Select current display.


When I clear the comments everything is allright, but when I have comments the problems come.

You should put the comments before the '\'.
Do them like this:
Code:

#define display() /*Macro for...*/\
     output_b(0b11111111); /* Mask PORTB.*/\
     output_high(PIN_A5); /* set "a" segment.*/\
     delay_cycles(80); /*.......*/\
     PORTA=(PORTA&0b11111000)|temp0_interrupt   /* Select current display.*/


Note also that you don't really want the ';' at the end of the last line (since presumably 'display', will be typed as 'display();', and you will get an 'extra' ';', when the expression is expanded.

The problem is that the '\', means 'skip the significance of the following line feed', and the compiler does not 'remember' this to the end of the line if followed by a comment. Using '/* */', allows you to terminate the comment, and then use the '\'.

Best Wishes
RADI



Joined: 26 Feb 2004
Posts: 1

View user's profile Send private message ICQ Number

RADI
PostPosted: Fri Feb 27, 2004 3:16 am     Reply with quote

Ttelman, thank you very much! Now everything is clear for me.

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