KeilArm中运行以下程序出错
unsigned char CharDat[32];
unsigned char *p8dat;
unsigned int *p32dat;
p8dat = CharDat;
p32dat = (unsigned int *)p8dat;
ISPDAT = *p32dat; // ISPDAT为特殊32位寄存器,运行此句发生复位
后来没有办法,改成如下通过,有什么其他简单,效率高的写法吗?
u32tmp = (unsigned int)(*p8dat)<<24;
p8dat++;
u32tmp += (unsigned int)(*p8dat)<<16;
p8dat++;
u32tmp += (unsigned int)(*p8dat)<<8;
p8dat++;
u32tmp += (unsigned int)(*p8dat)<<0;
p8dat++;
ISPDAT = u32tmp;
|