[英]“incomplete type is not allowed” for interrupt service routine for PIC
When I try to compile the code for a PIC program using PICMicro C compiler, I got the error "incomplete type is not allowed" for the interrupt service routine part of the code: 当我尝试使用PICMicro C编译器为PIC程序编译代码时,对于代码的中断服务例程部分,出现错误“不允许输入不完整的类型”:
char chB = 0;
int clicks = 0;
void interrupt ISR(void) //incomplete type is not allowed
{
if(RBIF == 1)
{
clicks++;
chB = PORTB;
RBIF = 0;
}
}
After checking multiple sources, I still do not see how the service routine is incorrectly written.. 在检查了多个源之后,我仍然看不到服务例程是如何被错误编写的。
Edit: Thanks for all your help, I have found the solution: 编辑:感谢您的所有帮助,我找到了解决方案:
char chB = 0;
int clicks = 0;
#pragma vector = 0x04
__interrupt void isr(void)
{
if(RBIF == 1)
{
clicks++;
chB = PORTB;
RBIF = 0;
}
}
"interrupt ISR" is not a valid name, because it has a space in it. “ interrupt ISR”不是有效名称,因为其中有一个空格。
void interrupt_isr(void)
should be fine. void interrupt_isr(void)
应该可以。
For PIC16xxx family MCUs use this form: 对于PIC16xxx系列MCU,请使用以下格式:
void interrupt () {
} // end interrupt
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.