Ahhhhh, yes. Case sensitivity. I am out of the habit of seeing
that. Stupid me!!!! Thanks so much!
-Tony
--- In AVR-Chat@yahoogroups.com, "Jesper Hansen" <jesperh@t...>
wrote:
> You have "if" with a capital "I" in the signal handler.
> Change to "if".
>
> /Jesper
>
> ----- Original Message -----
> From: "arhodes19044" <spamiam@c...>
> To: <AVR-Chat@yahoogroups.com>
> Sent: Tuesday, April 12, 2005 4:00 PM
> Subject: [AVR-Chat] Gcc code error question
>
>
> >
> >
> > I am trying out some GCC code. I started with the BDmicro
example
> > which sets a timer interrupt and flashes the LED on his board.
I
> > then tried to make the interrupt handler toggle the LED avery
1024
> > ticks. I got errors that I can't explain.
> >
> > Here is the code. WHite space is slightly trimmed for
compactness
> >
> >
> > --------------------------------------
> > #include <avr/io.h>
> > #include <avr/interrupt.h>
> > #include <avr/signal.h>
> > #include <inttypes.h>
> >
> > volatile uint16_t ms_count;
> > /* millisecond counter interrupt vector */
> >
> > SIGNAL(SIG_OUTPUT_COMPARE0)
> > {
> > ms_count++;
> > If (ms_count == 1024)
> > {
> > PORTB ^= 0x01; /* toggle LED */ /* toggles every second */
> > ms_count = 0;
> > }
> > }
> >
> > void init_timer(void)
> > {
> > /*
> > * Initialize timer0 to generate an output compare interrupt,
and
> > * set the output compare register so that we get that interrupt
> > * every millisecond.
> > */
> > TIFR |= _BV(OCIE0);
> > TCCR0 = _BV(WGM01)|_BV(CS02)|_BV(CS00); /* CTC, prescale = 128
*/
> > TCNT0 = 0;
> > TIMSK |= _BV(OCIE0); /* enable output compare interrupt */
> > OCR0 = 125; /* match in 1 ms */
> > }
> >
> >
> > int main(void)
> > {
> > DDRB = 0x01; /* enable PORTB 1 as an output */
> > init_timer();
> >
> > /* enable interrupts */
> > sei();
> > while (1)
> > {
> > /* loop endlessly */
> > }
> >
> > }
> >
> >
> > ----------- and the error I get is:
> >
> >> "make.exe" all
> > avr-gcc -g -mmcu=atmega128 -Wall -O -c -o hw.o hw.c
> > hw.c: In function `__vector_15':
> > hw.c:50: warning: implicit declaration of function `If'
> > hw.c:51: error: parse error before '{' token
> > hw.c: At top level:
> > hw.c:55: error: parse error before '}' token
> > make.exe: *** [hw.o] Error 1
> >
> >> Process Exit Code: 2
> >
> >
> > ----------------------------------------
> >
> >
> > The IF statement inside the interrupt handler is the problem.
> >
> > It looks fine to me. What is wrong?
> >
> > -Tony
> >
> >
> >
> >
> >
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
> >
> >Message
Re: Gcc code error question
2005-04-12 by arhodes19044
Attachments
- No local attachments were found for this message.