Rev. 1.10
34
November 04, 2019
Rev. 1.10
35
November 04, 2019
HT45F5Q-3
Battery Charger Flash MCU
HT45F5Q-3
Battery Charger Flash MCU
set high, to ensure the write or erase cycle executes correctly. The global interrupt bit EMI should
also be cleared before a write or erase cycle is executed and then set again after a valid write or erase
activation procedure has completed. Note that the device should not enter the IDLE or SLEEP mode
until Emulated EEPROM read, write or erase operation is totally complete. Otherwise, Emulated
EEPROM read, write or erase operation will fail.
Programming Examples
Erase a Data Page of the Emulated EEPROM – polling method
MOV A, EEPROM_ADRES ; user-defined page
MOV EAR, A
MOV A, 00H ; Erase time=2ms (40H for 4ms, 80H for 8ms, C0H for 16ms)
MOV ECR, A
CLR EMI
SET EEREN ; set EEREN bit, enable erase operation
SET EER ; start Erase Cycle – set EER bit – executed immediately
; after setting EEREN bit
SET EMI
BACK:
SZ EER ; check for erase cycle end
JMP BACK
:
Writing Data to the Emulated EEPROM – polling method
MOV A, EEPROM_ADRES ; user-defined address
MOV EAR, A
MOV A, EEPROM_DATA0_L ; user-defined data
MOV ED0L, A
MOV A, EEPROM_DATA0_H
MOV ED0H, A
MOV A, EEPROM_DATA1_L
MOV ED1L, A
MOV A, EEPROM_DATA1_H
MOV ED1H, A
MOV A, EEPROM_DATA2_L
MOV ED2L, A
MOV A, EEPROM_DATA2_H
MOV ED2H, A
MOV A, EEPROM_DATA3_L
MOV ED3L, A
MOV A, EEPROM_DATA3_H
MOV ED3H, A
MOV A, 00H ; Write time=2ms (40H for 4ms, 80H for 8ms, C0H for 16ms)
MOV ECR, A
CLR EMI
SET EWREN ; set EWREN bit, enable write operation
SET EWR ; start Write Cycle – set EWR bit – executed immediately
; after set EWREN bit
SET EMI
BACK:
SZ EWR ; check for write cycle end
JMP BACK
: