AN1827 Freescale Semiconductor / Motorola, AN1827 Datasheet - Page 59

no-image

AN1827

Manufacturer Part Number
AN1827
Description
Programming and Erasing FLASH Memory on the MC68HC908AS60
Manufacturer
Freescale Semiconductor / Motorola
Datasheet
} while ((status!=8) && (attempt<flsPULSES));
Prog990:
}
/**********************************************************************************/
/****
/**********************************************************************************/
/* This routine determines whether flcr1 or flcr2 should be written to
/* based on the FLASH address specified by FLASH_addr.
/*
/* Initializations required:
/*
/* Values returned:
/*
/**********************************************************************************/
void writeFLCR (unsigned char A)
{
FLCR990:
AN1827
MOTOROLA
EnableInterrupts;
return (8-status);
None
if (FLASH_addr >= &FLASH1)
else
return;
set FLASH_addr
for (byte=0; byte<8; byte++)
if (status != 8) {
if (status == 8)
FLCR1 = FLCR1 ^ A;
FLCR2 = FLCR2 ^ A;
if (*(FLASH_addr+byte) == data[byte]) status++;
writeFLCR (MARGIN);
attempt++;
writeFLCR (MARGIN);
Write to a FLASH Control Register
Freescale Semiconductor, Inc.
}
For More Information On This Product,
Go to: www.freescale.com
/* -- Program Success --
/* Step 13 and 14 - Check to see if
/*
/*
/*
/*
/*
/* -- Program Failure --
/* Step 15 - Clear the MARGIN bit
/* Step 16 - Increment attempt
/* counter
/* Clear the MARGIN bit
/* Step 17 - If attempt is less than
/*
/* Clear the interrupt mask bit
/* If programming was unsuccessful in */
/*
/*
/* FLASH-1=$8000, FLASH-2=$0450
/*If FLASH_addr is in FLASH-1 array
/* write to FLCR1 Register
/* else write to FLCR2 Register
proceed with the bracketed
flsPULSES, go back to step 2
in the FLASH page. If not,
if statement.
returned
the correct data was programmed
expressions. If so, skip to next */
flsPULSES, a non-zero value is
Application Note
C Source Code
*****/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
59

Related parts for AN1827