void FlashWrite(void)
{
unsigned char xdata *pwrite;
unsigned char i;
EA =0;
PSCTL=0x07;
FLSCL=0x01;
pwrite=0;
*pwrite=0x00;
PSCTL=0x05;
for(i=0;i<16;i++)
{
*pwrite=SETTING[i];
pwrite++;
}
PSCTL=0x00;
FLSCL=0x00;
EA =1;
}
程序不看也没关系,就是在对PSCTL寄存器赋值=0x07时,单步后PSCTL没有=0x07,有时候=0x6a,有时候=0x6d...
而且FLASH读写函数之前用过是可以的,然后突然就不行了,估计也不是硬件问题,板子换过,求指点 |