以前用keilc惯了,一转用IAR发现不少套路行不通了,网上查询未果请大家指点:
在中断中调用变量,变量定义为全局如:
char IntSource=0;
#pragma vector=INT0_vect
__interrupt void ExtInt0()
{
IntSource =……;
……;
}
则编译时错误为:
Error[Pe147]: declaration is incompatible with "char __tiny Rc500Int" (declared at line 90)
Error[Pe137]: expression must be a modifiable lvalue
若将变量放进中断函数里:
#pragma vector=INT0_vect
__interrupt void ExtInt0()
{
char IntSource=0;
IntSourceIntSource =……;
……;
}
则编译时错误为:
Error[e18]: Range error,
Number out of range. Valid range is -128 (-0x80) to 255 (0xFF).
File: C:\Documents and Settings\lanbao\桌面\avr\avr.c, Line: 20 |