STM8S使用STVD+COMSIC奇怪的问题
定义了@eeprom unsigned char memoryProtected[] = {0x00,0xff,0xff,0xff };
unsigned char command;
本想这样赋值
memoryProtected[(command>>3)]|= (1<<(command&0x07));
结果CGSTM8崩溃
注册这行就没问题
然后就这样来试试
@eeprom unsigned char memoryProtected[] = {0x00,0xff,0xff,0xff };unsigned char command,TempAdd=0,TempValu=0;
TempAdd=(command&0x1f)>>3;
TempValu=1<<(command&0x07);
// memoryProtected|= TempValu;
去掉上一行的注册就崩溃
然后这样
memoryProtected|= TempValu;
memoryProtected|= TempValu;
memoryProtected|= TempValu;
memoryProtected|= TempValu;
都没有问题
请指点
有什么奇怪的,内存溢出了! 我用的8L052感觉EEPROM也有问题,频繁操作写的话程序偶尔会死掉 command>>3
这里没有做防溢出处理。 还是用IAR吧,,,好用得多 应该是你数组越界了吧 如果像楼上几层说的是溢出的话,这样试试。
memoryProtected[(command>>3)&0x03]|= (1<<(command&0x07)); sfd123-302670 发表于 2017-4-6 08:02
有什么奇怪的,内存溢出了!
是啊!!!
超界了!!! 帮顶,这个STM8用的少。
command>>3
这里没有做防溢出处理。
页:
[1]
2