AN2156 Freescale Semiconductor / Motorola, AN2156 Datasheet - Page 83

no-image

AN2156

Manufacturer Part Number
AN2156
Description
Programming and Erasing FLASH and EEPROM Memories on the MC68HC908AS60A/AZ60A
Manufacturer
Freescale Semiconductor / Motorola
Datasheet
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
* Full Functional Description Of Subroutine:
*
*
*
***************************************************************************
***************************************************************************
*****
***************************************************************************
AutoRoutine:
Clear_EEPGM1:
Clear_EEPGM2:
AutoRoutine_End:
AN2156
MOTOROLA
Entry Label:
Entry Conditions:
Number of Exit Points:
Exit Label:
Exit Conditions:
AutoEEPROM.srt contains one primary subroutine called AutoRoutine.*
This demonstrates EEPROM erasing and programming in the AUTO mode.*
The routine also calls another subroutine WriteEECR.
sei
jsr
lda
ldhx
sta
lda
jsr
lda
and
bne
lda
and
bne
lda
jsr
lda
sta
sta
cli
rts
WriteEECR
data
EEPROM_addr
,X
#eepgm.
WriteEECR
EE1CR
#$01
Clear_EEPGM1
EE2CR
#$01
Clear_EEPGM2
#eelat.
WriteEECR
#$00
EE1CR
EE2CR
EEPROM AUTO Program and Erase Subroutine
Freescale Semiconductor, Inc.
For More Information On This Product,
;Disable interrupts
;Step 1 - Set up EERAS0, EERAS1 for a
; desired operation, and set EELAT and
; AUTO
;Step 2 - For programming, copy one byte
; data from the RAM buffer to the
; appropriate EEPROM location
;Step 3 - Set EEPGM bit
;Step 4 - Wait until EEPGM bit is cleared
; Checks included for both EEPGM registers
; since the programmed byte could be in
; either array
;Step 5 - Clear EELAT bit
;Clear all bits in the EExCR
;Enable interrupts
AutoRoutine, WriteEECR
AutoRoutine
WriteEECR
AutoRoutine
WriteEECR
AutoRoutine
WriteEECR
Go to: www.freescale.com
2
2 bytes address defined at *
1 programming byte located *
2 bytes address defined at *
EECR (EEPROM Control
EEPROM_addr
at variable data (the
erasing operation is not
required)
EEPROM_addr
Register) bit definition
passed in accumulator
AutoRoutine_End
WriteEECR_End
None
None
EEPROM AUTO Mode Assembly Source Code
*****
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
Application Note
83

Related parts for AN2156