MS51
Nov. 28, 2019
Page
262
of 491
Rev 1.00
MS51
32K
SE
RIES
TE
CHNICAL RE
F
EREN
CE MA
N
UAL
CALL Enable_AP_Update
CALL Erase_AP
;erase AP data
CALL Program_AP
;programming AP data
CALL Disable_AP_Update
CALL Program_AP_Verify
;verify Programmed AP data
CALL Read_CONFIG
;read back CONFIG2
CALL Enable_CONFIG_Update
CALL Erase_CONFIG
;erase CONFIG bytes
CALL Program_CONFIG
;programming CONFIG2 with new data
CALL Disable_CONFIG_Update
CALL Program_CONFIG_Verify
;verify Programmed CONFIG2
CALL Disable_IAP
MOV
TA,#0Aah
;TA protection
MOV
TA,#55h
;
ANL
CHPCON,#11111101b
;BS = 0, reset to APROM
MOV
TA,#0Aah
MOV
TA,#55h
ORL
CHPCON,#80h
;software reset and reboot from APROM
SJMP $
;********************************************************************
;
IAP Subroutine
;********************************************************************
Enable_IAP:
MOV
TA,#0Aah
;CHPCON is TA protected
MOV
TA,#55h
ORL
CHPCON,#00000001b
;IAPEN = 1, enable IAP mode
RET
Disable_IAP:
MOV
TA,#0Aah
MOV
TA,#55h
ANL
CHPCON,#11111110b
;IAPEN = 0, disable IAP mode
RET
Enable_AP_Update:
MOV
TA,#0Aah
;IAPUEN is TA protected
MOV
TA,#55h
ORL
IAPUEN,#00000001b
;APUEN = 1, enable APROM update
RET
Disable_AP_Update:
MOV
TA,#0Aah
MOV
TA,#55h
ANL
IAPUEN,#11111110b
;APUEN = 0, disable APROM update
RET
Enable_CONFIG_Update:
MOV
TA,#0Aah