写的时候,程序会一直死在这个函数这里,这是什么情况啊了?
[/mw_shl_code]
while(!FLASH_IAPSR_EOP);,[/mw_shl_code]
#define uint unsigned int
#define uchar unsigned char
#define ulong unsigned long
#define MASS_KEY1 0xAE
#define MASS_KEY2 0x56
#define EEP_BASE 0x4000
void delay_ms(uchar ms)
{
uchar i,j;
while(ms--)
{
for(i=4;i!=0;i--)
for(j=100;j!=0;j--);
}
}
void EEP_Init(void)
{
FLASH_CR1 = 0x00;
FLASH_CR2 = 0x00;
FLASH_NCR2 = 0xff;
FLASH_DUKR = MASS_KEY1;
FLASH_DUKR = MASS_KEY2;
while(!FLASH_IAPSR_DUL);
}
void eep_write(uint addr,uchar dat)
{
*((uchar*)(addr + EEP_BASE)) = dat;
while(!FLASH_IAPSR_EOP);
}
uchar eep_read(uint addr)
{
return *((uchar*)(EEP_BASE + addr));
}
void main(void)
{
asm("sim");
EEP_Init();
while(1)
{
asm("
nop");
}
}[/mw_shl_code]
一周热门 更多>