AN2156 Freescale Semiconductor / Motorola, AN2156 Datasheet - Page 74

no-image

AN2156

Manufacturer Part Number
AN2156
Description
Programming and Erasing FLASH and EEPROM Memories on the MC68HC908AS60A/AZ60A
Manufacturer
Freescale Semiconductor / Motorola
Datasheet
Application Note
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
* Full Functional Description Of Subroutine:
*
*
*
*
*
*
*
*
*
***************************************************************************
***************************************************************************
*****
***************************************************************************
EEPROMroutine:
74
Number of Exit Points:
;-----------------------------------------------------------------;
; Delay Time Evaluation
;
;
;
;-----------------------------------------------------------------;
;-----------------------------------------------------------------;
; Delay Time tEEBYTE/tEEBULK/tEEBLOCK/tEEPGM Evaluation
; between points S1 and E1)
;
;-----------------------------------------------------------------;
; Delay Evaluation: Point S1
;
Exit Label:
Exit Conditions:
Initialize Port D bit 3 as output high
EEPROM.srt consists of three subroutines:
WriteEECR and ms_delay. EEPROMroutine demonstrates EEPROM erasing *
and programming. WriteEECR allows the user to set and clear bits
in the EExCR registers. Since delay times must be met precisely
for successful EEPROM programming and erasing, additional
software was added to measure the delay times. This code is
included as comments throughout the file. It is recommended that
the user verify all delay times before using this software for
production.
bset
bset
sei
jsr
lda
ldhx
sta
lda
jsr
Measure low level period on Port D bit 3 pin using a scope
bclr
lda
3,PTD
3,DDRD
WriteEECR
data
EEPROM_addr
,X
#eepgm.
WriteEECR
3,PTD
#!10
EEPROM Program and Erase Subroutine
Freescale Semiconductor, Inc.
For More Information On This Product,
;Set Port D bit 3
;Select output for Port D bit 3
;Disable interrupts
;Step 1 - Set up EERAS0, EERAS1 for a
; desired operation and set EELAT
;Step 2 - Write the desired data to
; the appropriate EEPROM location
;Step 3 - Set EEPGM bit
;Clear Port D bit 3
;Step 4 - Wait for time
WriteEECR
ms_delay
EEPROMroutine
WriteEECR
ms_delay
EEPROMroutine
WriteEECR
ms_delay
Go to: www.freescale.com
3
2 bytes address defined at *
EECR (EEPROM Control
Delay valiable passed in
erasing operation is not
required)
EEPROM_addr
Register) bit definition
passed in accumulator
times
EEPROMroutine_End
WriteEECR_End
ms_delay
None
None
None
EEPROMroutine,
(Time
*****
;
;
;
;
;
;
;
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
MOTOROLA
AN2156

Related parts for AN2156