AN1827 Freescale Semiconductor / Motorola, AN1827 Datasheet - Page 43

no-image

AN1827

Manufacturer Part Number
AN1827
Description
Programming and Erasing FLASH Memory on the MC68HC908AS60
Manufacturer
Freescale Semiconductor / Motorola
Datasheet
tVTP:
flsPULSES:
************************************************************************************
*****
************************************************************************************
* This routine erases a block of FLASH of the size specified in the FLASH
* Control Registers and at the location specified by FLASH_addr.
* FLASH_addr is any address within the block to be erased. The routine
* follows the basic 9 step sequence of the FLASH erase operation.
*
* Initializations required:
*
*
* Values returned:
*
************************************************************************************
EraseRoutine:
Again:
AN1827
MOTOROLA
Set charge pump clock and block erase size in FLCR1 and FLCR2;
FLASH_addr set
none
sei
ldhx
lda
jsr
lda
lda
sta
lda
jsr
lda
pshx
ldx
jsr
dbnzx
pulx
lda
jsr
lda
jsr
equ
equ
FLASH_addr
#erase.
WriteFLCR
flbpr1
flbpr2
,X
#hven.
WriteFLCR
#terase
#$14
Delay
Again
#hven.
WriteFLCR
#tkill
Delay
Freescale Semiconductor, Inc.
Erase a Block of FLASH Memory Subroutine
For More Information On This Product,
$08
$64
Go to: www.freescale.com
; time (~66
;FLASH 2TS MARGIN high to PGM low
; time (~168
;FLASH 2TS maximum page program pulses
; (100 pulses)
;Disable interrupts
;Load the starting address of the block
; to be erased
;Step 1 - Set the ERASE bit
;Step 2 - Read from block protect
; registers
;Step 3 - Write to any FLASH address
; within the block address range to be
; erased with any data value
;(indexed, 16 bit offset=H:X+$00)
;Step 4 - Set the HVEN bit
;Step 5 - Wait for time tERASE
;Step 6 - Clear the HVEN bit
;Step 7 - Wait for time tKILL
s)
s)
Assembly Source Code
Application Note
*****
43
*
*
*
*
*
*
*
*
*
*

Related parts for AN1827