共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 跳转至页
回复
有奖活动 | |
---|---|
【EEPW电子工程师创研计划】技术变现通道已开启~ | |
发原创文章 【每月瓜分千元赏金 凭实力攒钱买好礼~】 | |
【EEPW在线】E起听工程师的声音! | |
“我踩过的那些坑”主题活动——第001期 | |
高校联络员开始招募啦!有惊喜!! | |
【工程师专属福利】每天30秒,积分轻松拿!EEPW宠粉打卡计划启动! | |
送您一块开发板,2025年“我要开发板活动”又开始了! | |
打赏了!打赏了!打赏了! |
打赏帖 | |
---|---|
分享汽车通信和多媒体总线结构被打赏20分 | |
【我踩过的那些坑】结构堵孔导致的喇叭无声问题被打赏50分 | |
NUCLEO-U083RC学习历程38+串口通过队列的方式输出两个字符串被打赏20分 | |
【我踩过的那些坑】分享一下调试一款AD芯片的遇到的“坑”被打赏50分 | |
电流检测模块MAX4080S被打赏10分 | |
【我踩过的那些坑】calloc和malloc错误使用导致跑飞问题排查被打赏50分 | |
分享电控悬架的结构与工作原理(一)被打赏20分 | |
多组DCTODC电源方案被打赏50分 | |
【我踩过的那些坑】STM32cubeMX软件的使用过程中的“坑”被打赏50分 | |
新手必看!C语言精华知识:表驱动法被打赏50分 |