AN1827 Freescale Semiconductor / Motorola, AN1827 Datasheet - Page 47

no-image

AN1827

Manufacturer Part Number
AN1827
Description
Programming and Erasing FLASH Memory on the MC68HC908AS60
Manufacturer
Freescale Semiconductor / Motorola
Datasheet
************************************************************************************
*****
************************************************************************************
* This routine determines whether flcr1 or flcr2 should be written to
* based on the FLASH address specified by FLASH_addr.
*
*
* Initializations required:
*
*
* Values returned:
*
************************************************************************************
WriteFLCR:
Array1:
FLCR990:
************************************************************************************
*****
************************************************************************************
* This routine delays for a variable amount of time depending on the value
* passed into the routine by the accumulator (A).
* Delay = (2 + (2 + 45 + 3) * A + 2 + 4) / Bus Freq
*
* Initializations required:
*
* Values returned:
*
************************************************************************************
Delay:
Loop:
Delay990:
AN1827
MOTOROLA
H:X = FLASH_addr
None
cphx
bhs
eor
sta
bra
eor
sta
rts
A = delay variable
None
pshx
ldx
dbnzx
dbnza
pulx
rts
#flash-1
Array1
flcr2
flcr2
FLCR990
flcr1
flcr1
#$0F
*
Loop
Freescale Semiconductor, Inc.
For More Information On This Product,
Write to a FLASH Control Register
Go to: www.freescale.com
Delay Routine
;If FLASH_addr is in FLASH-1 array,
; jump to Array1
;Write to flcr2 register
;Write to flcr1 register
;2 cyc., Store the lower address of
; FLASH_addr on the stack
;2 cyc., Initialize X for inner loop
;3 cyc., 15 * 3 = 45 cycles
;3 cyc., Decrement value passed in by
; accumulator and repeat if necessary
;2 cyc., Restore the lower address
;4 cyc., Return
Assembly Source Code
Application Note
*****
*****
47
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*

Related parts for AN1827