WRITE_PROGRAM_MEMORY( )
--------------------------------------------------------------------------------
Syntax:
write_program_memory( address, dataptr, count );
Parameters:
address is 16 bits on PCM parts and 32 bits on PCH parts.
dataptr is a pointer to one or more bytes count is a 8 bit integer
Returns:
undefined
Function:
Writes count bytes to program memory from dataptr to address. This function is most effective when count is a multiple of FLASH_WRITE_SIZE. Whenever this function is about to write to a location that is a multiple of FLASH_ERASE_SIZE then an erase is performed on the whole block.
Availability:
Only devices that allow writes to program memory.
Requires:
Nothing
Examples:
for(i=0x1000;i<=0x1fff;i++) {
value=read_adc();
write_program_memory(i, value, 2); delay_ms(1000);
}
Example Files:
loader.c
Also See:
write_program_eeprom, erase_program_eeprom
Additional Notes:
Clarification about the functions to write to program memory:
For chips where
getenv(“FLASH_ERASE_SIZE”) > getenv(“FLASH_WRITE_SIZE”)
WRITE_PROGRAM_EEPROM
Writes 2 bytes, does not erase (use ERASE_PROGRAM_EEPROM)
WRITE_PROGRAM_MEMORY
Writes any number of bytes, will erase a block whenever the first (lowest) byte in a block is written to. If the first address is not the start of a block that block is not erased.
ERASE_PROGRAM_EEPROM
Will erase a block. The lowest address bits are not used.
For chips where
getenv(“FLASH_ERASE_SIZE”) = (“FLASH_WRITE_SIZE”)
WRITE_PROGRAM_EEPROM
Writes 2 bytes, no erase is needed.
WRITE_PROGRAM_MEMORY
Writes any number of bytes, bytes outside the range of the write block are not changed. No erase is needed.
ERASE_PROGRAM_EEPROM
Not available
Ya ves, el ejemplo es loader.c
Espero te sirva Reiner...