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
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...
The error on line 30 of timer.c is indeed the first error encountered during compilation & there are no earlier errors.
timer.c(30) is void timer0 (void) interrupt 1
I'm need to simply generate a fixed duration pulse using Timer 0.
-- Dipen
... that is 'open ended' would cause this.
if you have CodeWright it is a breeze to insert // in front of the lines back to the top and if that removes the error, you know and can find the previous line causing the error.
anyhow, my guess is that the cause of the error is higher up.
Erik
The following line in "timer.h" file was generating the error
void timer0 (void) interrupt TF0_VECTOR
Compiling after commenting the same, resulted in "Project" - 0 Error(s), 0 Warning(s).
Agreed, the issue was somewhere above in the code.
Thank you. Dipen