AN2504 Freescale Semiconductor / Motorola, AN2504 Datasheet - Page 16

no-image

AN2504

Manufacturer Part Number
AN2504
Description
On-Chip FLASH Programming API for CodeWarrior Software
Manufacturer
Freescale Semiconductor / Motorola
Datasheet
AN2504/D
16
On-Chip FLASH Programming API for CodeWarrior Software
/*
/*
/*
/*
/*
*/
/*
/*
/*
*/
* Receive one byte and echo it. This shows a typical usage
* of API functions GetByte and Transmit Byte.
* This functions can not be debugged with the In-Circuit
* Debugger (ICD) since the Communication Port is used by the ICD.
*/
* Erase a PAGE of flash named FLASH_TEST. Notice how Interrupts
* will be automatically disabled.
*/
* Program FLASH_TEST with the received Byte.
*/
* Verify that the programming was successful.
*/
* Read a section in FLASH named MY_INFO. In this section
* it is stored the message "Motorola". Notice how
* the DATA (RAM_START + 0x0C) will be replaced with FLASH data.
* Transmit a range of FLASH named MY_TRANSMISION. In this
* sections it's stored the message "TransmitRange was successful".
* Notice how the DATA (RAM_START + 0x0C) will NOT be replaced
* with the data transmitted.
*/
* Fill out manually 60 bytes of DATA (RAM_START + 0x0C).
*/
Freescale Semiconductor, Inc.
temp = ReadByte();
TransmitByte(temp);
DATA(0) = temp;
size = 1;
ProgramRange(&address, size);
temp = VerifyRange(&address, size); // Now temp will be set to
if (temp == SUCCESS) {
}
address = MY_INFO_ADDRESS;
size = MY_INFO_SIZE;
temp = ReadRange(&address, size);
address = MY_TRANSMISION_ADDRESS;
size = MY_TRANSMISION_SIZE;
temp = TransmitRange(&address, size);
for (i=0; i<64; i++) {
}
For More Information On This Product,
address = FLASH_TEST_ADDRESS;
EnableInterrupts;
ErasePage(&address);
temp = temp + 1;
DATA_STR(i) = 'm';
Go to: www.freescale.com
// this is a way of accessing DATA,
// however it is very space-consuming
// when it gets translated into assembly
// One byte is ready to be programmed
// SUCCESS or FAIL, and address
// will be set with the checksum
// the data verified
// Do anything wanted
// This is a way of filling out DATA
// but it is very space-consuming
// Next, another way to do it:
MOTOROLA

Related parts for AN2504