![](https://pdfstore-manualsonline.prod.a.ki/pdfasset/4/44/44414c02-d064-4424-ae12-8acc58561d02/44414c02-d064-4424-ae12-8acc58561d02-bg69.png)
iVIEW-100 Series user’s Manual, 2006, v2.0 ----- 105
7.8 How to use Flash memory
The iVIEW-100 series module has 512K Flash of memory. It contains the
MiniOS7 and the ROM-DISK. MiniOS7 occupies segment 0xF000 (the last
segment). The ROM-DISK occupies the first segment, such as 0x8000 for 512K
memories. So iVIEW-100 will occupy at least two segments. The user can use
non-used segments to store data. With 512K memory, there is a maximum 384K
of memory left to store data.
Flash memory can be written from 1 to 0 only and can’t be written from 0 to 1.
The only way to change the data bit from 0 to 1 is to call “EraseFlash“ to erase a
block of Flash Memory (64K bytes). The user should decide whether to write or
to erase it.
For example: The current value is 0x55, and you want to write to 0x57. The
original data bit is 0, and want to write it to 1. That means write bit 1 from 0 to 1.
If the user wants to write an integer to flash memory on segment 0xD000, offset
0x1234, the code can be as follows.
int data=0xAA55, data2;
char *dataptr;
int *dataptr2;
dataptr=(char *)&data;
FlashWrite(0xd000,0x1234,*dataptr++);
FlashWrite(0xd000,0x1235,*dataptr);
/* read data from Flash memory method 1 */
dataptr=(char *)&data2;
*dataptr=FlashRead(0xd000,0x1234);
*(dataptr+1)=FlashRead(0xd000,0x1235);
/* read data from Flash memory method 2 */
dataptr2=(int far *)_MK_FP(0xd000,0x1234);
data2=*dataptr2;
/* or just write */
data2=*(int far *)_MK_FP(0xd000,0x1234);
Reading data from Flash Memory is somewhat like reading data from SRAM.
The user should make a far pointer point to the memory location first, and then
use the pointer to access the memory. Before writing data to Flash Memory, the
user must call “FlashWrite” first. Then check if the data can be written to it or not.
After calling “EraseFlash”, any data can be written to that segment.