According to the description of Holtek _ c _ compiler _ V3 _ FAQ (950). Pdf and v3 do not guarantee that the compiled instructions conform to the EEPROM writing order. According to the data sheet of BS86, Raine and WR must be in order.
My compilation instructions are LSET Ryan and LSET·WR, which is a problem. What the chip needs has been set.
The solution is according to the official FAQ description.
"5.5 How to use MCU with limited writing EEPROM (continuously set wren, wr, flag)?
V3 writes EEPROM? "
This is the code
//Reference? Where to? Holtek_C_Compiler_V3_FAQ(950)。 Extension of portable document format file (abbreviation of portable document format)
typedef? Structure {
Not signed? Charles? bit0? :? 1;
Not signed? Charles? bit 1? :? 1;
Not signed? Charles? bit2? :? 1;
Not signed? Charles? bit3? :? 1;
Not signed? Charles? bit4? :? 1;
Not signed? Charles? bit5? :? 1;
Not signed? Charles? bit6? :? 1;
} iar _ bits
DEFINE_SFR(iar_bits,? iar 1,? 0x 02);
# Definition? IAR 1 _ 3 IAR 1 . bit 3
# Definition? IAR 1 _ 2 IAR 1 . bit 2
# Definition? IAR 1 _ 1iar 1 . bit 1
# Definition? IAR 1 _ 0ia r 1 . bit 0 ...
uint8_t? bkup
_eea? =? u8Addr
_eed? =? u8NewData
_mp 1l? =? 0x40
bkup=? _ MP 1h;
_mp 1h? =? 0x 0 1;
_emi? =? 0;
iar 1_3? =? 1;
iar 1_2? =? 1;
_emi? =? 1;
while(iar 1_2)
{
}
_iar 1? =? 0;
_mp 1h? =? bkup
... the code generated by the official solution is the same as that in the data sheet:
; 129 IAR 1 _ 3? =? 1;
0D0D 3 182 set? __iar 1[0].3 "This used to be LSET? wren
; 130 IAR 1 _ 2? =? 1;
0D0E 3 102 set? __iar 1[0].2 "This used to be LSET? Wassermann reaction