English
Language : 

Z8F1601 Datasheet, PDF (160/246 Pages) Zilog, Inc. – Z8 Encore Microcontrollers with Flash Memory and 10-Bit A/D Converter
Z8F640x/Z8F480x/Z8F320x/Z8F240x/Z8F160x
Z8 Encore!®
142
Flash Code Protection Using the Option Bits
The FHSWP and FWP Option Bits combine to provide three levels of Flash Program Mem-
ory protection as listed in Table 84. Refer to the Option Bits chapter for more informa-
tion.
Table 84. Flash Code Protection Using the Option Bits
FHSWP
0
1
0 or 1
FWP Flash Code Protection Description
0 Programming and erasure disabled for all of Flash Program Memory. In
user code programming, Page Erase, and Mass Erase are all disabled. Mass
Erase is available through the On-Chip Debugger.
0 Programming and Page Erase are enabled for the High Sector of the Flash
Program Memory only. The High Sector on the Z8F640x family device
contains 1KB to 4KB of Flash with addresses at the top of the available
Flash memory. Programming and Page Erase are disabled for the other
portions of the Flash Program Memory. Mass erase through user code is
disabled. Mass Erase is available through the On-Chip Debugger.
1 Programming, Page Erase, and Mass Erase are enabled for all of Flash
Program Memory.
Flash Code Protection Using the Flash Controller
At Reset, the Flash Controller locks to prevent accidental program or erasure of the Flash
memory. To program or erase the Flash memory, unlock the Flash Controller by making
two consecutive writes to the Flash Control register with the values 73H and 8CH, sequen-
tially. After unlocking the Flash Controller, the Flash can be programmed or erased. When
the Flash Controller is unlocked, any value written to the Flash Control register locks the
Flash Controller. Writing the Mass Erase or Page Erase commands executes the function
before locking the Flash Controller.
Byte Programming
When the Flash Controller is unlocked, all writes to Program Memory program a byte into
the Flash. An erased Flash byte contains all 1’s (FFH). The programming operation can
only be used to change bits from 1 to 0. To change a Flash bit (or multiple bits) from 0 to 1
requires execution of either the Page Erase or Mass Erase commands.
Byte Programming can be accomplished using the On-Chip Debugger's Write Memory
command or eZ8 CPU execution of the LDC or LDCI instructions. Refer to the eZ8 CPU
User Manual for a description of the LDC and LDCI instructions. While the Flash Con-
troller programs the Flash memory, the eZ8 CPU idles but the system clock and on-chip
peripherals continue to operate. To exit programming mode and lock the Flash, write any
value to the Flash Control register, except the Mass Erase or Page Erase commands.
PS017610-0404
Flash Memory