English
Language : 

Z8F042AHJ020SG Datasheet, PDF (168/282 Pages) Zilog, Inc. – High-Performance 8-Bit Microcontrollers
Z8 Encore! XP® F082A Series
Product Specification
151
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,
bits can only be set to 1. Thus, sectors can be protected, but not unprotected, via register
write operations. Writing a value other than 5EH to the Flash Control Register deselects
the Flash Sector Protect Register and reenables access to the Page Select Register.
Observe the following procedure to setup the Flash Sector Protect Register from user
code:
1. Write 00H to the Flash Control Register to reset the Flash Controller.
2. Write 5EH to the Flash Control Register to select the Flash Sector Protect Register.
3. Read and/or write the Flash Sector Protect Register which is now at Register File
address FF9H.
4. Write 00H to the Flash Control Register to return the Flash Controller to its reset state.
The Sector Protect Register is initialized to 0 on reset, putting each sector into an unpro-
tected state. When a bit in the Sector Protect Register is written to 1, the corresponding
sector is no longer written or erased by the CPU. External Flash programming through the
OCD or via the Flash Controller Bypass mode are unaffected. After a bit of the Sector Pro-
tect Register has been set, it cannot be cleared except by powering down the device.
Byte Programming
Flash Memory is enabled for byte programming after unlocking the Flash Controller and
successfully enabling either Mass Erase or Page Erase. When the Flash Controller is
unlocked and Mass Erase is successfully completed, all Program Memory locations are
available for byte programming. In contrast, when the Flash Controller is unlocked and
Page Erase is successfully completed, only the locations of the selected page are available
for byte programming. 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
Core User Manual (UM0128), available for download on www.zilog.com, for a descrip-
tion of the LDC and LDCI instructions. While the Flash Controller programs the Flash
memory, the eZ8 CPU idles but the system clock and on-chip peripherals continue to oper-
ate. To exit programming mode and lock the Flash, write any value to the Flash Control
Register, except the Mass Erase or Page Erase commands.
PS022827-1212
PRELIMINARY
Operation