English
Language : 

Z8F0113HJ005EG Datasheet, PDF (153/245 Pages) Zilog, Inc. – High-Performance 8-Bit Microcontrollers
Z8 Encore! XP® F0823 Series
Product Specification
138
.
Table 80. Flash Code Protection Using the Flash Option Bits
FWP
0
1
Flash Code Protection Description
Programming and erasing disabled for all of Flash Program Memory. In user code program-
ming, Page Erase, and Mass Erase are all disabled. Mass Erase is available through the On-
Chip Debugger.
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, first write the Page Select Register with
the target page. Unlock the Flash Controller by making two consecutive writes to the
Flash Control Register with the values 73H and 8CH, sequentially. The Page Select Regis-
ter must be rewritten with the same page previously stored there. If the two Page Select
writes do not match, the controller reverts to a locked state. If the two writes match, the
selected page becomes active. For more details, see Figure 21.
After unlocking a specific page, you can enable either Page Program or Erase. Writing the
value 95H causes a Page Erase only if the active page resides in a sector that is not pro-
tected. Any other value written to the Flash Control Register locks the Flash Controller.
Mass Erase is not allowed in the user code but only in through the Debug Port.
After unlocking a specific page, you can also write to any byte on that page. After a byte is
written, the page remains unlocked, allowing for subsequent writes to other bytes on the
same page. Further writes to the Flash Control Register cause the active page to revert to a
locked state.
Sector-Based Flash Protection
The final protection mechanism is implemented on a per-sector basis. The Flash memories
of Z8 Encore! XP devices are divided into maximum number of 8 sectors. A sector is 1/8
of the total Flash memory size unless this value is smaller than the page size – in which
case, the sector and page sizes are equal. On Z8 Encore! F0823 Series devices, the sector
size is varied according to the Flash memory configuration shown in Table 79 on page
134.
The Flash Sector Protect Register can be configured to prevent sectors from being pro-
grammed or erased. After a sector is protected, it cannot be unprotected by user code. The
Flash Sector Protect Register is cleared after reset, and any previously-written protection
values are lost. User code must write this register in their initialization routine if they pre-
fer to enable sector protection.
The Flash Sector Protect Register shares its Register File address with the Page Select
Register. The Flash Sector Protect Register is accessed by writing the Flash Control Regis-
ter with 5EH. After the Flash Sector Protect Register is selected, it can be accessed at the
Page Select Register address. When user code writes the Flash Sector Protect Register,
PS024315-1011
PRELIMINARY
Operation