AN1827 Freescale Semiconductor / Motorola, AN1827 Datasheet - Page 29

no-image

AN1827

Manufacturer Part Number
AN1827
Description
Programming and Erasing FLASH Memory on the MC68HC908AS60
Manufacturer
Freescale Semiconductor / Motorola
Datasheet
Assembly Source Code
AN1827
MOTOROLA
NOTE:
Sample assembly source code for FLASH programming and erasing are
included in this section.
The routines Erase.mrt and Program.mrt are the respective main
routines for erasing and programming. Both disable the COP and
initialize the charge pump clocks. The main routines also set up the
parameters required by the subroutines such as FLASH_addr and the
size of the erase block or the data bytes to be programmed. Erase.mrt
can erase a 64-byte, 512-byte, 16-Kbyte, or a 32-Kbyte block of FLASH.
Program.mrt programs one page (eight bytes) of FLASH with the data
01, 02, 03, 04, 05, 06, 07, 08.
flowcharts for Erase.mrt and Program.mrt.
The subroutine EraseRoutine includes the erasing flowchart and is
called from Erase.mrt. It calls subroutine WriteFLCR to set or clear
various bits in the FLCR register and subroutine Delay to generate the
required delays between steps.
Prog8Bytes is the smart programming algorithm subroutine called
from Program.mrt. It also uses the WriteFLCR and Delay
subroutines. Note that Prog8Bytes can make multiple attempts (up to
the value set in fls
The flowcharts for EraseRoutine, Prog8Bytes, WriteFLCR and
Delay are
respectively.
V
FLASH block protect registers. When programming the FLASH block
protect registers, flip the switch such that high voltage is applied to IRQ.
DD
Freescale Semiconductor, Inc.
should be applied to IRQ at all times, except when programming the
For More Information On This Product,
Figure
Go to: www.freescale.com
Pulses
12,
Figure
) to program one page.
Figure 10
13,
Figure
and
14, and
Figure 11
Figure
Assembly Source Code
are the
15,
Application Note
29

Related parts for AN1827