AN2183 Freescale Semiconductor / Motorola, AN2183 Datasheet - Page 28

no-image

AN2183

Manufacturer Part Number
AN2183
Description
Using FLASH as EEPROM on the MC68HC908GP32
Manufacturer
Freescale Semiconductor / Motorola
Datasheet
Application Note
RamWriteEE:
;
;
;
;
;
;
;
;
RamWriteDST1:
;
;
;
;
;
;
;
;
RamWriteEE1:
;
;
;
;
RamWriteSRC:
;
;
;
;
RamWriteDST2:
;
;
;
;
RamWriteEE2:
28
Step 1:
Set PGM, read the Flash Block Protect Register and write any data to first Flash address.
"RamWriteDST1" is location offset relative to "RamWriteEE".
This RAM location is used as a 16-bit destination address pointer.
Step 2:
Wait for >10us, then set HVEN, then wait for >5us.
Step 3:
Write data to Flash and wait for 30 - 40us.
"RamWriteSRC" is location offset relative to "RamWriteEE".
This RAM location is used as a 16-bit source address pointer.
"RamWriteDST2" is location offset relative to "RamWriteEE".
This RAM location is used as a 16-bit destination address pointer.
Advance source and destination pointers.
This sequence requires between 14 to 22 cycles.
psha
lda
sta
lda
sta
lda
dbnza
lda
sta
lda
dbnza
lda
sta
inc
bne
inc
inc
bne
inc
#{PGM}
flcr
flbpr
equ
$FFFF
#RamDelay10
*
#{PGM | HVEN}
flcr
#RamDelay5
*
equ
$FFFF
equ
$FFFF
{RamWriteDST2+1},x
RamWriteEE2
RamWriteDST2,x
{RamWriteSRC+1},x
RamWriteEE3
RamWriteSRC,x
{*-RamWriteEE+1}
{*-RamWriteEE+1}
{*-RamWriteEE+1}
Freescale Semiconductor, Inc.
For More Information On This Product,
Go to: www.freescale.com
; save previous CCR on stack
; set PGM control bit
;
; read from Flash Block Protect Register
; write any data to first Flash address
; wait
;
; set HVEN control bit
;
; wait
;
; get data
; write data to Flash
; advance the destination address lsb
; skip if no overflow
; else, advance the destination address msb
; advance the source address lsb
; skip if no overflow
; else, advance the source address msb
in Flash Control Register
for 10us
in Flash Control Register
for 5us
Repeat until done.
MOTOROLA
AN2183

Related parts for AN2183