完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
扫一扫,分享给好友
问题如标题所述,问题出现在stm8_interrupt_vector.c中,将相同的代码与变量移到main.c中则没有问题。太奇怪了!
出现的错误提示如下: #error clnk Debug123.lkf:1 symbol c_idiv not defined (Debugstm8_interrupt_vector.o ) #error clnk Debug123.lkf:1 symbol c_sdivx not defined (Debugstm8_interrupt_vector.o ) The command: "clnk -m Debug123.map -l"D:Program FilesCosmicLib" -o Debug123.sm8 Debug123.lkf " has failed, the returned value is: 1 exit code=1. 错误提示貌似和除法命令有关,所以我就把代码中的除法换成了加法,结果居然编译通过!好奇怪。本人初学者。 stm8_interrupt_vector.c文件中的代码如下: #include "stm8s903k3.h" unsigned char rx_buffer[21];//接收缓存 unsigned char RSSI_value;//RSSI寄存器中的值 signed int RSSI_dBm = 0;//接收信号的强度 signed int RSSI_sum = 0; //3次的RSSI_dBm和 signed int RSSI_ave;//3次的RSSI_dBm的平均值 signed int RSSI_buffer[3];//最近三次的RSSI_dBm值 typedef void @far (*interrupt_handler_t)(void); struct interrupt_vector { unsigned char interrupt_instruction; interrupt_handler_t interrupt_handler; }; @far @Interrupt void NonHandledInterrupt (void) { /* in order to detect unexpected events during development, it is recommended to set a breakpoint on the following instruction */ return; } extern void _stext(); /* startup routine */ extern @far @interrupt void EXTI2_Interrupt(void); struct interrupt_vector const _vectab[] = { {0x82, (interrupt_handler_t)_stext}, /* reset */ {0x82, NonHandledInterrupt}, /* trap */ {0x82, NonHandledInterrupt}, /* irq0 */ {0x82, NonHandledInterrupt}, /* irq1 */ {0x82, NonHandledInterrupt}, /* irq2 */ {0x82, NonHandledInterrupt}, /* irq3 */ {0x82, EXTI2_Interrupt}, /* irq4 */ {0x82, NonHandledInterrupt}, /* irq5 */ {0x82, NonHandledInterrupt}, /* irq6 */ {0x82, NonHandledInterrupt}, /* irq7 */ {0x82, NonHandledInterrupt}, /* irq8 */ {0x82, NonHandledInterrupt}, /* irq9 */ {0x82, NonHandledInterrupt}, /* irq10 */ {0x82, NonHandledInterrupt}, /* irq11 */ {0x82, NonHandledInterrupt}, /* irq12 */ {0x82, NonHandledInterrupt}, /* irq13 */ {0x82, NonHandledInterrupt}, /* irq14 */ {0x82, NonHandledInterrupt}, /* irq15 */ {0x82, NonHandledInterrupt}, /* irq16 */ {0x82, NonHandledInterrupt}, /* irq17 */ {0x82, NonHandledInterrupt}, /* irq18 */ {0x82, NonHandledInterrupt}, /* irq19 */ {0x82, NonHandledInterrupt}, /* irq20 */ {0x82, NonHandledInterrupt}, /* irq21 */ {0x82, NonHandledInterrupt}, /* irq22 */ {0x82, NonHandledInterrupt}, /* irq23 */ {0x82, NonHandledInterrupt}, /* irq24 */ {0x82, NonHandledInterrupt}, /* irq25 */ {0x82, NonHandledInterrupt}, /* irq26 */ {0x82, NonHandledInterrupt}, /* irq27 */ {0x82, NonHandledInterrupt}, /* irq28 */ {0x82, NonHandledInterrupt}, /* irq29 */ }; extern @far @interrupt void EXTI2_Interrupt(void) { unsigned char i,j,k; _asm("sim"); RSSI_ave = rx_buffer[19]; if(RSSI_value>=128) //AGC控制 { RSSI_dBm =( RSSI_value-256)/2-72; } else { RSSI_dBm = RSSI_value/2-72; } for(i=0;i<2;i++) { RSSI_buffer = RSSI_buffer[i+1]; } RSSI_buffer[2] = RSSI_dBm; k = 0; RSSI_sum = 0; for(j=0;j<3;j++) { if(RSSI_buffer[j]) { RSSI_sum += RSSI_buffer[j] ; k++; } } RSSI_ave = RSSI_sum/k; _asm("rim"); return; } |
|
相关推荐
2个回答
|
|
我也遇到类似问题,就会定义不了
|
|
|
|
|
|
|
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
503 浏览 0 评论
求助一下关于51系列单片机的Timer0的计时问题,TH0、TL0+1的时间是怎么算的?
1756 浏览 1 评论
【RA-Eco-RA4E2-64PIN-V1.0开发板试用】开箱+Keil环境搭建+点灯+点亮OLED
1183 浏览 0 评论
【敏矽微ME32G070开发板免费体验】使用coremark测试敏矽微ME32G070 跑分
1053 浏览 0 评论
【敏矽微ME32G070开发板免费体验】开箱+点灯+点亮OLED
1287 浏览 2 评论
【youyeetoo X1 windows 开发板体验】少儿AI智能STEAM积木平台
12020 浏览 31 评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-23 16:02 , Processed in 0.499360 second(s), Total 43, Slave 35 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号