AN1827 Freescale Semiconductor / Motorola, AN1827 Datasheet - Page 56

no-image

AN1827

Manufacturer Part Number
AN1827
Description
Programming and Erasing FLASH Memory on the MC68HC908AS60
Manufacturer
Freescale Semiconductor / Motorola
Datasheet
Application Note
/**********************************************************************************/
/**********************************************************************************/
/*****
/**********************************************************************************/
/* Each delay time related to FLASH 2TS program and erase operations is
/* calculated with bus speed 2.4576 MHz.
/**********************************************************************************/
#define tERASE
#define tKILL
#define tHVD
#define tSTEP
#define tHVTV
#define tVTP
#define flsPULSES 0x64
/**********************************************************************************/
/*****
/**********************************************************************************/
#define EnableInterrupts
#define DisableInterrupts
/**********************************************************************************/
/*****
/**********************************************************************************/
void
unsigned char
void
void
/**********************************************************************************/
/****
/**********************************************************************************/
/* 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:
/*
/**********************************************************************************/
void EraseRoutine ()
{
56
Set charge pump clock and block erase size in FLCR1 and FLCR2;
FLASH_addr set
none
unsigned char Blk_Protect1;
unsigned char Blk_Protect2;
unsigned char loop;
0xF0
0x0A
0x02
0x32
0x02
0x07
Necessary Assembly-Level Commands Defines
EraseRoutine
Prog8Bytes
writeFLCR
Delay
Freescale Semiconductor, Inc.
Erase a Block of FLASH Memory Subroutine
For More Information On This Product,
{asm CLI;}
{asm SEI;}
Go to: www.freescale.com
FLASH Delay Equates
Function Initializations
/* FLASH 2TS block/bulk erase time
/* FLASH 2TS high-voltage kill time
/* FLASH 2TS return to read time
/* FLASH 2TS page program step size
/* FLASH 2TS HVEN low to MARGIN high
/* FLASH 2TS MARGIN high to PGM low
/* FLASH 2TS maximum page program
(void);
(void);
(unsigned char);
(unsigned char);
/* set up local variables
/*
/*
/*
/*
/*
/*
/*
pulses (100 pulses)
(~51 s)
(~1 ms)
(~101 ms)
(~210 s)
time (~51 s)
time (~151 s)
MOTOROLA
AN1827
*****/
*****/
*****/
*****/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/

Related parts for AN1827