共2条
1/1 1 跳转至页
430c 【求助】关于430c 的中断服务程序问题

问
刚开始学习430,写了如下中断程序:
interrupt[BASICTIMER_VECTOR] void basic_timer (void)
{
second++;
IFG2=BTIFG^0X80; //clear the interrupt flag
}
在进行编译的时候,有如下错误:
Error[Pe094]: the size of an array must be greater than zero
Error[Pe077]: this declaration has no storage class or type specifier
Error[Pe065]: expected a ";"
请问高手这是什么原因,难道是我的编译器不支持中断么?
在解决error[pe077]这个错误时,只要在interrupt前面增加static关键词就可以了,但是为什么不可以省略?
请各位高手指点。 答 1: 不同版本的中断书写格式是不一样的,请参考安装目录下的例程的书写格式。 答 2: 谢谢hzyhy得指点,我参考安装目录下的例程书写格式书写之后,上述的几个错误提示消失,但又出现了如下的错误提示:
Building configuration: t3 - Debug
display.c
icc430.exe -I C:\Program Files\IAR Systems\Embedded Workbench 3.2\430\INC\ -I C:\Program Files\IAR Systems\Embedded Workbench 3.2\430\INC\CLIB\ -o D:\
porgram of 430\430\Debug\Obj\ -z2 --no_cse --no_unroll --no_inline --no_code_motion --debug -e --double=32 D:\porgram of 430\430\display.c
IAR MSP430 C Compiler V2.21B-P1/W32 [Kickstart]
Copyright 1996-2003 IAR Systems. All rights reserved.
424 bytes of CODE memory
22 bytes of CONST memory
26 bytes of DATA memory (+ 9 bytes shared)
Errors: none
Warnings: none
Linking
xlink.exe D:\porgram of 430\430\Debug\Obj\display.r43 -o D:\porgram of 430\430\Debug\Exe\t3.d43 -rt -IC:\Program Files\IAR Systems\Embedded Workbench 3.2\430\
LIB\ -f C:\Program Files\IAR Systems\Embedded Workbench 3.2\430\config\lnk430F449.xcl -e_small_write=_formatted_write -e_medium_read=_formatted_read -f C:\
Program Files\IAR Systems\Embedded Workbench 3.2\430\config\multiplier.xcl -f C:\Program Files\IAR Systems\Embedded Workbench 3.2\430\config\
compactmath.xcl
IAR Universal Linker V4.56E/386
Copyright 1987-2003 IAR Systems. All rights reserved.
Error[e46]: Undefined external "?SwitchKey16" referred in display ( D:\porgram of 430\430\Debug\Obj\display.r43 )
Error[e46]: Undefined external "?Epilogue4" referred in display ( D:\porgram of 430\430\Debug\Obj\display.r43 )
Error[e46]: Undefined external "?Epilogue3" referred in display ( D:\porgram of 430\430\Debug\Obj\display.r43 )
Error[e46]: Undefined external "?DivMod16u" referred in display ( D:\porgram of 430\430\Debug\Obj\display.r43 )
Error[e46]: Undefined external "?DivMod16s" referred in display ( D:\porgram of 430\430\Debug\Obj\display.r43 )
Error[e46]: Undefined external "?cstart_init_copy" referred in display ( D:\porgram of 430\430\Debug\Obj\display.r43 )
Error[e46]: Undefined external "?cstart_init_zero" referred in display ( D:\porgram of 430\430\Debug\Obj\display.r43 )
Error[e46]: Undefined external "?longjmp_r4" referred in display ( D:\porgram of 430\430\Debug\Obj\display.r43 )
Error[e46]: Undefined external "?longjmp_r5" referred in display ( D:\porgram of 430\430\Debug\Obj\display.r43 )
Error[e46]: Undefined external "?setjmp_r4" referred in display ( D:\porgram of 430\430\Debug\Obj\display.r43 )
Error[e46]: Undefined external "?setjmp_r5" referred in display ( D:\porgram of 430\430\Debug\Obj\display.r43 )
58 bytes of CODE memory
6 bytes of DATA memory (+ 9 absolute )
2 bytes of CONST memory
Errors: 11
Warnings: none
Total number of errors: 11
Total number of warnings: 0
上述错误提示应该都在LINKING的时候发生的情况,不明白这是为什么,敬请高手们再指点指点
interrupt[BASICTIMER_VECTOR] void basic_timer (void)
{
second++;
IFG2=BTIFG^0X80; //clear the interrupt flag
}
在进行编译的时候,有如下错误:
Error[Pe094]: the size of an array must be greater than zero
Error[Pe077]: this declaration has no storage class or type specifier
Error[Pe065]: expected a ";"
请问高手这是什么原因,难道是我的编译器不支持中断么?
在解决error[pe077]这个错误时,只要在interrupt前面增加static关键词就可以了,但是为什么不可以省略?
请各位高手指点。 答 1: 不同版本的中断书写格式是不一样的,请参考安装目录下的例程的书写格式。 答 2: 谢谢hzyhy得指点,我参考安装目录下的例程书写格式书写之后,上述的几个错误提示消失,但又出现了如下的错误提示:
Building configuration: t3 - Debug
display.c
icc430.exe -I C:\Program Files\IAR Systems\Embedded Workbench 3.2\430\INC\ -I C:\Program Files\IAR Systems\Embedded Workbench 3.2\430\INC\CLIB\ -o D:\
porgram of 430\430\Debug\Obj\ -z2 --no_cse --no_unroll --no_inline --no_code_motion --debug -e --double=32 D:\porgram of 430\430\display.c
IAR MSP430 C Compiler V2.21B-P1/W32 [Kickstart]
Copyright 1996-2003 IAR Systems. All rights reserved.
424 bytes of CODE memory
22 bytes of CONST memory
26 bytes of DATA memory (+ 9 bytes shared)
Errors: none
Warnings: none
Linking
xlink.exe D:\porgram of 430\430\Debug\Obj\display.r43 -o D:\porgram of 430\430\Debug\Exe\t3.d43 -rt -IC:\Program Files\IAR Systems\Embedded Workbench 3.2\430\
LIB\ -f C:\Program Files\IAR Systems\Embedded Workbench 3.2\430\config\lnk430F449.xcl -e_small_write=_formatted_write -e_medium_read=_formatted_read -f C:\
Program Files\IAR Systems\Embedded Workbench 3.2\430\config\multiplier.xcl -f C:\Program Files\IAR Systems\Embedded Workbench 3.2\430\config\
compactmath.xcl
IAR Universal Linker V4.56E/386
Copyright 1987-2003 IAR Systems. All rights reserved.
Error[e46]: Undefined external "?SwitchKey16" referred in display ( D:\porgram of 430\430\Debug\Obj\display.r43 )
Error[e46]: Undefined external "?Epilogue4" referred in display ( D:\porgram of 430\430\Debug\Obj\display.r43 )
Error[e46]: Undefined external "?Epilogue3" referred in display ( D:\porgram of 430\430\Debug\Obj\display.r43 )
Error[e46]: Undefined external "?DivMod16u" referred in display ( D:\porgram of 430\430\Debug\Obj\display.r43 )
Error[e46]: Undefined external "?DivMod16s" referred in display ( D:\porgram of 430\430\Debug\Obj\display.r43 )
Error[e46]: Undefined external "?cstart_init_copy" referred in display ( D:\porgram of 430\430\Debug\Obj\display.r43 )
Error[e46]: Undefined external "?cstart_init_zero" referred in display ( D:\porgram of 430\430\Debug\Obj\display.r43 )
Error[e46]: Undefined external "?longjmp_r4" referred in display ( D:\porgram of 430\430\Debug\Obj\display.r43 )
Error[e46]: Undefined external "?longjmp_r5" referred in display ( D:\porgram of 430\430\Debug\Obj\display.r43 )
Error[e46]: Undefined external "?setjmp_r4" referred in display ( D:\porgram of 430\430\Debug\Obj\display.r43 )
Error[e46]: Undefined external "?setjmp_r5" referred in display ( D:\porgram of 430\430\Debug\Obj\display.r43 )
58 bytes of CODE memory
6 bytes of DATA memory (+ 9 absolute )
2 bytes of CONST memory
Errors: 11
Warnings: none
Total number of errors: 11
Total number of warnings: 0
上述错误提示应该都在LINKING的时候发生的情况,不明白这是为什么,敬请高手们再指点指点
共2条
1/1 1 跳转至页
回复
有奖活动 | |
---|---|
“我踩过的那些坑”主题活动——第002期 | |
【EEPW电子工程师创研计划】技术变现通道已开启~ | |
发原创文章 【每月瓜分千元赏金 凭实力攒钱买好礼~】 | |
【EEPW在线】E起听工程师的声音! | |
高校联络员开始招募啦!有惊喜!! | |
【工程师专属福利】每天30秒,积分轻松拿!EEPW宠粉打卡计划启动! | |
送您一块开发板,2025年“我要开发板活动”又开始了! | |
打赏了!打赏了!打赏了! |