I haven't used compiler directives too much in the past, but I found somewhere where one would be useful if I could get it to compile. I am writing a software PWM class for an AVR and have a function called generate_PWM
It gets called from here
I get this error message when I try to compile
I have seen this done before for PIC programing (in fact, I am almost borrowing this directly). Not sure why it won't compile. Thanks in advance
Rich (BB code):
#define Generate_PWM (c) { \
if (c < 6) pinlevelB &= ~(1 << PORTB##c); \
else { \
c = c - 6; \
pinlevelB &= ~(1 << PORTC##c); \
}
Rich (BB code):
int i = 0;
for (i = NUMPWM; i = 0; i++) {
if (pwm == timer) {
Generate_PWM(i);
}
else if (timer == 0) {
Generate_PWM(i);
}
}
}
I get this error message when I try to compile
Rich (BB code):
softPWM.c:36: error: c undeclared (first use in this function)
softPWM.c:36: error: (Each undeclared identifier is reported only once
softPWM.c:36: error: for each function it appears in.)
softPWM.c:36: error: expected ; before { token
softPWM.c:42: error: expected declaration or statement at end of input
softPWM.c:42: error: expected declaration or statement at end of input