#include "BS84C12A-3.h" unsigned char read_eeprom; //读取的EEPROM void eeprom_read(unsigned char eeprom_address) { unsigned char backup; _eea = eeprom_address; _mp1 = 0x40; backup = _bp; _bp = 1; _emi = 0; _iar1 = 0b00000010; _iar1 |= 0b00000001; _emi = 1; while(_iar1 == 0x03); _iar1 = 0; _bp = backup; read_eeprom=_eed; } void eeprom_write(unsigned char eeprom_address,unsigned char eeprom_data) { unsigned char backup; _eea=eeprom_address; _eed=eeprom_data; _mp1=0x40; backup=_bp; _bp=1; _emi=0; _iar1 =0b00001000; _iar1|=0b00000100; _emi=1; while(_iar1==0x0c); _iar1=0; _bp=backup; } void main() { eeprom_write(0x00,0x55); eeprom_read(0x00); _nop(); _nop(); }