Samsung S3F80JB manual Programming TIP Sector Erase Case1. Erase one sector

Models: S3F80JB

1 346
Download 346 pages 34.13 Kb
Page 289
Image 289

EMBEDDED FLASH MEMORY INTERFACES3F80JB

PROGRAMMING TIP — Sector Erase

Case1. Erase one sector

 

 

 

 

 

 

ERASE_ONESECTOR:

SB1

 

 

 

 

 

 

LD

FMUSR,#0A5H

; User program mode enable

 

LD

FMSECH,#40H

; Set sector address 4000H,sector 128,

 

LD

FMSECL,#00H

; among sector 0~511

 

LD

FMCON,#10100001B

; Select erase mode enable & Start sector erase

ERASE_STOP:

LD

FMUSR,#00H

; User program mode disable

 

SB0

 

 

Case2.Erase flash memory space from Sector (n) to Sector (n + m)

;;Pre-define the number of sector to erase

 

 

LD

SecNumH,#00H

; Set sector number

 

LD

SecNumL,#128

; Selection the sector128 ( base address 4000H )

 

LD

R6,#01H

; Set the sector range (m) to erase

 

LD

R7,#7DH

; into High-byte(R6) and Low-byte(R7)

 

LD

R2,SecNumH

 

 

LD

R3,SecNumL

 

ERASE_LOOP:

CALL SECTOR_ERASE

 

 

XOR

P4,#11111111B

; Display ERASE_LOOP cycle

 

INCW

RR2

 

 

LD

SecNumH,R2

 

 

LD

SecNumL,R3

 

 

DECW RR6

 

 

LD

R8,R6

 

 

OR

R8,R7

 

 

CP

R8,#00H

 

 

JP

NZ,ERASE_LOOP

 

15-10

Page 289
Image 289
Samsung S3F80JB manual Programming TIP Sector Erase Case1. Erase one sector