
C8051F310/1/2/3/4/5/6/7
110
Rev. 1.6
10.1.3. Flash Write Procedure
Flash bytes are programmed by software with the following sequence:
Step 1. Disable interrupts (recommended).
Step 2. Erase the 512-byte Flash page containing the target location, as described in Section
10.1.2.
Step 3. Set the PSWE bit (register PSCTL).
Step 4. Clear the PSEE bit (register PSCTL).
Step 5. Write the first key code to FLKEY: 0xA5.
Step 6. Write the second key code to FLKEY: 0xF1.
Step 7. Using the MOVX instruction, write a single data byte to the desired location within the
512 byte sector.
Steps 5–7 must be repeated for each byte to be written. After Flash writes are complete, PSWE should be
cleared so that MOVX instructions do not target program memory.
10.2. Non-volatile Data Storage
The Flash memory can be used for non-volatile data storage as well as program code. This allows data
such as calibration coefficients to be calculated and stored at run time. Data is written using the MOVX
write instruction and read using the MOVC instruction. Note: MOVX read instructions always target XRAM.
Table 10.1. Flash Electrical Characteristics
VDD = 2.7 to 3.6 V; –40 to +85 °C unless otherwise specified.
Parameter
Conditions
Min
Typ
Max
Units
Flash Size
C8051F310/1/6/7
16384*
—
—
bytes
C8051F312/3/4/5
8192
—
—
Endurance
20 k
100 k
—
Erase/Write
Erase Cycle Time
25 MHz System Clock
10
15
20
ms
Write Cycle Time
25 MHz System Clock
40
55
70
µs
*Note: 512 bytes at locations 0x3E00 (C8051F310/1) are reserved.