芯片:MC68HC908LK24
环境:freescale codewarrior 6.2
问题:部分程序被编译器干掉,甚至一些对寄存器赋值语句
NumberByte = 0;
SPDR = 0xd;
断点没有办法设置到这两个语句,两条语句也没有被执行,编译时没有任何提示信息。
源代码:
#include <MC68HC908LK24.h> /* I/O map for MC68HC908LK24CFQ */
#include "MCUinit.h"
#include "main.h"
#ifdef __cplusplus
extern "C"
#endif
extern unsigned char StateSPIDEV;
extern unsigned char StateSPIen;
extern unsigned char StateSPICounter;
extern unsigned char NumberByte;
void SPIProcess(void)
{
if(StateSPIDEV == 1)
{
StateSPIDEV = 2;
CS_ADE = 0;
StateSPICounter = 0;
StateSPIen = 1;
NumberByte = 0;
SPDR = 0xd;
}
else if(StateSPIDEV == 4)
{
CS_ADE = 0;
StateSPIDEV = 5;
NumberByte = 0;
SPDR = 0xd;
}
else if(StateSPIDEV == 7)
{
CS_ADE = 0;
StateSPIDEV = 8;
NumberByte = 0;
SPDR = 0xd;
}
else if(StateSPIDEV == 10)
{
CS_ADE = 0;
StateSPIDEV = 11;
NumberByte = 0;
SPDR = 0xd;
}
else if(StateSPIDEV == 13)
{
CS_ADE = 0;
StateSPIDEV = 14;
NumberByte = 0;
SPDR = 0xd;
}
else if(StateSPIDEV == 15)
{
CS_ADE = 0;
StateSPIen = 0;
StateSPICounter = 0;
}
}
void VoltageInterruptProcess(void)
{
unsigned char tmpt;
NumberByte++;
if(NumberByte == 1) SPDR = 0x55;
else if(NumberByte == 2) SPDR = 0x55;
else if(NumberByte == 3) SPDR = 0x55;
else if(NumberByte == 4)
{
CS_ADE = 1;
// tmpt = 2;
tmpt = 4;
CS_ADE = 1;
// tmpt = 2;
tmpt = 4;
SPDR = 0xe;
}
else if(NumberByte == 5) SPDR = 0x55;
else if(NumberByte == 6) SPDR = 0x55;
else if(NumberByte == 7) SPDR = 0x55;
else if(NumberByte == 8)
{
CS_ADE = 1;
// tmpt = 2;
tmpt = 4;
CS_ADE = 1;
// tmpt = 2;
tmpt = 4;
SPDR = 0xe;
}
else if(NumberByte == 9) SPDR = 0x55;
else if(NumberByte == 10) SPDR = 0x55;
else if(NumberByte == 11) SPDR = 0x55;
else if(NumberByte == 8)
{
CS_ADE = 1;
NumberByte = 0;
StateSPIDEV++;
}
} |