AN1827 Freescale Semiconductor / Motorola, AN1827 Datasheet - Page 51

no-image

AN1827

Manufacturer Part Number
AN1827
Description
Programming and Erasing FLASH Memory on the MC68HC908AS60
Manufacturer
Freescale Semiconductor / Motorola
Datasheet
/*
/* Routine Size (Bytes):
/* Stack Space Used (Bytes): 12
/* RAM Used (Bytes):
/* Global Variables Used:
/* Subroutine(s) Called:
/*
/* Full Functional Description Of Routine Design:
/*
/*
/*
/*
/*
/*
/**********************************************************************************/
/**********************************************************************************/
/*****
/**********************************************************************************/
#include <as60_flash_frk.c>
#include <prog_er_var.c>
/**********************************************************************************/
/*****
/**********************************************************************************/
extern void
extern unsigned char
/**********************************************************************************/
/*****
/**********************************************************************************/
/* This routine initializes the 908AS60 before calling the programming
/* routine, Prog8Bytes. If a user plans to incorporate Prog8Bytes into
/* his/her program, make sure the FLASH control registers, FLASH_addr
/* and data buffer are initialized before calling Prog8Bytes.
/* After the initialization, Prog8Bytes is called to program 8 data
/* bytes, or one page of FLASH memory. If programming was successful,
/* then the program will jump to the while(1) statement in the "if"
/* expression. If programming failed, then the program will remain at
/* the while(1) statement in the "else" expression.
/**********************************************************************************/
void main ()
{
AN1827
MOTOROLA
MC68HC908AS60. One page consists of eight consecutive bytes of
FLASH memory starting at either address $xxx0 or $xxx8.
Prog_mrt.c is the main routine for the programming operation. It
demonstrates a smart programming algorithm that minimizes the
amount of time needed to program a page of 2TS FLASH memory on the
unsigned char
unsigned char
CONFIG1 = 0x71;
FLCR1 = 0x00;
FLCR2 = 0x00;
writeFLCR
Prog8Bytes
count;
pgmsuccess;
Freescale Semiconductor, Inc.
For More Information On This Product,
Program/Margin Read Main Routine
368
11
FLASH_addr, data, attempt
Prog8Bytes
Go to: www.freescale.com
Function Definitions
Include Files
/* Equates for the registers and bits */
/*
/* RAM variable definitions
(unsigned char);
(void);
/* Variable to count down bits
/* Return value from Prog8Bytes
/*Turn off the COP, but leave the
/*
/*Set up the frequency divide
/*
/* the appropriate charge pump
/*
LVI on
control bits in flcr1 & 2 for
clock
of the HC908AS60 that are used
Application Note
C Source Code
*****/
*****/
*****/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
51

Related parts for AN1827