Simple Data Flash
This example shows how to simply implement erasing and writing to a data flash block on the R8C/13 device. This example uses block A as the area that is erased and written to. This code with some modifications will work other Renesas MCUs provided the flash commands are properly verified. This example uses EW1 mode which does not require the device to load code into RAM to perform flash operations. Rather, it places the device into suspend mode untit the flash operation is complete. This example has 2 functions, eraseblock and writeblock. Eraseblock places the device into EW1 mode, sets a pointer to the beginning of the data flash to erase, and then executes an erase of that block. Writeblock places the device into EW1 mode, sets a pointer to the beginning of the data flash to write to, and then begins writing the data contained in the array to the data flash.

