请提供一下79F1611的内部EEPROM读写的C程序.按说明书编了怎么不行,求指教:
uchar EEPROM_read(uchar read_page,uchar read_address)
{
uchar tt0;
EA = 0;
FLASHCON = 1;
XPAGE = read_page;
IB_OFFSET = read_address;
_nop_();
_nop_();
_nop_();
_nop_();
tt0 = *(unsigned char code *)(read_address);
XPAGE = 0;
FLASHCON = 0;
EA = 1;
return tt0;
}
void EEPROM_erase(uchar write_page)
{
EA = 0;
FLASHCON = 1;
XPAGE = write_page;
IB_CON1 = 0xE6;
IB_CON2 = 0x05;
IB_CON3 = 0x0A;
IB_CON4 = 0x09;
IB_CON5 = 0x06;
_nop_();
_nop_();
_nop_();
_nop_();
}
void EEPROM_write(uchar write_page,uchar write_address,uchar write_data)
{
EEPROM_erase(write_page);
XPAGE = write_page;
IB_OFFSET = write_address;
IB_DATA = write_data;
IB_CON1 = 0x6E;
IB_CON2 = 0x05;
IB_CON3 = 0x0A;
IB_CON4 = 0x09;
IB_CON5 = 0x06;
_nop_();
_nop_();
_nop_();
_nop_();
XPAGE = 0;
FLASHCON = 0;
EA = 1;
} |