( 36 / 54 )
4.4 How to Access Flash Memory Area
When flash memory is enabled (MAP setting for addresses E0000h to FFFDFh is "EXT" and CPU
rewrite mode select bit is "1"), you must invoke software commands to access flash memory area.
The following shows how to access the flash memory area using script commands, the dump window,
and the RAM monitor window.
(1) Using Script Commands
To execute Fill and Dump commands to the flash memory area, you need to issue software
commands. When flash memory is enabled, software commands can be used. You can use the
FillWord or setMemoryWord commands to write software command code to the user ROM area. In
the read array mode or the read status register mode, the DumpWord command allows you to read
values from flash memory or status register, respectively.
Example 1: To read values from flash memory
If you want to read a value from flash memory, you must first select the read array
mode. Use the FillWord or setMemoryWord command to write the read array
command (FFh) to the user ROM area. In the read array mode, the DumpWord
command allows you to read values from flash memory.
Example 2: To rewrite data to flash memory
If you want to rewrite data to flash memory, use the FillWord or setMemoryWord
command to write the program command (40h) to the user ROM area, then write the
data to the address to be programmed. Note that, because you are in the read status
register mode, to check that the data has been written, first invoke the read array
command, as in Example 1, then read the data.
If the data was not FFFFh prior to being programmed, the data after being programmed
may differ from the data that was written. The post-programming data is the AND
value of the pre-programming data and the data that was written.
Example 3: To block-erase flash memory
If you want to block-erase flash memory, use the FillWord or setMemoryWord
command to write 20h to the user ROM area, then write D0h to the address of the block
to be erased. Note that, because you are in read status register mode, to check that the
data has been erased, first invoke the read array command, as in Example 1, then read
the data.
(2) Using the Dump Window
When flash memory is enabled, the values of flash memory or status register are displayed in the read
array mode or the read status register mode, respectively. Take note that after writing to or erasing
flash memory, the values of the status register is displayed in the read status register mode.
If flash memory is enabled, software commands are valid and the procedure for invoking the software
commands can be performed in the dump window. If the FillWord or setMemoryWord command is
used from the dump window as in (1) above to perform a write operation, you can change the mode
of flash memory and program and erase flash memory via the dump window.
(3) Using the RAM Monitor Window
When flash memory is enabled, the values of flash memory or status register are displayed in the read
array mode or the read status register mode, respectively. (If you have changed mode, press the
"Clear" button to update the data display, which is not updated automatically when you change
modes.) See (1) and (2) above for details of how to select the read array mode and the read status
register mode.