EMBEDDED FLASH MEMORY INTERFACE S3F80P5_UM_ REV1.00
PROGRAMMING TIP — Programming
Case1. 1-byte programming
WR_BYTE: ; Write data “AAH” to destination address 4010H
SB1
LD FMUSR,#0A5H ; User program mode enable
LD FMCON,#01010000B ; Selection programming mode
LD FMSECH, #40H ; Set the base address of sector (4000H)
LD FMSECL, #00H
LD R9,#0AAH ; Load data “AA” to write
LD R10,#40H ; Load flash memory upper address into upper register of pair working
; register
LD R11,#10H ; Load flash memory lower address into lower register of pair working
; register
LDC @RR10,R9 ; Write data 'AAH' at flash memory location (4010H)
LD FMUSR,#00H ; User program mode disable
SB0
Case2. Programming in the same sector
WR_INSECTOR: ; RR10-->Address copy (R10 –high address,R11-low address)
LD R0,#40H
SB1
LD FMUSR,#0A5H ; User program mode enable
LD FMCON,#01010000B ; Selection programming mode and Start programming
LD FMSECH,#40H ; Set the base address of sector located in target address to write data
LD FMSECL,#00H ; The sector 128’s base address is 4000H.
LD R9,#33H ; Load data “33H” to write
LD R10,#40H ; Load flash memory upper address into upper register of pair working
; register
LD R11,#40H ; Load flash memory lower address into lower register of pair working
; register
WR_BYTE:
LDC @RR10,R9 ; Write data '33H' at flash memory location
INC R11 ; Reset address in the same sector by INC instruction
DJNZ R0,WR_BYTE ; Check whether the end address for programming reach 407FH or not.
LD FMUSR,#00H ; User Program mode disable
SB0
14-14