|
|
View previous topic :: View next topic |
Author |
Message |
radi Guest
|
comments in macro |
Posted: Thu Feb 26, 2004 3:59 am |
|
|
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 |
Posted: Thu Feb 26, 2004 5:31 am |
|
|
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
|
RADI |
Posted: Fri Feb 27, 2004 3:16 am |
|
|
Ttelman, thank you very much! Now everything is clear for me.
Best Wishes |
|
|
|
|
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
|