PIC18F25K80写EEPROM 写之前关闭全局中断 写好后开启全局中断 每次写完EEPROM后串口中断就无法进入 有没有大神可以指点一下
void W_EEPROM(void)
{
unsigned char i = 0;
//INTCONbits.GIEH = 0; //关闭全局中断
EECON1bits.WREN = 1;
ui_EEPROM_Addr = 0;
for(i=0;i<110;i++)
{
ui_EEPROM_Addr = EEPROM_Start_Addr + i;
EEADRH = ui_EEPROM_Addr>>8;
EEADR = ui_EEPROM_Addr;
EEDATA = EEPROM_Data[i];
EECON2 = 0x55;
EECON2 = 0x0AA;
EECON1bits.WR = 1;
while(EECON1bits.WRERR);
}
EECON1bits.WREN = 0;
//INTCONbits.GIEH = 1; //使能全局中断
} |