This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Timer 0 ISR - Function declaration in Keil 4

Hello,

I have declared a Timer 0 ISR using Keil 4 as follows:

void timer0 (void) interrupt 1
{

// blank

// yet to add my ISR code

}

With this, I get the following two errors in Keil 4

timer.c(30): error C132: 'timer0': not in formal parameter list
timer.c(30): error C141: syntax error near 'interrupt'

Kindly assist for resolving this issue.

P.S. When compiled in Keil 3, I get 0 Errors, 0 Warnings

Thanks,
Dipen Shah

Parents
  • Remember that an error early-on in the compilation is likely to leave the compiler "out of step" with your source - so any subsequent errors are likely to be a direct result of the earlier error.

    Therefore it is really important that you fix the first-reported error first

    Are the errors that you posted the first ones reported for this file, or were there also other, earlier, messages?

    This applies to any 'C' compiler - it is nothing specifically to do with Keil.

    The second important thing is to read the message literally, and think about what it is telling you:

    timer.c(30): error C132: 'timer0': not in formal parameter list
    

    For a start, "timer.c(30)" tells you that the message relates to line 30 of timer.c - is that actually the line that you have posted?

    Second, do you understand what a "formal parameter list" is? If not, you need to check your 'C' textbook - it is a standard programming term...

    Now, when we look at the code you posted, we can see that "timer0" certainly does not appear in any formal parameter list that you have shown - so, either you have shown the wrong piece of code, or this is due to some earlier error...

Reply
  • Remember that an error early-on in the compilation is likely to leave the compiler "out of step" with your source - so any subsequent errors are likely to be a direct result of the earlier error.

    Therefore it is really important that you fix the first-reported error first

    Are the errors that you posted the first ones reported for this file, or were there also other, earlier, messages?

    This applies to any 'C' compiler - it is nothing specifically to do with Keil.

    The second important thing is to read the message literally, and think about what it is telling you:

    timer.c(30): error C132: 'timer0': not in formal parameter list
    

    For a start, "timer.c(30)" tells you that the message relates to line 30 of timer.c - is that actually the line that you have posted?

    Second, do you understand what a "formal parameter list" is? If not, you need to check your 'C' textbook - it is a standard programming term...

    Now, when we look at the code you posted, we can see that "timer0" certainly does not appear in any formal parameter list that you have shown - so, either you have shown the wrong piece of code, or this is due to some earlier error...

Children