Moderadores: 51, guest2003, brasilma
#include <avr/boot.h>
/* page buffer ---------------------------------------------------- */
uint8_t pagebuffer[SPM_PAGESIZE];
/* address buffer */
uint16_t address;
/* access to flash memory------------------------------------------ */
void write_flash_page()
{
uint16_t i = 0;
eeprom_busy_wait ();
boot_page_erase (address);
boot_spm_busy_wait (); // Wait until the memory is erased.
for (i=0; i<SPM_PAGESIZE; i+=2)
{
// Set up little-endian word.
uint16_t w = *((uint16_t*)(pagebuffer + i));
boot_page_fill (address + i, w);
}
boot_page_write(address); // Store buffer in flash page.
boot_spm_busy_wait(); // Wait until the memory is written.
boot_rww_enable ();
}
como faço para usar a FLASH como EEPROM nos AVRs ?
Usuários navegando neste fórum: Nenhum usuário registrado e 1 visitante