196
MC96F8204
ABOV Semiconductor Co., Ltd.
15.1.10 Protection for Invalid Erase/Write
It should be taken care to the flash erase/write programming in code.
You must make preparations for invalid jump to the flash erase/write code by malfunction, noise, and power off.
NOTE)
For more information, please refer to the appendix
“Flash Protection for Invalid Erase/Write”.
1.
User ID check routine for the flash erase/write code.
ErWt_rtn:
---
MOV
FIDR,#10100101B ;ID Code
MOV
A,#ID_DATA_1 ;Ex) ID_DATA_1: 93H, ID_DATA_2: 85H, ID_DATA_3: 5AH
CJNE
A,UserID1,No_WriteErase
MOV
A,#ID_DATA_2
CJNE
A,UserID2,No_WriteErase
MOV
A,#ID_DATA_3
CJNE
A,UserID3,No_WriteErase
MOV
FMCR,#0x?? ;0x03 if write, 0x02 if erase
---
---
RET
No_WriteErase:
MOV
FIDR,#00H
MOV
UserID1,#00H
MOV
UserID2,#00H
MOV
UserID3,#00H
MOV
Flash_flag,#00H
RET
If code is like the above lines, an invalid flash erase/write can be avoided.
2.
It is important where the UserID1/2/3 is written. It will be remain the invalid flash erase/write problem if the
UserID1/2/3 is written at the above line of the instruction
“
MOV FIDR,#10100101B
”
. So. It had better writing
the UserID1/2/3 in another routine after return.
Decide_ErWt:
---
MOV
Flash_flag1,#38H ;Random value for example, in case of erase/write needs
MOV
FSADRL,#20H ;Here 20H is example,
MOV
Flash_flag2,#75H
RET
Содержание MC96F8104M
Страница 13: ...13 MC96F8204 ABOV Semiconductor Co Ltd 4 Package Diagram Figure 4 1 20 Pin SOP Package...
Страница 14: ...14 MC96F8204 ABOV Semiconductor Co Ltd Figure 4 2 20 Pin TSSOP Package...
Страница 15: ...15 MC96F8204 ABOV Semiconductor Co Ltd Figure 4 3 16 Pin SOPN Package...
Страница 16: ...16 MC96F8204 ABOV Semiconductor Co Ltd Figure 4 4 10 Pin SSOP Package...
Страница 17: ...17 MC96F8204 ABOV Semiconductor Co Ltd Figure 4 5 8 Pin SOP Package...