MC96FR116C
November, 2018 Rev.1.8
191
for (i=0; I < FLASH_PBUFF_SIZE; i++) {
pagerom[i] = 0x00;
}
// Step 5
FARL = (unsigned char) addr;
FARM = (unsigned char) (addr>>8);
// Step 8
FCR = 0x0B;
// Step 9 : It is optional because the CPU clock halts while in program or erase operation.
while(FESR>>7 == 0x00);
}
void
flash_page_
write(unsigned int addr, unsigned char *wdata)
{
int i;
unsigned char temp;
int addr_index;
// Step 1
FETCR = PGMTIME;
// Step 3
page_buffer_reset();
// Step 4
for (i=0; I < FLASH_PBUFF_SIZE; i++) {
pagerom[i] = wdata[i];
}
// Step 5
FARL = (unsigned char) addr;
FARM = (unsigned char) (addr>>8);
// Step 8
FCR = 0x0D;
// Step 9 : It is optional because the CPU clock halts while in program or erase operation.
while(FESR>>7 == 0x00);
}
void page_buffer_reset()
{
FCR = 0x00;
}