DATASHEET SEARCH SITE | WWW.ALLDATASHEET.COM
Document overview
- Manufacturer or author: Provided By ALLDATASHEET.COM(FREE DATASHEET DOWNLOAD SITE)
- PDF pages: 257
Technical content
Copyright ©2012 Zilog®, Inc. All rights reserved. www.zilog.com PS025113-1212 Product Specification High-Performance 8-Bit Microcontrollers Z8 Encore!® F0830 Series
Z8 Encore!® F0830 Series Product Specification ii DO NOT USE THIS PRODUCT IN LIFE SUPPORT SYSTEMS. LIFE SUPPORT POLICY ZILOG’S PRODUCTS ARE NOT AUTHORIZED FOR USE AS CRITICAL COMPONENTS IN LIFE SUPPORT DEVICES OR SYSTEMS WITHOUT THE EXPRESS PRIOR WRITTEN APPROV AL OF THE PRESIDENT AND GENERAL COUNSEL OF ZILOG CORPORATION. As used herein Life support devices or systems are devices which (a) are intended for surgical implant into the body or (b) support or sustain life and whose failure to perform when properly used in accordance with instructions for use provided in the labeling can be reasonably expected to result in a significant injury to the user. A criti- cal component is any component in a life support device or system whose failure to perform can be reason- ably expected to cause the failure of the life support device or system or to affect its safety or effectiveness. Document Disclaimer ©2012 Zilog, Inc. All rights reserved. Information in this publication concerning the devices, applications or technology described is intended to suggest possible uses and may be superseded. ZILOG , INC. DOES NOT ASSUME LIABILITY FOR OR PROVIDE A REPRESENTATION OF ACCURACY OF THE INFORMATION, DEVICES or TECHNOLOGY DESCRIBED IN THIS DOCUMENT. ZILOG ALSO DOES NOT ASSUME LIABILITY FOR INTELLECTUAL PROPERTY INFRINGEMENT RELATED IN ANY MANNER TO USE OF INFORMATION, DEVICES or TECHNOLOGY DESCRIBED HEREIN OR OTHERWISE. The information contained within this document has been verified according to the general principles of electrical and mechanical engineering. Z8, Z8 Encore! and Z8 Encore! XP are trademarks or registered trademarks of Zilog, Inc. All other product or service names are the property of their respective owners. Warning:
Z8 Encore!® F0830 Series Product Specification iii
Revision History
Each instance in this document’s revision history reflects a change from its previous edi- tion. For more details, refer to the corresponding page(s) or appropriate links furnished in the table below. Date Revision Level Chapter/Section Description Page No. Dec 2012
13 GPIO Modified GPIO Port D0 language in Shared
Reset Pin section and Port Alternate Func- tion Mapping table. , 36 Sep 2011
12 LED Drive Enable Register Clarified statement surrounding the Alternate
Function Register as it relates to the LED function; revised Sector Based Flash Protec- tion description; revised Packaging chapter. 115, 199 Dec 2007 11 n/a Updated all instances of Z8 Encore! XP F0830 to Z8 Encore! F0830. All Nov 2007
10 DC Characteristics, On-Chip
Peripheral AC and DC Electri- cal Characteristics Updated Tables 116 and and 122. 185 193 Sep 2007
09 Timers, PWM SINGLE OUT-
PUT Mode, PWM DUAL OUT- PUT Mode, Analog-to-Digital Converter, Reference Buffer. Updated Figures 2 and 4, Table 4. 8 , 9, 11, 68, 74, 75, 98, 101 Apr 2007
08 Optimizing NVDS Memory
Usage for Execution Speed, On-Chip Peripheral AC and DC
Electrical Characteristics
Added a note under Table 93 in Nonvolatile Data Storage chapter. Updated Table 121 and Table 122 in Electrical Characteristics chapter. Other style updates. 137 193, 193 Dec 2006 07 General Purpose Input/Output Added PD0 in Table 16. 38 Overview, Interrupt Controller Changed the number of interrupts to 17. 1,5, 53 Nonvolatile Data Storage Updated chapter. 136 Oscillator Control Register Defi- nitions, AC Characteristics, On- Chip Peripheral AC and DC Updated Tables 117 and 122. Added Figure 24. 156 189, 193 Ordering Information Updated Part Number Suffix Designations. 205 n/a Removed Preliminary stamp from footer. All
PS025113-1212 Table of Contents Z8 Encore!® F0830 Series Product Specification iv Table of Contents
PS025113-1212 Table of Contents Z8 Encore!® F0830 Series Product Specification v
PS025113-1212 Table of Contents Z8 Encore!® F0830 Series Product Specification vi
PS025113-1212 Table of Contents Z8 Encore!® F0830 Series Product Specification vii
PS025113-1212 Table of Contents Z8 Encore!® F0830 Series Product Specification viii
PS025113-1212 Table of Contents Z8 Encore!® F0830 Series Product Specification ix
Table 25. Port A–D Stop Mode Recovery Source Enable Subregisters (PxSMRE) . . 45
Table 118. Power-On Reset and Voltage Brown- Out Electrical Characteristics and Tim-
Z8 Encore!® F0830 Series Product Specification Overview Zilog’s Z8 Encore! MCU family of products are the first in a line of Zilog microcontroller products based on the 8-bit eZ8 CPU. The Z8 Encore! F0830 Series products expand on Zilog’s extensive line of 8-bit microcontrollers. The Flash in-circuit programming capabil- ity allows for faster development time and program changes in the field. The new eZ8 CPU is upward-compatible with existing Z8 CPU instructions. The rich peripheral set of Z8 Encore! F0830 Series makes it suitable for a variety of applications including motor control, security systems, home appliances, personal electronic devices and sensors.
Features
The key features of Z8 Encore! F0830 Series MCU include:
- 20 MHz eZ8 CPU
- Up to 12 KB Flash memory with in-circuit programming capability
- Up to 256 B register RAM
- 64 B Nonvolatile Data Storage (NVDS)
- Up to 25 I/O pins depending upon package
- Internal Precision Oscillator (IPO)
- External crystal oscillator
- Two enhanced 16-bit timers with capture, compare and PWM capability
- Watchdog Timer (WDT) with dedicated internal RC oscillator
- Single-pin, On-Chip Debugger (OCD)
- Optional 8-channel, 10-bit Analog-to-Digital Converter (ADC)
- On-chip analog comparator
- Up to 17 interrupt sources
- V oltage Brown-Out (VBO) protection
- Power-On Reset (POR)
- 2.7 V to 3.6 V operating voltage
- Up to thirteen 5 V-tolerant input pins
- 20- and 28-pin packages
- 0°C to +70°C standard temperature range and –40°C to +105°C extended temperature operating ranges
Series product line. See the Ordering Information chapter on page 200 for details. Table 1. Z8 Encore! F0830 Series Family Part Selection Guide
PS025113-1212 CPU and Peripheral Overview Z8 Encore!® F0830 Series Product Specification CPU and Peripheral Overview The eZ8 CPU, Zilog’s latest 8-bit CPU, meets the continuing demand for faster and more code-efficient microcontrollers. The eZ8 CPU executes a superset of the original Z8 instruction set. The eZ8 CPU features include:
- Direct register-to-register architecture allows each register to function as an accumula- tor, improving execution time and decreasing the required program memory
- Software stack allows much greater depth in subroutine calls and interrupts than hard- ware stacks
- Compatible with existing Z8 CPU code
- Expanded internal register file allows access up to 4 KB
- New instructions improve execution efficiency for code developed using high-level programming languages, including C
- Pipelined instruction fetch and execution
- New instructions for improved performance including BIT, BSWAP, BTJ, CPC, LDC, LDCI, LEA, MULT and SRL
- New instructions support 12-bit linear addressing of the register file
- Up to 10 MIPS operation
- C Compiler-friendly
- 2 to 9 clock cycles per instruction For more information about the eZ8 CPU, refer to the eZ8 CPU Core User Manual (UM0128), which is available for download on www.zilog.com. General Purpose Input/Output The Z8 Encore! F0830 Series features up to 25 port pins (Ports A–D) for general-purpose input/output (GPIO). The number of GPIO pins available is a function of package. Each pin is individually programmable. Flash Controller The Flash Controller programs and erases the Flash memory. It also supports protection against accidental programming and erasure.
PS025113-1212 CPU and Peripheral Overview Z8 Encore!® F0830 Series Product Specification Nonvolatile Data Storage The Nonvolatile Data Storage (NVDS) function uses a hybrid hardware/software scheme to implement a byte-programmable data memory and is capable of storing about 100,000 write cycles. Internal Precision Oscillator The Internal Precision Oscillator (IPO) function, with an accuracy of ± 4% full voltage/ temperature range, is a trimmable clock source that requires no external components. External Crystal Oscillator The crystal oscillator circuit provides highly accurate clock frequencies using an external crystal, ceramic resonator or RC network. 10-Bit Analog-to-Digital Converter The optional Analog-to-Digital Converter (ADC) converts an analog input signal to a 10- bit binary number. The ADC accepts inputs from eight different analog input pins. Analog Comparator The analog comparator compares the signal at an input pin with either an internal pro- grammable reference voltage or with a signal at the second input pin. The comparator out- put is used either to drive a logic output pin or to generate an interrupt. Timers Two enhanced 16-bit reloadable timers can be used for timing/counting events or for motor control operations. These timers provide a 16-bit programmable reload counter and operate in ONE-SHOT, CONTINUOUS, GATED, CAPTURE, CAPTURE RESTART, COMPARE, CAPTURE and COMPARE, PWM SINGLE OUTPUT and PWM DUAL OUTPUT Modes. Interrupt Controller The Z8 Encore! F0830 Series products support seventeen interrupt sources with sixteen interrupt vectors: up to five internal peripheral interrupts and up to twelve GPIO inter- rupts. These interrupts have three levels of programmable interrupt priority.
a reset source as well as a reset indicator. The Z8 Encore! F0830 Series products feature an integrated On-Chip Debugger (OCD). one single-pin interface for communication with an external host. Table 2. Acronyms and Expansions
Packaging chapter on page 199.
- Z8F0831
- Z8F0431
- Z8F0131
- Z8F0231
- Z8F1233
Table 3. Z8 Encore! F0830 Series Package Options
Figure 4. Z8F0830 Series in 20-Pin QFN Package
Figure 5. Z8F0830 Series in 28-Pin QFN Package
on page 7 to determine the signals available for each specific package style. Table 4. Signal Descriptions PA[7:0] I/O Port A. These pins are used for general purpose I/O. available only in those devices without an ADC. PC[7:0] I/O Port C. These pins are used for general purpose I/O. PD[0] I/O Port D. This pin is used for general purpose output only. T0OUT/T1OUT O Timer output 0–1. These signa ls are the output from the timers. inputs. The T0IN signal is multiplexed T0OUT signals. COUT O Comparator output. This is the output of the comparator. and PB7 on 28-pin packages without ADC.
to provide the system clock. tal can be connected between it and the XIN pin to form the oscillator. ble drive strengths set by the GPIO block. tor to ensure proper operation. open-drain and features an enabled internal pull-up resistor. Table 4. Signal Descriptions (Continued) and PB7 on 28-pin packages without ADC.
PB6 and PB7 are available only in devices without an ADC function. Table 5. Pin Characteristics (20- and 28-pin Devices)
PS025113-1212 Address Space Z8 Encore!® F0830 Series Product Specification Address Space The eZ8 CPU can access the following three distinct address spaces:
- The register file addresses access for the general purpose registers and the eZ8 CPU, peripheral and general purpose I/O port control registers
- The program memory addresses access for all of the memory locations having execut- able code and/or data
- The data memory addresses access for all of the memory locations containing only the data The following sections describe these three address spaces. For more information about the eZ8 CPU and its address space, refer to the eZ8 CPU Core User Manual (UM0128), which is available for download at www.zilog.com. Register File The register file address space in the Z8 Encore! MCU is 4 KB (4096 bytes). The register file consists of two sections: control registers and general-purpose registers. When instruc- tions are executed, registers defined as source are read and registers defined as destina- tions are written. The architecture of the eZ8 CPU allows all general purpose registers to function as accumulators, address pointers, index registers, stack areas or scratch pad memory. The upper 256 bytes of the 4 KB register file address space are reserved for controlling the eZ8 CPU, on-chip peripherals and the I/O ports. These registers are located at addresses from F00H to FFFH. Some of the addresses within the 256 B Control Register section are reserved (unavailable). Reading from a reserved register file address returns an undefined value. Writing to reserved register file addresses is not recommended and can produce unpredictable results. The on-chip RAM always begins at address 000H in the register file address space. The Z8 Encore! F0830 Series devices contain up to 256 B of on-chip RAM. Reading from register file addresses outside the available RAM addresses (and not within the Control Register address space), returns an undefined value. Writing to these register file addresses has no effect.
the Z8 Encore! F0830 Series products. Table 6. Z8 Encore! F0830 Series Program Memory Maps Note: *See Table 34 on page 54 for a list of interrupt vectors.
gram memory data. Access to the Flash information area is read-only. Table 7. Z8 Encore! F0830 Series Flash Memory Information Area Map
GPIO ports. Consider registers for unimplemented peripherals as reserved. Table 8. Register File Address Map Address (Hex) Register Description Mnemonic Reset (Hex) Page No.
Table 8. Register File Address Map (Continued) Address (Hex) Register Description Mnemonic Reset (Hex) Page No.
Address (Hex) Register Description Mnemonic Reset (Hex) Page No.
Address (Hex) Register Description Mnemonic Reset (Hex) Page No.
PS025113-1212 Reset and Stop Mode Recovery Z8 Encore!® F0830 Series Product Specification Reset and Stop Mode Recovery The reset controller in the Z8 Encore! F0830 Series controls RESET and Stop Mode Recovery operations. In a typical operation, the following events can cause a reset:
- Power-On Reset (POR)
- V oltage Brown-Out (VBO)
- Watchdog Timer time-out (when configured by the WDT_RES Flash option bit to initiate a reset)
- External RESET pin assertion (when the alternate RESET function is enabled by the GPIO register)
- On-Chip Debugger initiated reset (OCDCTL[0] set to 1) When the device is in STOP Mode, a Stop Mode Recovery event is initiated by either of the following occurrences:
- A Watchdog Timer time-out
- A GPIO port input pin transition on an enabled Stop Mode Recovery source The VBO circuitry on the device generates a VBO reset when the supply voltage drops below a minimum safe level. Reset Types The Z8 Encore! F0830 Series provides different types of Reset operations. Stop Mode Recovery is considered a form of reset. Table 9 lists the types of resets and their operating characteristics. The duration of a system reset is longer if the external crystal oscillator is enabled by the Flash option bits; the result is additional time for oscillator startup.
is enabled in the Flash option bits, the reset period is increased to about 5000 IPO cycles. period, the device remains in reset until the pin is deasserted. after which the user code may reconfigure this pin as a general purpose output. oscillator and Watchdog Timer Oscillator continues to run. that value into the program counter. Program execution begins at the reset vector address. enable and select the correct system clock source. Table 9. Reset and Stop Mode Recovery Characteristics and Latency
Table 10 lists the possible sources of a system reset. Each device in the Z8 Encore! F0830 Series contains an internal Power-On Reset circuit. Status (RSTSTAT) Register is set to 1. on page 184 for the POR threshold voltage (VPOR). Table 10. Reset Sources and Resulting Reset Type pin assertion All reset pulses less than 12 ns are ignored.
The V oltage Brown-Out circuit can be either enabled or disabled during STOP Mode. Option Bits chapter on page 124 for information about configuring VBO_AO. it configures the Watchdog Timer to cause an interrupt – not a system reset – at time-out. reset was initiated by the Watchdog Timer. Figure 7. Voltage Brown-Out Reset Operation
PS025113-1212 Stop Mode Recovery Z8 Encore!® F0830 Series Product Specification clock and reset signals, the required reset duration may be three or four clock periods. A reset pulse of three clock cycles in duration might trigger a reset and a reset pulse of four cycles in duration always triggers a reset. While the RESET input pin is asserted low, the Z8 Encore! F0830 Series devices remain in the Reset state. If the RESET pin is held low beyond the system reset time-out, the device exits the Reset state on the system clock rising edge following RESET pin deasser- tion. Following a system reset initiated by the external RESET pin, the EXT status bit in the Reset Status (RSTSTAT) Register is set to 1. External Reset Indicator During system reset or when enabled by the GPIO logic, the RESET pin functions as an open-drain (active low) RESET mode indicator in addition to the input functionality. This reset output feature allows an Z8 Encore! F0830 Series device to reset other components to which it is connected, even if that reset is caused by internal sources such as POR, VBO or WDT events. See the Port A–D Control Registers section on page 41. After an internal Reset event occurs, the internal circuitry begins driving the RESET pin low. The RESET pin is held low by the internal circuitry until the appropriate delay listed in Table 9 (see page 22) has elapsed. On-Chip Debugger Initiated Reset A Power-On Reset can be initiated using the On-Chip Debugger by setting the RST bit in the OCD Control Register. The OCD block is not reset, but the remainder of the chip goes through a normal system reset. The RST bit automatically clears during the system reset. Following the system reset, the POR bit in the Reset Status (RSTSTAT) Register is set. Stop Mode Recovery The device enters the STOP Mode when the STOP instruction is executed by the eZ8 CPU. See the Low-Power Modes chapter on page 30 for detailed STOP Mode informa- tion. During Stop Mode Recovery, the CPU is held in reset for about 66 IPO cycles if the crystal oscillator is disabled or about 5000 cycles if it is enabled. Stop Mode Recovery does not affect the on-chip registers other than the Reset Status (RSTSTAT) Register and the Oscillator Control Register (OSCCTL). After any Stop Mode Recovery, the IPO is enabled and selected as the system clock. If another system clock source is required or IPO disabling is required, the Stop Mode Recovery code must reconfigure the oscillator control block such that the correct system clock source is enabled and selected.
Register is set to 1. Table 11 lists the Stop Mode Recovery sources and resulting actions. services the WDT interrupt request following the normal Stop Mode Recovery sequence. tus (RSTSTAT) Register, the STOP bit is set to 1. tiating an interrupt (if enabled for that pin). Table 11. Stop Mode Recovery Sources and Resulting Action
PS025113-1212 Debug Pin Driven Low Z8 Encore!® F0830 Series Product Specification Stop Mode Recovery Using the External RESET Pin When the Z8 Encore! F0830 Series device is in STOP Mode and the external RESET pin is driven low, a system reset occurs. Because of a glitch filter operating on the RESET pin, the low pulse must be greater than the minimum width specified about 12 ns or it is ignored. The EXT bit in the Reset Status (RSTSTAT) Register is set. Debug Pin Driven Low Debug reset is initiated when the On-Chip Debugger detects any of the following error conditions on the DBG pin:
- Serial break (a minimum of nine continuous bits Low)
- Framing error (received STOP bit is Low)
- Transmit collision (simultaneous OCD and host transmission detected by the OCD) When the Z8F0830 Series device is operating in STOP Mode, the debug reset will cause a system reset. The On-Chip Debugger block is not reset, but the remainder of the chip’s operations go through a normal system reset. The POR bit in the Reset Status (RSTSTAT) Register is set to 1. Reset Register Definitions The following sections define the Reset registers. Reset Status Register The Reset Status (RSTSTAT) Register, shown in Table 12, is a read-only register that indi- cates the source of the most recent Reset event, Stop Mode Recovery event or Watchdog Timer time-out event. Reading this register resets the upper four bits to 0. This register shares its address with the Watchdog Timer Control Register, which is write- only.
Table 12. Reset Status Register (RSTSTAT) Mode Recovery occurs. Reading this register also reset this bit to 0. Recovery from a change in an input pin also resets this bit. Reading this register resets this bit. This read must occur before clearing the WDT interrupt. These registers are reserved and must be programmed to 0000. Table 13. POR Indicator Values
PS025113-1212 Low-Power Modes Z8 Encore!® F0830 Series Product Specification Low-Power Modes The Z8 Encore! F0830 Series products contain power saving features. The highest level of power reduction is provided by the STOP Mode. The next level of power reduction is pro- vided by the HALT Mode. Further power savings can be implemented by disabling the individual peripheral blocks while in NORMAL Mode. The user must not enable the pull-up register bits for unused GPIO pins, since these ports are default output to VSS. Unused GPIOs include those missing on 20-pin packages, as well as those missing on the ADC-enabled 28-pin packages. STOP Mode Executing the eZ8 CPU’s STOP instruction places the device into STOP Mode. In STOP Mode, the operating characteristics are:
- Primary crystal oscillator and Internal Precision Oscillator are stopped; XIN and XOUT (if previously enabled) are disabled and PA0/PA1 revert to the states pro- grammed by the GPIO registers
- System clock is stopped
- eZ8 CPU is stopped
- Program counter (PC) stops incrementing
- Watchdog Timer’s internal RC oscillator continues to operate if enabled by the Oscil- lator Control Register
- If enabled, the Watchdog Timer logic continues to operate
- If enabled for operation in STOP Mode by the associated Flash option bit, the V oltage Brown-Out protection circuit continues to operate
- All other on-chip peripherals are idle To minimize the current in STOP Mode, all GPIO pins that are configured as digital inputs must be driven to V DD when the pull-up register bit is enabled or to one of power rail (VDD or GND) when the pull-up register bit is disabled. The device can be brought out of STOP Mode using Stop Mode Recovery. For more information about Stop Mode Recov- ery, see the Reset and Stop Mode Recovery chapter on page 21.
Z8 Encore!® F0830 Series Product Specification HALT Mode Executing the eZ8 CPU HALT instruction places the device into HALT Mode. In HALT Mode, the operating characteristics are:
- Primary oscillator is enabled and continues to operate
- System clock is enabled and continues to operate
- eZ8 CPU is stopped
- Program counter (PC) stops incrementing
- Watchdog Timer’s internal RC oscillator continues to operate
- If enabled, the Watchdog Timer continues to operate
- All other on-chip peripherals continue to operate The eZ8 CPU can be brought out of HALT Mode by any one of the following operations:
- Interrupt
- Watchdog Timer time-out (interrupt or reset)
- Power-On Reset
- V oltage Brown-Out reset
- External RESET pin assertion To minimize current in HALT Mode, all GPIO pins that are configured as digital inputs must be driven to VDD when pull-up register bit is enabled or to one of power rail (VDD or GND) when pull-up register bit is disabled. Peripheral Level Power Control In addition to the STOP and HALT modes, it is possible to disable each peripheral on each of the Z8 Encore! F0830 Series devices. Disabling a given peripheral minimizes its power consumption. Power Control Register Definitions Power Control Register 0 Each bit of the following registers disables a peripheral block, either by gating its system clock input or by removing power from the block.
Table 14. Power Control Register 0 (PWRCTL0) These registers are reserved and must be programmed to 000. This bit is reserved and must be programmed to 1. This bit is reserved and must be programmed to 0. This bit is reserved and must be programmed to 0.
capable of direct LED drive at programmable drive strengths. Table 15 lists the port pins available with each device and package type. Table 15. Port Availability by Device and Package Type Note: 20-pin and 28-pin and 10-bit ADC Enabled or Disabled can be selected via the option bits.
PS025113-1212 Direct LED Drive Z8 Encore!® F0830 Series Product Specification PA0 and PA6 contain two different Timer functions, a timer input and a complementary timer output. Both of these functions require the same GPIO configuration, the selection between the two is based on the TIMER mode. For more details, see the Timers chapter on page 68. Direct LED Drive The Port C pins provide a sinked current output, capable of driving an LED without requiring an external resistor. The output sinks current at programmable levels, 3 mA, 7 mA, 13 mA and 20 mA. This mode is enabled through the LED Control registers. For proper function, the LED anode must be connected to VDD and the cathode to the GPIO pin. Using all Port C pins in LED drive mode with maximum current may result in excessive total current. See the Electrical Characteristics chapter on page 184 for the maximum total current for the applicable package. Shared Reset Pin On the 20- and 28-pin devices, the Port D0 pin shares function with a bidirectional reset pin. Unlike all other I/O pins, this pin does not default to GPIO function on power-up. This pin acts as a bidirectional input/output open-drain reset with an internal pull-up until the user software reconfigures it as a GPIO PD0. When in GPIO mode, the Port D0 pin functions as output only, and must be configured as an output. PD0 supports the high drive feature, but not the stop-mode recovery feature. Crystal Oscillator Override For systems using a crystal oscillator, the pins PA0 and PA1 are connected to the crystal. When the crystal oscillator is enabled, the GPIO settings are overridden and PA0 and PA1 are disabled. See the Oscillator Control Register Definitions section on page 154.
5 V Tolerance
In the 20- and 28-pin versions of this device, any pin, which shares functionality with an ADC, crystal or comparator port is not 5 V-tolerant, including PA[1:0], PB[5:0] and PC[2:0]. All other signal pins are 5 V-tolerant and can safely handle inputs higher than VDD even with the pull-ups enabled, but with excess power consumption on pull-up resis- tor.
select the PB3 as the system clock. Table 16. Port Alternate Function Mapping
- Because there is only a single alternate function for each Port A and Port D (PD0) pin, the Alternate Function
- Because there are at most two choices of alternate functions for any Port B pin, the AFS2 Alternate Function Set
described in the Port A–D Alternate Function Subregisters section on page 42) must also be enabled.
- Because there are at most two choices of alternate functions for any Port C pin, the AFS2 Alternate Function Set
described in the Port A–D Alternate Function Subregisters section on page 42) must also be enabled.
Table 16. Port Alternate Function Mapping (Continued)
- Because there is only a single alternate function for each Port A and Port D (PD0) pin, the Alternate Function
- Because there are at most two choices of alternate functions for any Port B pin, the AFS2 Alternate Function Set
described in the Port A–D Alternate Function Subregisters section on page 42) must also be enabled.
- Because there are at most two choices of alternate functions for any Port C pin, the AFS2 Alternate Function Set
described in the Port A–D Alternate Function Subregisters section on page 42) must also be enabled.
- Because there is only a single alternate function for each Port A and Port D (PD0) pin, the Alternate Function
- Because there are at most two choices of alternate functions for any Port B pin, the AFS2 Alternate Function Set
described in the Port A–D Alternate Function Subregisters section on page 42) must also be enabled.
- Because there are at most two choices of alternate functions for any Port C pin, the AFS2 Alternate Function Set
described in the Port A–D Alternate Function Subregisters section on page 42) must also be enabled.
tion about interrupts using the GPIO pins. together to provide access to subregisters for port configuration and control. Table 17. GPIO Port Registers and Subregisters
vide access to all GPIO port controls; see Tables 18 and 19. Table 18. Port A–D GPIO Address Registers (PxADDR) The port address selects one of the subregisters accessible through the Port Control Register. Table 19. Port Control Subregister Access 00H No function. Provides some protection against accidental port reconfiguration.
read from or written to by a Port A–D Control Register transaction. A–D Control Register by writing 01H to the Port A–D Address Register. Table 20. Port A–D Control Registers (PxCTL) Table 21. Port A–D Data Direction Subregisters (PxDD) overrides the Data Direction Register setting. 0 = Output. Data in the Port A–D Output Data Register is driven onto the port pin. 1 = Input. The port pin is sampled and the value written into the Port A–D Input Data Register. The output driver is tristated. Note: x indicates the specific GPIO port pin number (7–0).
Port A–D Alternate Function subregisters enable the alternate function selection on pins. page 34 to determine the alternate functions associated with each port pin. ternate function. Failure to follow this guideline can result in unpredictable operation. Table 22. Port A–D Alternate Function Subregisters (PxAF) ter determines the direction of the pin. pin operation is controlled by the Alternate function. Note: x indicates the specific GPIO port pin number (7–0).
Table 23. Port A–D Output Control Subregisters (PxOC) 1 = The drain of the associated pin is disabled (OPEN-DRAIN mode). Note: x indicates the specific GPIO port pin number (7–0).
affects the pins directly and, as a result, alternate functions are also affected. Table 24. Port A–D High Drive Enable Subregisters (PxHDE) 0 = The port pin is configured for standard output current drive. 1 = The port pin is configured for high output current drive. Note: x indicates the specific GPIO port pin number (7–0).
Table 25. Port A–D Stop Mode Recovery Source Enable Subregisters (PxSMRE) ing STOP Mode do not initiate Stop Mode Recovery. during STOP Mode initiates Stop Mode Recovery. Note: x indicates the specific GPIO port pin number (7–0).
Table 26. Port A–D Pull-Up Enable Subregisters (PxPUE) 0 = The weak pull-up on the port pin is disabled. 1 = The weak pull-up on the port pin is enabled. Note: x indicates the specific GPIO port pin number (7–0).
through the Port A–D Control Register by writing 07H to the Port A–D Address Register. the GPIO Alternate Functions section on page 34. A–D Alternate Function Subregisters section on page 42. Table 27. Port A–D Alternate Function Set 1 Subregisters (PxAFS1) Note: x indicates the specific GPIO port pin number (7–0).
through the Port A–D Control Register by writing 08H to the Port A–D Address Register. Table 16 in the GPIO Alternate Functions section on page 34. A–D Alternate Function Subregisters section on page 42. Table 28. Port A–D Alternate Function Set 2 Subregisters (PxAFS2) Note: x indicates the specific GPIO port pin number (7–0).
values from the corresponding port pins. The Port A–C Input Data registers are read-only. Table 29. Port A–C Input Data Registers (PxIN) Sampled data from the corresponding port pin input. 0 = Input data is logical 0 (Low). 1 = Input data is logical 1 (High). Note: x indicates the specific GPIO port pin number (7–0).
Table 30. Port A–D Output Data Register (PxOUT) 0 = Drive a logical 0 (Low). corresponding port output Control Register bit to 1. Note: x indicates the specific GPIO port pin number (7–0).
The LED Drive Enable Register, shown in Table 31, activates the controlled current drive. [7:0] correspond to Port C bits [7:0], respectively. Port C pin. Each pin is individually programmable. Table 31. LED Drive Enable (LEDEN) These bits determine which Port C pins are connected to an internal current sink. 0 = Tristate the Port C pin. 1= Connect controlled current sink to the Port C pin. Table 32. LED Drive Level High Register (LEDLVLH) {LEDLVLH, LEDLVLL} select one of four programmable current drive levels for each Port C pin.
Port C pin. Each pin is individually programmable. Table 33. LED Drive Level Low Register (LEDLVLL) {LEDLVLH, LEDLVLL} select one of four programmable current drive levels for each Port C pin.
PS025113-1212 Interrupt Controller Z8 Encore!® F0830 Series Product Specification Interrupt Controller The Interrupt Controller on the Z8 Encore!® F0830 Series products prioritize the interrupt requests from the on-chip peripherals and the GPIO port pins. The features of the Interrupt Controller include:
- Seventeen interrupt sources using sixteen unique interrupt vectors: – Twelve GPIO port pin interrupt sources – Five on-chip peripheral interrupt sources (Comparator Output interrupt shares one interrupt vector with PA6)
- Flexible GPIO interrupts – Eight selectable rising and falling edge GPIO interrupts – Four dual-edge interrupts
- Three levels of individually programmable interrupt priority
- Watchdog Timer can be configured to generate an interrupt m Interrupt requests (IRQs) allow peripheral devices to suspend CPU operation in an orderly manner and force the CPU to start an interrupt service routine (ISR). Usually this interrupt service routine is involved with the exchange of data, status information or control infor- mation between the CPU and the interrupting peripheral. When the service routine is com- pleted, the CPU returns to the operation from which it was interrupted. The eZ8 CPU supports both vectored and polled interrupt handling. For polled interrupts, the Interrupt Controller has no effect on operation. For more information about interrupt servicing by the eZ8 CPU, refer to the eZ8 CPU User Manual (UM0128), which is avail- able for download at www.zilog.com. Interrupt Vector Listing Table 34 lists the interrupts available in order of priority. The interrupt vector is stored with the most significant byte (MSB) at the even program memory address and the least significant byte (LSB) at the odd program memory address. Some port interrupts are not available on the 20-pin and 28-pin packages. The ADC inter- rupt is unavailable on devices not containing an ADC. Note:
Table 34. Trap and Interrupt Vectors in Order of Priority
Z8 Encore!® F0830 Series Product Specification
- Writing 1 to the IRQE bit in the Interrupt Control Register Interrupts are globally disabled by any of the following actions:
- Execution of a DI (disable interrupt) instruction
- eZ8 CPU acknowledgement of an interrupt service request from the Interrupt Control- ler
- Writing a 0 to the IRQE bit in the Interrupt Control Register
- Reset
- Execution of a trap instruction
- Illegal instruction Trap
- Primary oscillator fail trap
- Watchdog Oscillator fail trap Interrupt Vectors and Priority The Interrupt Controller supports three levels of interrupt priority. Level 3 is the highest priority, level 2 is the second highest priority and level 1 is the lowest priority. If all of the interrupts are enabled with identical interrupt priority (all as level 2 interrupts, for exam- ple), the interrupt priority is assigned from highest to lowest as specified in Table 34 on page 54. Level 3 interrupts are always assigned higher priority than level 2 interrupts and level 2 interrupts are assigned higher priority than level 1 interrupts. Within each interrupt priority level (level 1, level 2 or level 3), priority is assigned as specified in Table 34, above. Reset, Watchdog Timer interrupt (if enabled), primary oscillator fail trap, Watch- dog Oscillator fail trap and illegal instruction trap always have highest (level 3) priority. Interrupt Assertion Interrupt sources assert their interrupt requests for only a single system clock period (sin- gle pulse). When the interrupt request is acknowledged by the eZ8 CPU, the correspond- ing bit in the interrupt request register is cleared. Writing 0 to the corresponding bit in the interrupt request register clears the interrupt request. Zilog recommends not using a coding style that clears bits in the Interrupt Request reg- isters. All incoming interrupts received between execution of the first LDX command and the final LDX command are lost. See Example 1, which follows. Example 1. A poor coding style that can result in lost interrupt requests: Caution:
PS025113-1212 Interrupt Control Register Definitions Z8 Encore!® F0830 Series Product Specification LDX r0, IRQ0 AND r0, MASK LDX IRQ0, r0 To avoid missing interrupts, use the coding style in Example 2 to clear bits in the Interrupt Request 0 Register: Example 2. A good coding style that avoids lost interrupt requests: ANDX IRQ0, MASK Software Interrupt Assertion Program code can generate interrupts directly. Writing 1 to the correct bit in the interrupt request register triggers an interrupt (assuming that interrupt is enabled). When the inter- rupt request is acknowledged by the eZ8 CPU, the bit in the interrupt request register is automatically cleared to 0. Zilog recommends not using a coding style to generate software interrupts by setting bits in the Interrupt Request registers. All incoming interrupts received between execution of the first LDX command and the final LDX command are lost. See Example 3, which fol- lows. Example 3. A poor coding style that can result in lost interrupt requests: LDX r0, IRQ0 OR r0, MASK LDX IRQ0, r0 To avoid missing interrupts, use the coding style in Example 4 to set bits in the Interrupt Request registers: Example 4. A good coding style that avoids lost interrupt requests: ORX IRQ0, MASK Interrupt Control Register Definitions The Interrupt Control registers enable individual interrupts, set interrupt priorities and indicate interrupt requests for all of the interrupts other than the Watchdog Timer interrupt, the primary oscillator fail trap and the Watchdog Oscillator fail trap interrupts. Caution:
(vectored interrupts), the Interrupt Controller passes an interrupt request to the eZ8 CPU. Request 0 Register to determine if any interrupt requests are pending. Table 35. Interrupt Request 0 Register (IRQ0) This bit is reserved and must be programmed to 0. 0 = No interrupt request is pending for timer 1. 1 = An interrupt request from timer 1 is awaiting service. 0 = No interrupt request is pending for timer 0. 1 = An interrupt request from timer 0 is awaiting service. These registers are reserved and must be programmed to 0000. 0 = No interrupt request is pending for the analog-to-digital converter. 1 = An interrupt request from the analog-to-digital converter is awaiting service.
Request 1 Register to determine if any interrupt requests are pending. Table 36. Interrupt Request 1 Register (IRQ1) 0 = No interrupt request is pending for GPIO Port A. 1 = An interrupt request from GPIO Port A. 0 = No interrupt request is pending for GPIO Port A or comparator. 1 = An interrupt request from GPIO Port A or comparator. 0 = No interrupt request is pending for GPIO Port A pin x. 1 = An interrupt request from GPIO Port A pin x is awaiting service. Note: x indicates the specific GPIO port pin number (5–0).
Request 2 Register to determine if any interrupt requests are pending. Table 37. Interrupt Request 2 Register (IRQ2) These registers are reserved and must be programmed to 0000. 0 = No interrupt request is pending for GPIO Port C pin x. 1 = An interrupt request from GPIO Port C pin x is awaiting service. Note: x indicates the specific GPIO port pin number (3–0). Table 38. IRQ0 Enable and Priority Encoding Note: x indicates the register bits in the range 7–0.
Table 39. IRQ0 Enable High Bit Register (IRQ0ENH) This bit is reserved and must be programmed to 0. These registers are reserved and must be programmed to 0000. Table 40. IRQ0 Enable Low Bit Register (IRQ0ENL) This bit is reserved and must be programmed to 0. These registers are reserved and must be programmed to 0000.
in the Interrupt Request 1 Register. Priority is generated by setting the bits in each register. Table 41. IRQ1 Enable and Priority Encoding
11 Level 3 High
Note: x indicates register bits in the address range 7–0. Table 42. IRQ1 Enable High Bit Register (IRQ1ENH) Note: x indicates register bits in the address range 5–0.
in the Interrupt Request 2 Register. Priority is generated by setting the bits in each register. Table 43. IRQ1 Enable Low Bit Register (IRQ1ENL) Note: x indicates register bits in the address range 5–0. Table 44. IRQ2 Enable and Priority Encoding Note: x indicates register bits in the address range 7–0.
Table 45. IRQ2 Enable High Bit Register (IRQ2ENH) These registers are reserved and must be programmed to 0000. Table 46. IRQ2 Enable Low Bit Register (IRQ2ENL) These registers are reserved and must be programmed to 0000.
Table 47. Interrupt Edge Select Register (IRQES) 0 = An interrupt request is generated on the falling edge of the PAx input or PDx. 1 = An interrupt request is generated on the rising edge of the PAx input or PDx. Note: x indicates register bits in the address range 7–0.
nate sources for the individual interrupts. disabled before switching between sources. Table 48. Shared Interrupt Select Register (IRQSS) This bit is reserved and must be programmed to 0. 0 = PA6 is used for the interrupt caused by PA6CS interrupt request. 1 = The comparator is used for the interrupt caused by PA6CS interrupt request. These registers are reserved and must be programmed to 000000.
Table 49. Interrupt Control Register (IRQCTL) 0 = Interrupts are disabled. These registers are reserved and must be programmed to 0000000.
Z8 Encore!® F0830 Series Product Specification Timers The Z8 Encore! F0830 Series products contain up to two 16-bit reloadable timers that can be used for timing, event counting or generation of pulse width modulated (PWM) signals. The timers feature include:
- 16-bit reload counter
- Programmable prescaler with prescale values ranging from 1 to 128
- PWM output generation
- Capture and compare capability
- External input pin for timer input, clock gating or capture signal. External input pin sig- nal frequency is limited to a maximum of one-fourth the system clock frequency
- Timer output pin
- Timer interrupt Architecture Figure 10 displays the architecture of the timers.
FFFFH, the timer resets back to 0000H and continues counting. Figure 10. Timer Block Diagram
Z8 Encore!® F0830 Series Product Specification reload. For the timer output to make a state change at a ONE-SHOT time-out (rather than a single cycle pulse), first set the TPOL bit in the Timer Control Register to the start value before enabling ONE-SHOT Mode. After starting the timer, set TPOL to the opposite bit value. Observe the following steps for configuring a timer for ONE-SHOT Mode and for initiat- ing the count: 1. Write to the Timer Control Register to: – Disable the timer – Configure the timer for ONE-SHOT Mode – Set the prescale value – Set the initial output level (High or Low) if using the timer output Alternate func- tion 2. Write to the Timer High and Low Byte registers to set the starting count value. 3. Write to the Timer Reload High and Low Byte registers to set the reload value. 4. If appropriate, enable the timer interrupt an d set the timer interrupt priority by writing to the relevant interrupt registers. 5. If using the timer output function, configur e the associated GPIO port pin for the timer output alternate function. 6. Write to the Timer Control Register to enable the timer and initiate counting. In ONE-SHOT Mode, the system clock always provides the timer input. The timer period is calculated with the following equation: CONTINUOUS Mode In CONTINUOUS Mode, the timer counts up to the 16-bit reload value stored in the Timer Reload High and Low Byte registers. The timer input is the system clock. Upon reaching the reload value, the timer generates an interrupt, the count value in the Timer High and Low Byte registers is reset to 0001H and the counting resumes. Additionally, if the timer output alternate function is enabled, the timer output pin changes state (from Low to High or from High to Low) at timer reload. Observe the following steps for configuring a timer for CONTINUOUS Mode and for ini- tiating the count: 1. Write to the Timer Control Register to: One-Shot Mode Time-Out Period (s) Reload Value Start Value– Prescale
Z8 Encore!® F0830 Series Product Specification – Disable the timer – Configure the timer for CONTINUOUS Mode – Set the prescale value – If using the timer output A lternate function, set the initial output level (High or Low) 2. Write to the Timer High and Low Byte regist ers to set the starting count value (usually 0001H). This action only affects the first pass in CONTINUOUS Mode. After the first timer reload in CONTINUOUS Mode, counting always begins at the reset value of 0001H. 3. Write to the Timer Reload High and Low Byte registers to set the reload value. 4. Enable the timer interrupt (if appropriate) an d set the timer interrupt priority by writ- ing to the relevant interrupt registers. 5. Configure the associated GPIO port pin (i f using the timer output function) for the timer output alternate function. 6. Write to the Timer Control Register to enable the timer and initiate counting. In CONTINUOUS Mode, the system clock always provides the timer input. The timer period is calculated with the following equation: If an initial starting value other than 0001H is loaded into the Timer High and Low Byte registers, use the ONE-SHOT Mode equation to determine the first time-out period. COUNTER Mode In COUNTER Mode, the timer counts input transitions from a GPIO port pin. The timer input is taken from the GPIO port pin: timer input alternate function. The TPOL bit in the Timer Control Register determines whether the count occurs on the rising edge or the fall- ing edge of the timer input signal. In COUNTER Mode, the prescaler is disabled. The input frequency of the timer input signal must not exceed one-fourth the system clock frequency. Upon reaching the reload value stored in the Timer Reload High and Low Byte registers, the timer generates an interrupt, the count value in the Timer High and Low Byte registers is reset to 0001H and counting resumes. Additionally, if the timer output alternate function Continuous Mode Time-Out Period (s) Reload Value Prescale Caution:
Z8 Encore!® F0830 Series Product Specification is enabled, the timer output pin changes state (from Low to High or from High to Low) at timer reload. Observe the following steps for configuring a timer for COUNTER Mode and for initiat- ing the count: 1. Write to the Timer Control Register to: – Disable the timer – Configure the timer for COUNTER Mode – Select either the rising edge or falling edge of the timer input signal for the count. This selection also sets the initial logic le vel (High or Low) for the timer output alternate function. However, the timer output function is not required to be enabled. 2. Write to the Timer High and Low Byte regi sters to set the starting count value. This only affects the first pass in COUNTER Mode. After the first timer reload in COUN- TER Mode, counting always begins at the reset value 0001H. In COUNTER Mode, the Timer High and Low Byte registers must be written with the value 0001H. 3. Write to the Timer Reload High and Low Byte registers to set the reload value. 4. If appropriate, enable the timer interrupt an d set the timer interrupt priority by writing to the relevant interrupt registers. 5. Configure the associated GPIO port pi n for the timer input alternate function. 6. If using the timer output function, configur e the associated GPIO port pin for the timer output alternate function. 7. Write to the Timer Control Re gister to enable the timer. In COUNTER Mode, the number of timer input transitions is calculated with the follow- ing equation: COMPARATOR COUNTER Mode In COMPARATOR COUNTER Mode, the timer counts the input transitions from the ana- log comparator output. The TPOL bit in the Timer Control Register determines whether the count occurs on the rising edge or the falling edge of the comparator output signal. In COMPARATOR COUNTER Mode, the prescaler is disabled. Counter Mode Timer Input Transitions Current Count Value Start Value–=
Z8 Encore!® F0830 Series Product Specification The frequency of the comparator output signal must not exceed one-fourth the system clock frequency. After reaching the reload value stored in the Timer Reload High and Low Byte registers, the timer generates an interrupt, the count value in the Timer High and Low Byte registers is reset to 0001H and counting resumes. Additionally, if the timer output alternate function is enabled, the timer output pin changes state (from Low to High or from High to Low) at timer reload. Observe the following steps for configuring a timer for COMPARATOR COUNTER Mode and for initiating the count: 1. Write to the Timer Control Register to: – Disable the timer – Configure the timer for COMPARATOR COUNTER Mode. – Select either the rising edge or falling edge of the comparator output signal for the count. This also sets the initial logic level (High or Low) for the timer output alter- nate function. However, the timer output function is not required to be enabled. 2. Write to the Timer High and Low Byte regi sters to set the starting count value. This action only affects the first pass in COMPARATOR COUNTER Mode. After the first timer reload in COMPARATOR COUNTER Mode, counting always begins at the reset value 0001H. Generally, in COMPARATOR COUNTER Mode, the Timer High and Low Byte registers must be written with the value 0001H. 3. Write to the Timer Reload High and Low Byte registers to set the reload value. 4. If appropriate, enable the timer interrupt an d set the timer interrupt priority by writing to the relevant interrupt registers. 5. If using the timer output function, configur e the associated GPIO port pin for the timer output alternate function. 6. Write to the Timer Control Re gister to enable the timer. In COMPARATOR COUNTER Mode, the number of comparator output transitions is cal- culated with the following equation: Caution: Comparator Output Transitions Current Count Value Start Value–=
Z8 Encore!® F0830 Series Product Specification PWM SINGLE OUTPUT Mode In PWM SINGLE OUTPUT Mode, the timer outputs a pulse width modulated (PWM) output signal through a GPIO port pin. The timer input is the system clock. The timer first counts up to 16-bit PWM match value stored in the timer PWM High and Low Byte regis- ters. When the timer count value matches the PWM value, the timer output toggles. The timer continues counting until it reaches the reload value stored in the Timer Reload High and Low Byte registers. Upon reaching the reload value, the timer generates an interrupt, the count value in the Timer High and Low Byte registers is reset to 0001H and counting resumes. If the TPOL bit in the Timer Control Register is set to 1, the timer output signal begins as a High (1) and transitions to a Low (0) when the timer value matches the PWM value. The timer output signal returns to a High (1) after the timer reaches the reload value and is reset to 0001H. If the TPOL bit in the Timer Control Register is set to 0, the timer output signal begins as a Low (0) and transitions to a High (1) when the timer value matches the PWM value. The timer output signal returns to a Low (0) after the timer reaches the reload value and is reset to 0001H. Observe the following steps for configuring a timer for PWM SINGLE OUTPUT Mode and for initiating PWM operation: 1. Write to the Timer Control Register to: – Disable the timer – Configure the timer for PWM Mode – Set the prescale value – Set the initial logic level (High or Low) and PWM High/Low transition for the timer output alternate function 2. Write to the Timer High and Low Byte regi sters to set the starting count value (typi- cally 0001H). This value only affects the first pass in PWM Mode. After the first timer reset in PWM Mode, counting always begins at the reset value of 0001H. 3. Write to the PWM High and Low Byte registers to set the PWM value. 4. Write to the Timer Reload High and Low Byte registers to set the reload value (PWM period). The reload value must be greater than the PWM value. 5. If appropriate, enable the timer interrupt an d set the timer interrupt priority by writing to the relevant interrupt registers. 6. Configure the associated GPIO port pin for the timer output alternate function. 7. Write to the Timer Control Register to enable the timer and initiate counting. The PWM period is represented by the following equation:
Z8 Encore!® F0830 Series Product Specification If an initial starting value other than 0001H is loaded into the Timer High and Low Byte registers, use the ONE-SHOT Mode equation to determine the first PWM time-out period. If TPOL bit is set to 0, the ratio of the PWM output high time to the total period is repre- sented by: If TPOL bit is set to 1, the ratio of the PWM output high time to the total period is repre- sented by: PWM DUAL OUTPUT Mode In PWM DUAL OUTPUT Mode, the timer outputs a PWM output signal pair (basic PWM signal and its complement) through two GPIO port pins. The timer input is the sys- tem clock. The timer first counts up to 16-bit PWM match value stored in the timer PWM High and Low Byte registers. When the timer count value matches the PWM value, the timer output toggles. The timer continues counting until it reaches the reload value stored in the Timer Reload High and Low Byte registers. Upon reaching the reload value, the timer generates an interrupt, the count value in the Timer High and Low Byte registers is reset to 0001H and counting resumes. If the TPOL bit in the Timer Control Register is set to 1, the timer output signal begins as a High (1) and transitions to a Low (0) when the timer value matches the PWM value. The timer output signal returns to a High (1) after the timer reaches the reload value and is reset to 0001H. If the TPOL bit in the Timer Control Register is set to 0, the timer output signal begins as a Low (0) and transitions to a High (1) when the timer value matches the PWM value. The timer output signal returns to a Low (0) after the timer reaches the reload value and is reset to 0001H. The timer also generates a second PWM output signal: the timer output complement. The timer output complement is the complement of the timer output PWM signal. A program- mable deadband delay can be configured to time delay (0 to 128 system clock cycles) PWM output transitions on these two pins from a Low to a High (inactive to active) to ensure a time gap between the deassertion of one PWM output to the assertion of its com- plement. PWM Period (s) Reload Value Prescale PWM Output High Time Ratio (%) Reload Value PWM Value– PWM Output High Time Ratio (%) PWM Value
Z8 Encore!® F0830 Series Product Specification Observe the following steps for configuring a timer for PWM DUAL OUTPUT Mode and for initiating the PWM operation: 1. Write to the Timer Control Register to: – Disable the timer – Configure the timer for PWM DUAL OU TPUT Mode; setting the mode also involves writing to TMODEHI bit in the TxCTL1 Register – Set the prescale value – Set the initial logic level (High or Low) and PWM High/Low transition for the timer output alternate function 2. Write to the Timer High and Low Byte regi sters to set the starting count value (typi- cally 0001H). This write only affects the first pass in PWM Mode. After the first timer reset in PWM Mode, counting always begins at the reset value of 0001H. 3. Write to the PWM High and Low Byte registers to set the PWM value. 4. Write to the PWM Control Register to se t the PWM deadband delay value. The dead- band delay must be less than the duration of the positive phase of the PWM signal (as defined by the PWM High and Low Byte registers). It must also be less than the dura- tion of the negative phase of the PWM signal (as defined by the difference between the PWM registers and the Timer Reload registers). 5. Write to the Timer Reload High and Low Byte registers to set the reload value (PWM period). The reload value must be greater than the PWM value. 6. If appropriate, enable the timer interrupt an d set the timer interrupt priority by writing to the relevant interrupt registers. 7. Configure the associated GPIO port pin for the timer output and timer output comple- ment alternate functions. The timer output complement function is shared with the timer input function for both timers. Setting the timer mode to DUAL PWM will auto- matically switch the function from timer-in to timer-out complement. 8. Write to the Timer Control Register to enable the timer and initiate counting. The PWM period is represented by the following equation: If an initial starting value other than 0001H is loaded into the Timer High and Low Byte registers, the ONE-SHOT Mode equation determines the first PWM time-out period. If TPOL is set to 0, the ratio of the PWM output high time to the total period is represented by: PWM Period (s) Reload Value Prescale
Z8 Encore!® F0830 Series Product Specification If TPOL is set to 1, the ratio of the PWM output high time to the total period is represented by: CAPTURE Mode In CAPTURE Mode, the current timer count value is recorded when the appropriate exter- nal timer input transition occurs. The capture count value is written to the timer PWM High and Low Byte registers. The timer input is the system clock. The TPOL bit in the Timer Control Register determines if the capture occurs on a rising edge or a falling edge of the timer input signal. When the capture event occurs, an interrupt is generated and the timer continues counting. The INPCAP bit in the TxCTL1 Register is set to indicate the timer interrupt because of an input capture event. The timer continues counting up to the 16-bit reload value stored in the Timer Reload High and Low Byte registers. Upon reaching the reload value, the timer generates an inter- rupt and continues counting. The INPCAP bit in the TxCTL1 Register clears, indicating that the timer interrupt has not occurred because of an input capture event. Observe the following steps for configuring a timer for CAPTURE Mode and initiating the count: 1. Write to the Timer Control Register to: – Disable the timer – Configure the timer for CAPTURE Mode – Set the prescale value – Set the capture edge (rising or falling) for the timer input 2. Write to the Timer High and Low Byte regi sters to set the starting count value (typi- cally 0001H). 3. Write to the Timer Reload High and Low Byte registers to set the reload value. 4. Clear the timer PWM High and Low Byte registers to 0000H. Clearing these registers allows user software to determine if interrupts were generated either by a capture event or by a reload. If the PWM High and Low Byte registers still contain 0000H after the interrupt, the interrupt were generated by a reload. PWM Output High Time Ratio (%) Reload Value PWM Value– PWM Output High Time Ratio (%) PWM Value
Z8 Encore!® F0830 Series Product Specification 5. Enable the timer interrupt, if appropriate and set the timer interrupt priority by writing to the relevant interrupt registers. By default, the timer interrupt is generated for both input capture and Reload events. If appropriate, configure the timer interrupt to be generated only at the input capture event or the reload event by setting the TICONFIG field of the TxCTL1 Register. 6. Configure the associated GPIO port pi n for the timer input alternate function. 7. Write to the Timer Control Register to enable the timer and initiate counting. In CAPTURE Mode, the elapsed time between the timer start and the capture event can be calculated using the following equation: CAPTURE RESTART Mode In CAPTURE RESTART Mode, the current timer count value is recorded when the acceptable external timer input transition occurs. The capture count value is written to the timer PWM High and Low Byte registers. The timer input is the system clock. The TPOL bit in the Timer Control Register determines whether the capture occurs on a rising edge or a falling edge of the timer input signal. When the capture event occurs, an interrupt is generated and the count value in the Timer High and Low Byte registers is reset to 0001H and counting resumes. The INPCAP bit in the TxCTL1 Register is set to indicate that the timer interrupt has been caused by an input capture event. If no capture event occurs, the timer counts up to 16-bit compare value stored in the Timer Reload High and Low Byte registers. Upon reaching the reload value, the timer generates an interrupt, the count value in the Timer High and Low Byte registers is reset to 0001H and counting resumes. The INPCAP bit in the TxCTL1 Register is cleared to indicate that the timer interrupt has not been caused by an input capture event. Observe the following steps for configuring a timer for CAPTURE RESTART Mode and for initiating the count: 1. Write to the Timer Control Register to: – Disable the timer – Configure the timer for CAPTURE R ESTART Mode; setting the mode also involves writing to TMODEHI bit in the TxCTL1 Register – Set the prescale value – Set the capture edge (rising or falling) for the timer input 2. Write to the Timer High and Low Byte regi sters to set the starting count value (typi- cally 0001H). Capture Elapsed Time (s) Capture Value Start Value– Prescale
Z8 Encore!® F0830 Series Product Specification 3. Write to the Timer Reload High and Low Byte registers to set the reload value. 4. Clear the timer PWM High and Low Byte registers to 0000H. This allows user soft- ware to determine if interrupts are generated by either a capture event or a reload. If the PWM High and Low Byte registers still contain 0000H after the interrupt, the interrupt were generated by a reload. 5. Enable the timer interrupt, if appropriate and set the timer interrupt priority by writing to the relevant interrupt registers. By default, the timer interrupt is generated for both input capture and Reload events. The user can configure the timer interrupt to be gen- erated only at the input capture event or the reload event by setting the TICONFIG field of the TxCTL1 Register. 6. Configure the associated GPIO port pi n for the timer input alternate function. 7. Write to the Timer Control Register to enable the timer and initiate counting. In CAPTURE Mode, the elapsed time between the timer start and the capture event can be calculated using the following equation: COMPARE Mode In COMPARE Mode, the timer counts up to 16-bit maximum compare value stored in the Timer Reload High and Low Byte registers. The timer input is the system clock. Upon reaching the compare value, the timer generates an interrupt and counting continues (the timer value is not reset to 0001H). Additionally, if the timer output alternate function is enabled, the timer output pin changes state (from Low to High or from High to Low) upon compare. If the timer reaches FFFFH, the timer resets to 0000H and continues counting. Observe the following steps for configuring a timer for COMPARE Mode and for initiat- ing the count: 1. Write to the Timer Control Register to: – Disable the timer – Configure the timer for COMPARE Mode – Set the prescale value – Set the initial logic level (High or Low) for the timer output alternate function 2. Write to the Timer High and Low Byte registers to set the starting count value. 3. Write to the Timer Reload High and Low Byte registers to set the compare value. Capture Elapsed Time (s) Capture Value Start Value– Prescale
Z8 Encore!® F0830 Series Product Specification 4. Enable the timer interrupt and set the timer interrupt priority by writing to the relevant interrupt registers. 5. If using the timer output function, configur e the associated GPIO port pin for the timer output alternate function. 6. Write to the Timer Control Register to enable the timer and initiate counting. In COMPARE Mode, the system clock always provides the timer input. The compare time can be calculated by the following equation: GATED Mode In GATED Mode, the timer counts only when the timer input signal is in its active state (asserted), as determined by the TPOL bit in the Timer Control Register. When the timer input signal is asserted, counting begins. A timer interrupt is generated when the timer input signal is deasserted or a timer reload occurs. To determine whether the timer input signal deassertion generated the interrupt, read the associated GPIO input value and com- pare to the value stored in the TPOL bit. The timer counts up to the 16-bit reload value stored in the Timer Reload High and Low Byte registers. The timer input is the system clock. Upon reaching the reload value, the timer generates an interrupt, the count value in the Timer High and Low Byte registers is reset to 0001H and counting resumes (assuming the timer input signal remains asserted). Additionally, if the timer output alternate function is enabled, the timer output pin changes state (from Low to High or from High to Low) at timer reset. Observe the following steps for configuring a timer for GATED Mode and for initiating the count: 1. Write to the Timer Control Register to: – Disable the timer – Configure the timer for GATED Mode – Set the prescale value 2. Write to the Timer High and Low Byte registers to set the starting count value. Writing these registers only affects the first pass in GATED Mode. After the first timer reset in GATED Mode, counting always begins at the reset value of 0001H. 3. Write to the Timer Reload High and Low Byte registers to set the reload value. 4. Enable the timer interrupt and set the timer interrupt priority by writing to the relevant interrupt registers. By default, the timer interrupt is generated for both input deasser- Compare Mode Time (s) Compare Value Start Value– Prescale
Z8 Encore!® F0830 Series Product Specification tion and reload events. The user can configure the timer interrupt to be generated only at the input deassertion event or the reload event by setting the TICONFIG field of the TxCTL1 Register. 5. Configure the associated GPIO port pi n for the timer input alternate function. 6. Write to the Timer Control Re gister to enable the timer. 7. Assert the timer input signal to initiate the counting. CAPTURE/COMPARE Mode In CAPTURE/COMPARE Mode, the timer begins counting on the first external timer input transition. The acceptable transition (rising edge or falling edge) is set by the TPOL bit in the Timer Control Register. The timer input is the system clock. Every subsequent acceptable transition (after the first) of the timer input signal, captures the current count value. The capture value is written to the timer PWM High and Low Byte registers. When the capture event occurs, an interrupt is generated, the count value in the Timer High and Low Byte registers is reset to 0001H and the counting resumes. The INPCAP bit in the TxCTL1 Register is set to indicate that the timer interrupt is caused by an input capture event. If no capture event occurs, the timer counts up to the 16-bit compare value stored in the Timer Reload High and Low Byte registers. Upon reaching the compare value, the timer generates an interrupt, the count value in the Timer High and Low Byte registers is reset to 0001H and counting resumes. The INPCAP bit in the TxCTL1 Register is cleared to indi- cate that the timer interrupt has not been caused by an input capture event. Observe the following steps for configuring a timer for CAPTURE/COMPARE Mode and for initiating the count: 1. Write to the Timer Control Register to: – Disable the timer – Configure the timer for CAPTURE/COMPARE Mode. – Set the prescale value. – Set the capture edge (rising or falling) for the timer input. 2. Write to the Timer High and Low Byte regi sters to set the starting count value (typi- cally 0001H). 3. Write to the Timer Reload High and Low Byte registers to set the compare value. 4. Enable the timer interrupt and set the timer interrupt priority by writing to the relevant interrupt registers.By default, the timer interrupt are generated for both input capture and Reload events. The user can configure the timer interrupt to be generated only at the input capture event or the reload event by setting TICONFIG field of the TxCTL1 Register. 5. Configure the associated GPIO port pi n for the timer input alternate function.
Z8 Encore!® F0830 Series Product Specification 6. Write to the Timer Control Re gister to enable the timer. 7. Counting begins on the first appropriate tr ansition of the timer input signal. No inter- rupt is generated by the first edge. In CAPTURE/COMPARE Mode, the elapsed time from timer start to capture event can be calculated using the following equation: Reading the Timer Count Values The current count value in the timers can be read while counting (enabled). This capability has no effect on Timer operation. When the timer is enabled and the Timer High Byte Reg- ister is read, the contents of the timer low byte register are placed in a holding register. A subsequent read from the timer low byte register returns the value in the holding register. This operation allows accurate reads of the full 16-bit timer count value when enabled. When the timers are not enabled, a read from the timer low byte register returns the actual value in the counter. Timer Pin Signal Operation Timer output is a GPIO port pin alternate function. The timer output is toggled every time the counter is reloaded. The timer input can be used as a selectable counting source. It shares the same pin as the complementary timer output. When selected by the GPIO alternate function registers, this pin functions as a timer input in all modes except for the DUAL PWM OUTPUT Mode. For this mode, no timer input is available. Capture Elapsed Time (s) Capture Value Start Value– Prescale
This section defines the features of the following Timer Control registers. the timer is disabled, a read from the TxL reads the TxL Register content directly. or Low byte) at the next clock edge. The counter continues counting from the new value. Table 50. Timer 0–1 High Byte Register (TxH) Table 51. Timer 0–1 Low Byte Register (TxL)
PS025113-1212 Timer Control Register Definitions Z8 Encore!® F0830 Series Product Specification Bit Description [7:0] TH, TL Timer High and Low Bytes These 2 bytes, {TH[7:0], TL[7:0]}, contain the current 16-bit timer count value.
registers store the 16-bit compare value. Table 52. Timer 0–1 Reload High Byte Register (TxRH) Table 53. Timer 0–1 Reload Low Byte Register (TxRL) bytes form the 16-bit compare value.
for the CAPTURE and CAPTURE/COMPARE modes. Table 54. Timer 0–1 PWM High Byte Register (TxPWMH) Table 55. Timer 0–1 PWM Low Byte Register (TxPWML) value is set by the TPOL bit in the Timer Control Register (TxCTL1). ing in capture or CAPTURE/COMPARE modes.
recent timer interrupt is caused by an input capture event. Table 56. Timer 0–1 Control Register 0 (TxCTL0) TxCTL1 Register description on the next page for additional details. This field configures timer interrupt definition. 0x = Timer interrupt occurs on all of the defined reload, compare and input events. 10 = Timer interrupt occurs only on defined input capture/deassertion events. 11 = Timer interrupt occurs only on defined reload/compare events. This bit is reserved and must be programmed to 0. before the timer output and the timer output complement are forced to their Active state.
value, and determine the timer operating mode. 0 = Previous timer interrupt is not caused by timer input capture event. 1 = Previous timer interrupt is caused by timer input capture event. Table 57. Timer 0–1 Control Register 1 (TxCTL1)
PS025113-1212 Timer Control Register Definitions Z8 Encore!® F0830 Series Product Specification [6] TPOL Timer Input/Output Polarity Operation of this bit is a function of the current operating mode of the timer. ONE-SHOT Mode When the timer is disabled, the timer output signal is set to the value of this bit. When the timer is enabled, the timer output signal is complemented on timer reload. CONTINUOUS Mode When the timer is disabled, the timer output signal is set to the value of this bit. When the timer is enabled and reloaded, the timer output signal is complemented. COUNTER Mode If the timer is disabled, the timer output signal is set to the value of this bit. If the timer is enabled the timer output signal is complemented after timer reload. 0 = Count occurs on the rising edge of the timer input signal. 1 = Count occurs on the falling edge of the timer input signal. PWM SINGLE OUTPUT Mode 0 = Timer output is forced Low (0), when the timer is disabled. The timer output is forced High (1) when the timer is enabled and the PWM count matches and the timer output is forced Low (0) when the timer is enabled and reloaded. 1 = Timer output is forced High (1), when the timer is disabled. The timer output is forced low(0), when the timer is enabled and the PWM count matches and forced High (1) when the timer is enabled and reloaded. CAPTURE Mode 0 = Count is captured on the rising edge of the timer input signal. 1 = Count is captured on the falling edge of the timer input signal. COMPARE Mode When the timer is disabled, the timer output signal is set to the value of this bit. When the timer is enabled and reloaded, the timer output signal is complemented. GATED Mode 0 = Timer counts when the timer input signal is High (1) and interrupts are generated on the falling edge of the timer input. 1 = Timer counts when the timer input signal is Low (0) and interrupts are generated on the ris- ing edge of the timer input. CAPTURE/COMPARE Mode 0 = Counting is started on the first rising edge of the timer input signal. The current count is captured on subsequent rising edges of the timer input signal. 1 = Counting is started on the first falling edge of the timer input signal. The current count is captured on subsequent falling edges of the timer input signal. Bit Description (Continued)
PS025113-1212 Timer Control Register Definitions Z8 Encore!® F0830 Series Product Specification [6] TPOL (cont’d) PWM DUAL OUTPUT Mode 0 = Timer output is forced Low (0) and timer output complement is forced High (1), when the timer is disabled. When enabled and the PWM count matches, the timer output is forced High (1) and forced Low (0) when enabled and reloaded. When enabled and the PWM count matches, the timer output complement is forced Low (0) and forced High (1) when enabled and reloaded. 1 = Timer output is forced High (1) and timer output complement is forced Low (0) when the timer is disabled. When enabled and the PWM count matches, the timer output is forced Low (0) and forced High (1) when enabled and reloaded.When enabled and the PWM count matches, the timer output complement is forced High (1) and forced Low (0) when enabled and reloaded. The PWMD field in the TxCTL0 register determines an optional added delay on the assertion (Low to High) transition of both timer output and timer output complement for deadband generation. CAPTURE RESTART Mode 0 = Count is captured on the rising edge of the timer input signal. 1 = Count is captured on the falling edge of the timer input signal. COMPARATOR COUNTER Mode When the timer is disabled, the timer output signal is set to the value of this bit. When the timer is enabled, the timer output signal is complemented on timer reload. Caution: When the timer output alternate function TxOUT on a GPIO port pin is enabled, TxOUT will change to whatever state the TPOL bit is in. The timer does not need to be enabled for that to happen. Additionally, the port data direction sub register is not needed to be set to output on TxOUT. Changing the TPOL bit when the timer is enabled and running does not immediately change the polarity TxOUT. [5:3] PRES Prescale Value The timer input clock is divided by 2 PRES, where PRES can be set from 0 to 7. The prescaler is reset each time the timer is disabled. This reset ensures proper clock division each time the timer is restarted. 000 = Divide by 1. 001 = Divide by 2. 010 = Divide by 4. 011 = Divide by 8. 100 = Divide by 16. 101 = Divide by 32. 110 = Divide by 64. 111 = Divide by 128. Bit Description (Continued)
PS025113-1212 Timer Control Register Definitions Z8 Encore!® F0830 Series Product Specification [2:0] TMODE Timer Mode This field along with the TMODEHI bit in TxCTL0 register determines the operating mode of the timer. TMODEHI is the most significant bit of the timer mode selection value. 0000 = ONE-SHOT Mode. 0001 = CONTINUOUS Mode. 0010 = COUNTER Mode. 0011 = PWM SINGLE OUTPUT Mode. 0100 = CAPTURE Mode. 0101 = COMPARE Mode. 0110 = GATED Mode. 0111 = CAPTURE/COMPARE Mode. 1000 = PWM DUAL OUTPUT Mode. 1001 = CAPTURE RESTART Mode. 1010 = COMPARATOR COUNTER Mode. Bit Description (Continued)
- On-chip RC oscillator
- A selectable time-out response: reset or interrupt
- 24-bit programmable time-out value Operation The Watchdog Timer is a retriggerable one-shot timer that resets or interrupts the Z8 Encore! F0830 Series devices when the WDT reaches its terminal count. The WDT uses a dedicated on-chip RC oscillator as its clock source. The WDT operates only in two modes: ON and OFF. Once enabled, it always counts and must be refreshed to prevent a time-out. Perform an enable by executing the WDT instruction or by setting the WDT_AO Flash option bit. The WDT_AO bit forces the WDT to operate immediately on reset, even if a WDT instruction has not been executed. The Watchdog Timer is a 24-bit reloadable downcounter that uses three 8-bit registers in the eZ8 CPU register space to set the reload value. The nominal WDT time-out period is calculated using the following equation: where the WDT reload value is the 24-bit decimal value provided by {WDTU[7:0], WDTH[7:0], WDTL[7:0]} and the typical Watchdog Timer RC oscillator frequency is 10 KHz. The Watchdog Timer cannot be refreshed after it reaches 000002H. The WDT reload value must not be set to values below 000004H. Table 58 provides information about approximate time-out delays for the minimum and maximum WDT reload values.
Table 58. Watchdog Timer Approximate Time-Out Delays
Z8 Encore!® F0830 Series Product Specification Watchdog Timer Refresh Upon first enable, the Watchdog Timer is loaded with the value in the Watchdog Timer Reload registers. The Watchdog Timer counts down to 000000H unless a WDT instruc- tion is executed by the eZ8 CPU. Execution of the WDT instruction causes the downcoun- ter to be reloaded with the WDT reload value stored in the Watchdog Timer Reload registers. Counting resumes following the Reload operation. When the Z8 Encore! F0830 Series devices are operating in DEBUG Mode (using the On- Chip Debugger), the Watchdog Timer must be continuously refreshed to prevent any WDT time-outs. Watchdog Timer Time-Out Response The Watchdog Timer times out when the counter reaches 000000H. A time-out of the Watchdog Timer generates either an interrupt or a system reset. The WDT_RES Flash option bit determines the time-out response of the Watchdog Timer. See the Flash Option Bits chapter on page 124 for information about programming the WDT_RES Flash option bit. WDT Interrupt in Normal Operation If configured to generate an interrupt when a time-out occurs, the Watchdog Timer issues an interrupt request to the Interrupt Controller and sets the WDT status bit in the Reset Status Register. If interrupts are enabled, the eZ8 CPU responds to the interrupt request by fetching the Watchdog Timer interrupt vector and executing code from the vector address. After time-out and interrupt generation, the Watchdog Timer counter resets to its maxi- mum value of FFFFFH and continues counting. The Watchdog Timer counter will not automatically return to its reload value. The Reset Status Register (see Table 12 on page 29) must be read before clearing the WDT interrupt. This read clears the WDT time-out flag and prevents further WDT inter- rupts occurring immediately. WDT Interrupt in STOP Mode If configured to generate an interrupt when a time-out occurs and the Z8 Encore! F0830 Series devices are in STOP Mode, the Watchdog Timer automatically initiates a Stop Mode Recovery and generates an interrupt request. Both the WDT status bit and the STOP bit in the Watchdog Timer Control Register are set to 1 following a WDT time-out in STOP Mode. See the Reset and Stop Mode Recovery chapter on page 21 for more infor- mation about Stop Mode Recovery operations. If interrupts are enabled, following completion of the Stop Mode Recovery, the eZ8 CPU responds to the interrupt request by fetching the Watchdog Timer interrupt vector and exe- cutes the code from the vector address.
Z8 Encore!® F0830 Series Product Specification WDT Reset in Normal Operation If configured to generate a reset when a time-out occurs, the Watchdog Timer forces the device into the System Reset state. The WDT status bit in the Watchdog Timer Control Register is set to 1. See the Reset and Stop Mode Recovery chapter on page 21 for more information about system reset operations. WDT Reset in STOP Mode If configured to generate a reset when a time-out occurs and the device is in STOP Mode, the Watchdog Timer initiates a Stop Mode Recovery. Both the WDT status bit and the STOP bit in the Watchdog Timer Control Register are set to 1 following WDT time-out in STOP Mode. See the Reset and Stop Mode Recovery chapter on page 21 for more infor- mation about Stop Mode Recovery operations. Watchdog Timer Reload Unlock Sequence Writing the unlock sequence to the Watchdog Timer (WDTCTL) Control Register address, unlocks the three Watchdog Timer Reload Byte registers (WDTU, WDTH and WDTL) to allow changes to the time-out period. These write operations to the WDTCTL Register address produce no effect on the bits in the WDTCTL Register. The locking mechanism prevents spurious writes to the reload registers. The following sequence is required to unlock the Watchdog Timer Reload Byte registers (WDTU, WDTH and WDTL) for write access: 1. Write 55H to the Watchdog Timer Control Register (WDTCTL). 2. Write AAH to the Watchdog Timer Control Register (WDTCTL). 3. Write the Watchdog Timer Reload Upper Byte Register (WDTU). 4. Write the Watchdog Timer Reload High Byte Register (WDTH). 5. Write the Watchdog Timer Relo ad Low Byte Register (WDTL). All three Watchdog Timer Reload registers must be written in the order listed above. There must be no other register writes between each of these operations. If a register write occurs, the lock state machine resets and no further writes can occur unless the sequence is restarted. The value in the Watchdog Timer Reload registers is loaded into the counter when the Watchdog Timer is first enabled and every time a WDT instruction is executed.
This section defines the features of the following Watchdog Timer Control registers. writes to the reload registers. This register address is shared with the read-only Reset Status Register. Table 59. Watchdog Timer Control Register (WDTCTL) allowed to modify the contents of the Watchdog Timer Reload registers.
current Watchdog Timer count value. The 24-bit WDT reload value must not be set to a value less than 000004H. Table 60. Watchdog Timer Reload Upper Byte Register (WDTU) Note: *A read returns the current WDT count valu e; a write sets the appropriate reload value. Most significant byte (MSB), Bits[23:16], of the 24-bit WDT reload value. Table 61. Watchdog Timer Reload High Byte Register (WDTH) Note: *A read returns the current WDT count valu e; a write sets the appropriate reload value. Middle byte, bits[15:8] of the 24-bit WDT reload value.
Table 62. Watchdog Timer Reload Low Byte Register (WDTL) Note: *A read returns the current WDT count valu e; a write sets the appropriate reload value. Least significant byte (LSB), bits[7:0] of the 24-bit WDT reload value.
PS025113-1212 Analog-to-Digital Converter Z8 Encore!® F0830 Series Product Specification Analog-to-Digital Converter The Z8 Encore! MCU includes an eight-channel Successive Approximation Register (SAR) Analog-to-Digital Converter (ADC). The ADC converts an analog input signal to a 10-bit binary number. The features of the SAR ADC include:
- Eight analog input sources multiplexed with general purpose I/O ports
- Fast conversion time, less than 11.9 µs
- Programmable timing controls
- Interrupt on conversion complete
- Internal voltage reference generator
- Ability to select external reference voltage
- When configuring an ADC using external VREF, PB5 is used as VREF in the 28-pin package Architecture The ADC architecture, displayed in Figure 11, consists of an 8-input multiplexer, sample- and-hold amplifier and 10-bit SAR ADC. The ADC digitizes the signal on a selected channel and stores the digitized data in the ADC data registers. In an environment with high electrical noise, an external RC filter must be added at the input pins to reduce high- frequency noise. TCONV = TS/H + TCON TCONV = TS + TH + 13 * SCLK * 16 where: SCLK = System Clock TCONV = Total conversion time TS = Sample time (SCLK * ADCST) TCON = Conversion time (13 * SCLK * 16) TH = Hold time (SCLK * ADCSST) DIV = 16 (fixed to divide by 16 for F0830 Series products) Example: For an F0830 Series MCU running @ 20 MHz: TCONV = 1µs + 0.5µs + 13 * SCLK * DIV TCONV = 1 µs + 0.5 µs + 13 * (1/20 MHz) * 16 = 11.9 µs
ware to the ADC Control Register’s start bit. read to determine ADC operation status (busy or available). Figure 11. Analog-to-Digital Converter Block Diagram
PS025113-1212 ADC Control Register Definitions Z8 Encore!® F0830 Series Product Specification 101 ADC Interrupt The ADC can generate an interrupt request when a conversion has been completed. An interrupt request that is pending when the ADC is disabled is not cleared automatically. Reference Buffer The reference buffer, RBUF, supplies the reference voltage for the ADC. When enabled, the internal voltage reference generator supplies the ADC. When RBUF is disabled, the ADC must have the reference voltage supplied externally through the VREF pin in 28-pin package. RBUF is controlled by the REFEN bit in the ADC Control Register. Internal Voltage Reference Generator The internal voltage reference generator provides the voltage VR2, for the RBUF. VR2 is 2 V . Calibration and Compensation A user can perform calibration and store the values into Flash or the user code can perform a manual offset calibration. There is no provision for manual gain calibration. ADC Control Register Definitions The ADC Control registers are defined in this section.
Table 63. ADC Control Register 0 (ADCCTL0) This bit is reserved and must be programmed to 0. 0 = ADC is disabled for low power operation. 1 = ADC is enabled for normal use. This bit is reserved and must be programmed to 0. 000 = ANA0 input is selected for analog to digital conversion. 001 = ANA1 input is selected for analog to digital conversion. 010 = ANA2 input is selected for analog to digital conversion. 011 = ANA3 input is selected for analog to digital conversion. 100 = ANA4 input is selected for analog to digital conversion. 101 = ANA5 input is selected for analog to digital conversion. 110 = ANA6 input is selected for analog to digital conversion. 111 = ANA7 input is selected for analog to digital conversion.
Data High Byte Register latches data in the ADC Low Bits Register. High Byte Register latches lower bits of the ADC in the ADC Data Low Bits Register. Table 64. ADC Data High Byte Register (ADCD_H) Table 65. ADC Data Low Bits Register (ADCD_L) These bits are reserved and must be programmed to 000000.
Table 66. Sample Settling Time (ADCSST) These bits are reserved and must be programmed to 0000. 0h–Fh = Sample settling time in number of system clock periods to meet 0.5 µs minimum.
Table 67. Sample Time (ADCST) These bits are reserved and must be programmed to 00. 0h–Fh = Sample-hold time in number of system clock periods to meet 1 µs minimum.
Z8 Encore!® F0830 Series Product Specification 106 Comparator The Z8 Encore! F0830 Series devices feature a general purpose comparator that compares two analog input signals. A GPIO (CINP) pin provides the positive comparator input. The negative input (CINN) can be taken from either an external GPIO pin or from an internal reference. The output is available as an interrupt source or can be routed to an external pin using the GPIO multiplex. The comparator includes the following features:
- Positive input is connected to a GPIO pin
- Negative input can be connected to either a GPIO pin or a programmable internal ref- erence
- Output can be either an interrupt source or an output to an external pin Operation One of the comparator inputs can be connected to an internal reference that is a user- selectable reference and is user-programmable with 200 mV resolution. The comparator can be powered down to save supply current. For details, see the Power Control Register 0 section on page 31. As a result of the propagation delay of the comparator, Zilog does not recommend en- abling the comparator without first disabling interrupts and waiting for the comparator output to settle. This delay prevents spurious interrupts after comparator enabling. The following example shows how to safely enable the comparator: di ld cmp0,r0; load some new configuration nop nop ; wait for output to settle clr irq0 ; clear any spurious interrupts pending ei Caution:
Table 68. Comparator Control Register (CMP0) This bit is reserved and must be programmed to 0. 0 = internal reference disabled, GPIO pin used as negative comparator input. 1 = internal reference enabled as negative comparator input. This reference is independent of the ADC voltage reference. These bits are reserved and must be programmed to 00.
either user code or through the On-Chip Debugger. (8 KB device) or three pages (12 KB device). Table 69. Z8 Encore! F0830 Series Flash Memory Configuration Figure 14. 1K Flash with NVDS
Figure 17. 8K Flash with NVDS
bits to prevent the user from writing to the eZ8 CPU data memory address space. Figure 18. 12K Flash without NVDS
program memory data. Access to the Flash information area is read-only. Table 70. Z8F083 Flash Memory Area Map
Figure 19. Flash Controller Operation Flow Chart
Z8 Encore!® F0830 Series Product Specification 114 Flash Operation Timing Using the Flash Frequency Registers Before performing either a Program or Erase operation on Flash memory, the user must first configure the Flash Frequency High and Low Byte registers. The Flash frequency registers allow programming and erasing of the Flash with system clock frequencies rang- ing from 10 kHz to 20 MHz. The Flash Frequency High and Low Byte registers combine to form a 16-bit value, FFREQ, to control the timing for Flash Program and Erase operations. The 16-bit binary Flash fre- quency value must contain the system clock frequency (in kHz). This value is calculated using the following equation: Flash programming and erasure are not supported for system clock frequencies below 10 kHz or above 20 MHz. The Flash Frequency High and Low Byte registers must be loaded with the correct value to ensure operation of the Z8 Encore! F0830 Series devices. Flash Code Protection Against External Access The user code contained within Flash memory can be protected against external access by using the On-Chip Debugger. Programming the FRP Flash option bit prevents reading of the user code using the On-Chip Debugger. For more information, see the Flash Option Bits chapter on page 124 and the On-Chip Debugger chapter on page 139. Flash Code Protection Against Accidental Program and Erasure The Z8 Encore! F0830 Series provides several levels of protection against accidental pro- gram and erasure of the Flash memory contents. This protection is provided by a combina- tion of the Flash option bits, the register locking mechanism, the page select redundancy and the sector level protection control of the Flash Controller. Flash Code Protection Using the Flash Option Bits The FHSWP and FWP Flash option bits combine to provide three levels of Flash program memory protection, as listed in Table 71. See the Flash Option Bits chapter on page 124 for more information. FFREQ[15:0] System Clock Frequency (Hz) Caution:
becomes active. See Figure 19 for details. tected. Any other value written to the Flash Control Register locks the Flash Controller. Mass erase is not allowed in the user code, but is allowed through the debug port. to enable sector protection. Table 71. Flash Code Protection using the Flash Option Bits through the On-Chip Debugger.
Z8 Encore!® F0830 Series Product Specification 116 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 can no longer be written or erased. After setting a bit in the Sector Protect Register, the bit cannot be cleared by the user. 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 enabled, all of the program memory locations are available for byte programming. In contrast, when the Flash Controller is unlocked and page erase is successfully enabled, only the locations of the selected page are available for byte programming. An erased Flash byte contains all 1’s (FFH). The programming opera- tion 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), which is available for download on www.zilog.com, for the description 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 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. The byte at each address within Flash memory cannot be programmed (any bits written to 0) more than twice before an erase cycle occurs. Caution:
Z8 Encore!® F0830 Series Product Specification 117 Page Erase Flash memory can be erased one page (512 bytes) at a time. Page erasing Flash memory sets all bytes in that page to the value FFH. The Flash Page Select Register identifies the page to be erased. Only a page residing in an unprotected sector can be erased. With the Flash Controller unlocked and the active page set, writing the value 95h to the Flash Con- trol Register initiates the Page Erase operation. While the Flash Controller executes the Page Erase operation, the eZ8 CPU idles, but the system clock and on-chip peripherals continue to operate. The eZ8 CPU resumes operation after the page erase operation com- pletes. If the Page Erase operation is performed using the On-Chip Debugger, poll the Flash Status Register to determine when the Page Erase operation is complete. When the page erase is complete, the Flash Controller returns to its Locked state. Mass Erase Flash memory can also be mass erased using the Flash Controller, but only by using the On-Chip Debugger. Mass erasing Flash memory sets all bytes to the value FFH. With the Flash Controller unlocked and the mass erase successfully enabled, writing the value 63H to the Flash Control Register initiates the Mass Erase operation. While the Flash Control- ler executes the Mass Erase operation, the eZ8 CPU idles, but the system clock and on- chip peripherals continue to operate. Using the On-Chip Debugger, poll the Flash Status Register to determine when the Mass Erase operation is complete. When the mass erase is complete, the Flash Controller returns to its Locked state. Flash Controller Bypass The Flash Controller can be bypassed; instead, the control signals for Flash memory can be brought out to the GPIO pins. Bypassing the Flash Controller allows faster row pro- gramming algorithms by controlling the Flash programming signals directly. Row programing is recommended for gang programming applications and large volume customers who do not require in-circuit initial programming of Flash memory. Mass Erase and Page Erase operations are also supported, when the Flash Controller is bypassed. For more information about bypassing the Flash Controller, refer to Third-Party Flash Programming Support for Z8 Encore!. This document is available for download at www.zilog.com Flash Controller Behavior in Debug Mode The following behavioral changes can be observed in the Flash Controller when the Flash Controller is accessed using the On-Chip Debugger:
- The Flash write protect option bit is ignored.
PS025113-1212 NVDS Operational Requirements Z8 Encore!® F0830 Series Product Specification 118
- The Flash Sector Protect Register is ignored for programming and Erase operations.
- Programming operations are not limited to the page selected in the page select register.
- Bits in the Flash Sector Protect Register can be written to one or zero.
- The second write of the page select register to unlock the Flash Controller is not necessary.
- The page select register can be written when the Flash Controller is unlocked.
- The mass erase command is enabled through the Flash Control Register For security reasons, Flash Controller allows only a single page to be opened for write/ erase. When writing multiple Flash pages, the Flash Controller must go through the un- lock sequence again to select another page. NVDS Operational Requirements The device uses a 12 KB Flash memory space, despite the maximum specified Flash size of 8 KB (with the exception of 12 KB mode with non-NVDS). User code accesses the lower 8 KB of Flash, leaving the upper 4 KB for proprietary (for Zilog-only) memory. The NVDS is implemented by using this proprietary memory space for special-purpose rou- tines and for the data required by these routines, which are factory-programmed and can- not be altered by the user. The NVDS operation is described in detail in the Nonvolatile Data Storage chapter on page 134. The NVDS routines are triggered by a user code: CALL into proprietary memory. Code executing from this proprietary memory must be able to read and write other locations within proprietary memory. User code must not be able to read or write proprietary mem- ory. Flash Control Register Definitions This section defines the features of the following Flash Control registers. Flash Control Register: see page 119 Flash Status Register: see page 120 Flash Page Select Register: see page 121 Flash Sector Protect Register: see page 122 Flash Frequency High and Low Byte Registers: see page 123 Caution:
an invalid value or an invalid sequence returns the Flash Controller to its Locked state. Table 72. Flash Control Register (FCTL) 8CH = Second unlock command. 95H = Page erase command (must be third command in sequence to initiate page erase). 63H = Mass erase command (must be third command in sequence to initiate mass erase). 5EH = Enable Flash Sector Protect Register access.
with the write-only Flash Control Register. Table 73. Flash Status Register (FSTAT) These bits are reserved and must be programmed to 00. 000000 = Flash Controller locked. 000001 = First unlock command received (73H written). 000010 = Second unlock command received (8CH written). 000011 = Flash Controller unlocked. 000100 = Sector protect register selected. 001xxx = Program operation in progress. 010xxx = Page Erase operation in progress. 100xxx = Mass Erase operation in progress.
will target the Flash Page Select Register. FPS[6:0] are chosen for program/erase operations. Table 74. Flash Page Select Register (FPS) 0 = Information area is not selected. address space at addresses FE00H through FFFFH. must always be 0. For Z8F01xx devices, the upper five bits must always be 0.
your F0830 Series product, please refer to Table 70 on page 112. Table 75. Flash Sector Protect Register (FPROT) F0830 Series product, please refer to Table 69 and to Figures 14 through 18. Note: x indicates bits in the range 7–0.
to form a 16-bit value, FFREQ, to control timing for Flash program and erase operations. loaded with the correct value to ensure proper operation of the device. Table 76. Flash Frequency High Byte Register (FFREQH) High byte of the 16-bit Flash frequency value. Table 77. Flash Frequency Low Byte Register (FFREQL) Low byte of the 16-bit Flash frequency value.
PS025113-1212 Flash Option Bits Z8 Encore!® F0830 Series Product Specification 124 Flash Option Bits Programmable Flash option bits allow user configuration of certain aspects of Z8 Encore! F0830 Series operation. The feature configuration data is stored in the Flash program memory and read during reset. The features available for control through the Flash option bits are:
- Watchdog Timer time-out response selection–interrupt or system reset
- Watchdog Timer enabled at reset
- The ability to prevent unwanted read access to user code in program memory
- The ability to prevent accidental programming and erasure of all or a portion of the user code in program memory
- V oltage Brown-Out configuration always enabled or disabled during STOP Mode to re- duce STOP Mode power consumption
- OSCILLATOR Mode selection for high, medium and low power crystal oscillators or external RC oscillator
- Factory trimming information for the Internal Precision Oscillator and VBO voltage Operation This section describes the type and configuration of the programmable Flash option bits. Option Bit Configuration by Reset Each time the Flash option bits are programmed or erased, the device must be reset for the change to be effective. During any Reset operation (system reset or Stop Mode Recovery), the Flash option bits are automatically read from Flash program memory and written to the Option Configuration registers, which control Z8 Encore! F0830 Series device operation. Option bit control is established before the device exits reset and the eZ8 CPU begins code execution. The Option Configuration registers are not part of the register file and are not accessible for read or write access.
Z8 Encore!® F0830 Series Product Specification 125 Option Bit Types This section describes the two types of Flash option bits offered in the F0830 Series. User Option Bits The user option bits are contained in the first two bytes of program memory. User access to these bits is provided because these locations contain application specific device config- urations. The information contained here is lost when page 0 of program memory is erased. Trim Option Bits The trim option bits are contained in the information page of the Flash memory. These bits are factory programmed values required to optimize the operation of onboard analog cir- cuitry and cannot be permanently altered by the user. Program memory can be erased without endangering these values. It is possible to alter working values of these bits by accessing the trim bit address and data registers, but these working values are lost after a power loss. There are 32 bytes of trim data. To modify one of these values, the user code must first write a value between 00H and 1FH into the Trim Bit Address Register. The next write to the Trim Bit Data Register changes the working value of the target trim data byte. Reading the trim data requires the user code to write a value between 00H and 1FH into the Trim Bit Address Register. The next read from the Trim Bit Data Register returns the working value of the target trim data byte. The trim address range is from information address 20–3F only. The remaining informa- tion page is not accessible via the Trim Bit Address and Data registers. During reset, the first 43 system clock cycles perform 43 Flash accesses. The six bits of the counter provide the lower six bits of the Flash memory address. All other address bits are set to 0. The option bit registers use the 6-bit address from the counter as an address and latch the data from the Flash on the positive edge of the IPO clock, allowing for a maximum of 344-bits (43 bytes) of option information to be read from Flash. Because option information is stored in both the first two bytes of program memory and in the information area of Flash memory, the data must be placed in specific locations to be read correctly. In this case, the first two bytes at addresses 0 and 1 in program memory are read out and the remainder of the bytes are read out of the Flash information area. Note:
This section briefly describes the features of the Trim Bit Address and Data registers. at addresses 20h–3Fh, as shown in Table 79. Table 78. Trim Bit Address Register (TRMADR) Table 79. Trim Bit Address Map
for the user-programmable Flash option bits. See Tables 81 and 82. Table 80. Trim Bit Data Register (TRMDR) Table 81. Flash Option Bits at Program Memory Address 0000H Note: U = Unchanged by Reset. R/W = Read/Write. enabled for the eZ8 CPU to acknowledge the interrupt request. 00 = On-chip oscillator configured for use with external RC networks (<4 MHz). 01 = Minimum power for use with very low frequency crystals (32 kHz to 1.0 MHz). default setting for unprogrammed (erased) Flash.
is the default setting for unprogrammed (erased) Flash. the default setting for unprogrammed (erased) Flash. This bit is reserved and must be programmed to 1. This option bit provides Flash program memory protection. 1 = Programming, page erase and mass erase are enabled for all Flash program memory. Table 82. Flash Options Bits at Program Memory Address 0001H Note: U = Unchanged by Reset. R/W = Read/Write. These bits are reserved and must be programmed to 11.
PS025113-1212 Trim Bit Address Space Z8 Encore!® F0830 Series Product Specification 129 Trim Bit Address Space All available trim bit addresses and their functions are listed in Tables 83 through 90. [4] XTLDIS State of the Crystal Oscillator at Reset This bit enables only the crystal oscillator. Selecting the crystal oscillator as the system clock must be performed manually. 0 = The crystal oscillator is enabled during reset, resulting in longer reset timing. 1 = The crystal oscillator is disabled during reset, resulting in shorter reset timing. [3:0] Reserved These bits are reserved and must be programmed to 1111. Bit Description (Continued)
The bit values used in Table 84 are set at the factory; no calibration is required. Table 83. Trim Bit Address Space Table 84. Trim Option Bits at 0000H (ADCREF) Note: U = Unchanged by Reset. R/W = Read/Write. Contains trimming bits for ADC reference voltage. These bits are reserved and must be programmed to 111. Table 85. Trim Option Bits at 0001H (TADC_COMP) Note: U = Unchanged by Reset. R/W = Read/Write. Altering this register may result in incorrect device operation.
The bit values used in Table 85 are set at the factory; no calibration is required. The bit values used in Table 86 are set at the factory; no calibration is required. Table 86. Trim Option Bits at 0002H (TIPO) Note: U = Unchanged by Reset. R/W = Read/Write. Contains trimming bits for the Internal Precision Oscillator. Table 87. Trim Option Bits at 0003H (TVBO) Note: U = Unchanged by Reset. R/W = Read/Write. These bits are reserved and must be programmed to 11111. Contains factory-trimmed values for the oscillator and the VBO.
The bit values used in Table 87 are set at the factory; no calibration is required. Table 88. VBO Trim Definition Table 89. Trim Option Bits at 0006H (TCLKFLT) Note: U = Unchanged by Reset. R/W = Read/Write. 0 = Output frequency is input frequency. 1 = Output frequency is 1/4 of the input frequency. This bit is reserved and must be programmed to 1. This bit is reserved and must be programmed to 1. Notes: x indicates bit values 3–1; y indicates bit values 1–0.
The bit values used in Table 89 are set at factory and no calibration is required. 2-bit selection for the clock filter mode. 01 = Filter low level noise on high level signal. 10 = Filter high level noise on low level signal. Table 90. ClkFlt Delay Control Definition Note: The variation is about 30%. Notes: x indicates bit values 3–1; y indicates bit values 1–0.
PS025113-1212 Nonvolatile Data Storage Z8 Encore!® F0830 Series Product Specification 134 Nonvolatile Data Storage Z8 Encore! F0830 Series devices contain a Nonvolatile Data Storage (NVDS) element of up to 64 bytes (except when in Flash 12 KB mode). This type of memory can perform over 100,000 write cycles. Operation NVDS is implemented by special-purpose Zilog software stored in areas of program mem- ory that are not user-accessible. These special-purpose routines use Flash memory to store the data, and incorporate a dynamic addressing scheme to maximize the write/erase endur- ance of the Flash. The products in the Z8 Encore! F0830 Series feature multiple NVDS array sizes. See the Z8 Encore! F0830 Series Family Part Selection Guide section on page 2 for details. NVDS Code Interface Two routines are required to access the NVDS: a write routine and a read routine. Both of these routines are accessed with a CALL instruction to a predefined address outside of pro- gram memory that is accessible to the user. Both the NVDS address and data are single- byte values. In order to not disturb the user code, these routines save the working register set before using it so that 16 bytes of stack space are required to preserve the site. After finishing the call to these routines, the working register set of the user code is recovered. During both read and write accesses to the NVDS, interrupt service is not disabled. Any interrupts that occur during NVDS execution must not disturb the working register and existing stack contents; otherwise, the array can become corrupted. Zilog recommends the user disable interrupts before executing NVDS operations. Use of the NVDS requires 16 bytes of available stack space. The contents of the working register set are saved before calling NVDS read or write routines. For correct NVDS operation, the Flash Frequency registers must be programmed based on the system clock frequency. See the Flash Operation Timing Using the Flash Frequency Registers section on page 114. Note:
user code should pop the address and data bytes off the stack. data pushed by the user code. Sufficient memory must be available for this stack usage. effect. Illegal write operations have a 7 µs execution time. Table 91. Write Status Byte These bits are reserved and must be programmed to 00000. If a Flash error is detected, this bit is set to 1.
To read a byte from the NVDS array, user code must first push the address onto the stack. Table 92. Additionally, the user code should pop the address byte off the stack. by the user code. Sufficient memory must be available for this stack usage. Due to the Flash memory architecture, NVDS reads exhibit a nonuniform execution time. A read operation takes between 71 µs and 258 µs (assuming a 20 MHz system clock). Slower system clock speeds result in proportionally higher execution times. 0xff. Illegal read operations have a 6 µs execution time. that does not have an error. Table 92. Read Status Byte These bits are reserved and must be programmed to 000. address, this bit is set to 1. NVDS source code steps forward until it finds valid data at this address. This bit is reserved and must be programmed to 0. If a Flash error is detected, this bit is set to 1. This bit is reserved and must be programmed to 0.
the Trim Bit Address Space section on page 129). by 0.8 µs up to a maximum of 258 µs. write takes up to 58 ms to complete. code for speed by using either of the two methods listed below.
- Periodically refresh all addresses that are used; this is the more useful method. The
addresses planned for use, thereby bringing all reads closer to the minimum read time. Table 93. NVDS Read Time
PS025113-1212 NVDS Code Interface Z8 Encore!® F0830 Series Product Specification 138 Because the minimum read time is much less than the write time, however, actual speed benefits are not always realized. 2. Use as few unique addresses as possible to optimize the impact of refreshing.
- Reading and writing of the register file
- Reading and writing of program and data memory
- Setting of breakpoints and watchpoints
- Executing eZ8 CPU instructions Architecture The On-Chip Debugger consists of four primary functional blocks: transmitter, receiver, autobaud detector/generator and debug controller. Figure 20 displays the architecture of the On-Chip Debugger.
Figure 20. On-Chip Debugger Block Diagram
- The eZ8 CPU fetch unit stops, idling the eZ8 CPU, unless directed by the OCD to ex- ecute specific instructions
- The system clock operates, unless the device is in STOP Mode
- All enabled on-chip peripherals operate, unless the device is in STOP Mode
- Automatically exits HALT Mode
- Constantly refreshes the Watchdog Timer, if enabled Entering DEBUG Mode
- The device enters DEBUG Mode after the eZ8 CPU executes a Breakpoint (BRK) in- struction
- If the DBG pin is held low during the most recent clock cycle of system reset, the de- vice enters DEBUG Mode on exiting system reset Exiting DEBUG Mode The device exits DEBUG Mode following any of these operations:
- Clearing the DBGMODE bit in the OCD Control Register to 0
- Power-On Reset
- V oltage Brown-Out reset
Figure 22. Interfacing the On-Chip Debugger’s DBG Pin with an RS-232 Interface, #2 of 2
Z8 Encore!® F0830 Series Product Specification 143 If the OCD receives a serial break (nine or more continuous bits low), the autobaud detec- tor/generator resets. Reconfigure the autobaud detector/generator by sending 80H. OCD Serial Errors The OCD can detect any of the following error conditions on the DBG pin:
- Serial break (a minimum of nine continuous bits Low)
- Framing error (received Stop bit is Low)
- Transmit collision (simultaneous transmission by OCD and host detected by the OCD) When the OCD detects one of these errors, it aborts any command currently in progress, transmits a four character long serial break back to the host and resets the autobaud detec- tor/generator. A framing error or transmit collision may be caused by the host sending a serial break to the OCD. As a result of the open-drain nature of the interface, returning a serial break back to the host only extends the length of the serial break if the host releases the serial break early. The host transmits a serial break on the DBG pin when first connecting to the Z8 Encore! F0830 Series devices or when recovering from an error. A serial break from the host resets the autobaud generator/detector, but does not reset the OCD Control Register. A serial break leaves the device in DEBUG Mode, if that is the current mode. The OCD is held in reset until the end of the serial break when the DBG pin returns high. Because of the open- drain nature of the DBG pin, the host can send a serial break to the OCD even if the OCD is transmitting a character. Breakpoints Execution breakpoints are generated using the BRK instruction (opcode 00H). When the eZ8 CPU decodes a BRK instruction, it signals the OCD. If breakpoints are enabled, the OCD enters DEBUG Mode and idles the eZ8 CPU. If breakpoints are not enabled, the OCD ignores the BRK signal and the BRK instruction operates as an NOP instruction. Breakpoints in Flash Memory The BRK instruction is opcode 00H, which corresponds to the fully programmed state of a byte in Flash memory. To implement a breakpoint, write 00H to the required break address overwriting the current instruction. To remove a breakpoint, the corresponding page of Flash memory must be erased and reprogrammed with the original data.
ing when it enters DEBUG Mode again or when it reaches the maximum count of FFFFH. control registers are protected by programming the Flash read protect option bit (FRP). products. When this option is enabled, several of the OCD commands are disabled. commands that are disabled by programming the FRP. Table 95. On-Chip Debugger Command Summary
host is identified by DBG Data. and execute instruction commands. return the device to normal operating mode, the device must be reset. Table 95. On-Chip Debugger Command Summary (Continued)
PS025113-1212 On-Chip Debugger Commands Z8 Encore!® F0830 Series Product Specification 146 Read OCD Control Register (05H). The read OCD Control Register command reads the value of the OCDCTL register. DBG ← 05H DBG → OCDCTL[7:0] Write Program Counter (06H). The write program counter command, writes the data that follows to the eZ8 CPU’s program counter (PC). If the device is not in DEBUG Mode or if the Flash read protect option bit is enabled, the program counter (PC) values are discarded. DBG ← 06H DBG ← ProgramCounter[15:8] DBG ← ProgramCounter[7:0] Read Program Counter (07H). The read program counter command, reads the value in the eZ8 CPUs program counter (PC). If the device is not in DEBUG Mode or if the Flash read protect option bit is enabled, this command returns FFFFH. DBG ← 07H DBG → ProgramCounter[15:8] DBG → ProgramCounter[7:0] Write Register (08H). The write register command, writes data to the register file. Data can be written 1–256 bytes at a time (256 bytes can be written by setting size to 0). If the device is not in DEBUG Mode, the address and data values are discarded. If the Flash read protect option bit is enabled, only writes to the Flash control registers are allowed and all other register write data values are discarded. DBG ← 08H DBG ← {4’h0,Register Address[11:8]} DBG ← Register Address[7:0] DBG ← Size[7:0] DBG ← 1–256 data bytes Read Register (09H). The read register command, reads data from the register file. Data can be read 1–256 bytes at a time (256 bytes can be read by setting size to 0). If the device is not in DEBUG Mode or if the Flash read protect option bit is enabled, this command returns FFH for all of the data values. DBG ← 09H DBG ← {4’h0,Register Address[11:8] DBG ← Register Address[7:0] DBG ← Size[7:0] DBG → 1–256 data bytes Write Program Memory (0AH). The write program memory command, writes data to program memory. This command is equivalent to the LDC and LDCI instructions. Data can be written 1–65536 bytes at a time (65536 bytes can be written by setting size to 0). The on-chip Flash Controller must be written to and unlocked for the programming operation to occur. If the Flash Controller is not unlocked, the data is discarded. If the device is not in DEBUG Mode or if the Flash read protect option bit is enabled, the data is discarded.
PS025113-1212 On-Chip Debugger Commands Z8 Encore!® F0830 Series Product Specification 147 DBG ← 0AH DBG ← Program Memory Address[15:8] DBG ← Program Memory Address[7:0] DBG ← Size[15:8] DBG ← Size[7:0] DBG ← 1–65536 data bytes Read Program Memory (0BH). The read program memory command, reads data from program memory. This command is equivalent to the LDC and LDCI instructions. Data can be read 1–65536 bytes at a time (65536 bytes can be read by setting size to 0). If the device is not in DEBUG Mode or if the Flash read protect option bit is enabled, this com- mand returns FFH for the data. DBG ← 0BH DBG ← Program Memory Address[15:8] DBG ← Program Memory Address[7:0] DBG ← Size[15:8] DBG ← Size[7:0] DBG → 1–65536 data bytes Write Data Memory (0CH). The write data memory command, writes data to data mem- ory. This command is equivalent to the LDE and LDEI instructions. Data can be written 1–65536 bytes at a time (65536 bytes can be written by setting size to 0). If the device is not in DEBUG Mode or if the flash read protect option bit is enabled, the data is discarded. DBG ← 0CH DBG ← Data Memory Address[15:8] DBG ← Data Memory Address[7:0] DBG ← Size[15:8] DBG ← Size[7:0] DBG ← 1–65536 data bytes Read Data Memory (0DH). The read data memory command, reads from data memory. This command is equivalent to the LDE and LDEI instructions. Data can be read from 1 to 65536 bytes at a time (65536 bytes can be read by setting size to 0). If the device is not in DEBUG Mode, this command returns FFH for the data. DBG ← 0DH DBG ← Data Memory Address[15:8] DBG ← Data Memory Address[7:0] DBG ← Size[15:8] DBG ← Size[7:0] DBG → 1–65536 data bytes Read Program Memory CRC (0EH). The read program memory CRC command, com- putes and returns the cyclic redundancy check (CRC) of program memory using the 16-bit CRC-CCITT polynomial. If the device is not in DEBUG Mode, this command returns FFFFH for the CRC value. Unlike the other OCD read commands, there is a delay from issuing of the command until the OCD returns the data. The OCD reads program memory, calculates the CRC value and returns the result. The delay is a function of program mem-
PS025113-1212 On-Chip Debugger Control Register Definitions Z8 Encore!® F0830 Series Product Specification 148 ory size and is approximately equal to the system clock period multiplied by the number of bytes in program memory. DBG ← 0EH DBG → CRC[15:8] DBG → CRC[7:0] Step Instruction (10H). The step instruction command, steps one assembly instruction at the current program counter (PC) location. If the device is not in DEBUG Mode or the Flash read protect option bit is enabled, the OCD ignores this command. DBG ← 10H Stuff Instruction (11H). The stuff instruction command, steps one assembly instruction and allows specification of the first byte of the instruction. The remaining 0–4 bytes of the instruction are read from program memory. This command is useful for stepping over instructions where the first byte of the instruction has been overwritten by a breakpoint. If the device is not in DEBUG Mode or the Flash read protect option bit is enabled, the OCD ignores this command. DBG ← 11H DBG ← opcode[7:0] Execute Instruction (12H). The execute instruction command allows sending an entire instruction to be executed to the eZ8 CPU. This command can also step over breakpoints. The number of bytes to send for the instruction depends on the opcode. If the device is not in DEBUG Mode or the Flash read protect option bit is enabled, this command reads and discards one byte. DBG ← 12H DBG ← 1–5 byte opcode On-Chip Debugger Control Register Definitions This section describes the features of the On-Chip Debugger Control and Status registers. OCD Control Register The OCD Control Register controls the state of the On-Chip Debugger. This register is used to enter or exit DEBUG Mode and to enable the BRK instruction. It can also reset the Z8 Encore! F0830 Series device. A reset and stop function can be achieved by writing 81H to this register. A reset and go function can be achieved by writing 41H to this register. If the device is in DEBUG Mode, a run function can be implemented by writing 40H to this register.
Table 96. OCD Control Register (OCDCTL) 0 = The Z8 Encore! F0830 Series device is operating in NORMAL Mode. 1 = The Z8 Encore! F0830 Series device is in DEBUG Mode. 0 = Breakpoints are disabled. 1 = Breakpoints are enabled. Debug acknowledge character (FFH) to the host when a breakpoint occurs. 0 = Debug acknowledge is disabled. 1 = Debug acknowledge is enabled. These bits are reserved and must be programmed to 0000. bit is automatically cleared to 0 at the end of the reset sequence. 1 = Reset the Flash read protect option bit device.
Table 97. OCD Status Register (OCDSTAT) 0 = FRP bit enabled, that allows disabling of many OCD commands. These bits are reserved and must be programmed to 00000.
PS025113-1212 Oscillator Control Z8 Encore!® F0830 Series Product Specification 151 Oscillator Control The Z8 Encore! F0830 Series device uses five possible clocking schemes. Each one of these is user-selectable.
- On-chip precision trimmed RC oscillator
- On-chip oscillator using off-chip crystal or resonator
- On-chip oscillator using external RC network
- External clock drive
- On-chip low precision Watchdog Timer Oscillator In addition, Z8 Encore! F0830 Series devices contain clock failure detection and recovery circuitry, allowing continued operation despite a failure of the primary oscillator. Operation This chapter discusses the logic used to select the system clock and handle primary oscil- lator failures. A description of the specific operation of each oscillator is outlined further in this document. System Clock Selection The oscillator control block selects from the available clocks. Table 98 describes each clock source and its usage.
block employs a register unlocking/locking scheme. sible to write to or read from other registers within the unlocking/locking operation. Table 98. Oscillator Configuration and Selection
- 32.8 kHz or 5.53 MHz
- ± 4% accuracy when trimmed
- No external components required
- Unlock and write to the Oscillator Con- trol Register (OSCCTL) to enable and select oscillator at either 5.53 MHz or 32.8 kHz External crystal/res- onator
- 32 kHz to 20 MHz
- Very high accuracy (dependent on crystal or resonator used)
- Requires external components
- Configure Flash option bits for correct external OSCILLATOR Mode
- Unlock and write OSCCTL to enable crystal oscillator, wait for it to stabilize and select as system clock (if the XTLDIS option bit has been de-asserted, no waiting is required) External RC oscilla- tor
- 32 kHz to 4 MHz
- Accuracy dependent on exter- nal components
- Configure Flash option bits for correct external OSCILLATOR Mode
- Unlock and write OSCCTL to enable crystal oscillator and select as system clock External clock drive • 0 to 20 MHz
- Accuracy dependent on exter- nal clock source
- Write GPIO registers to configure PB3 pin for external clock function
- Unlock and write OSCCTL to select external system clock
- Apply external clock signal to GPIO Internal Watchdog Timer Oscillator
- 10 kHz nominal
- ± 40% accuracy; no external compo- nents required
- Low power consumption
- Enable WDT if not enabled and wait until WDT oscillator is operating.
- Unlock and write to the Oscillator Con- trol Register (OSCCTL) to enable and select oscillator Caution:
Z8 Encore!® F0830 Series Product Specification 153 When selecting a new clock source, the primary oscillator failure detection circuitry and the Watchdog Timer Oscillator failure circuitry must be disabled. If POFEN and WOFEN are not disabled prior to a clock switch-over, it is possible to generate an interrupt for a failure of either oscillator. The failure detection circuitry can be enabled anytime after a successful write of OSCSEL in the Oscillator Control Register. The Internal Precision Oscillator is enabled by default. If the user code changes to a differ- ent oscillator, it may be appropriate to disable the IPO for power savings. Disabling the IPO does not occur automatically. Clock Failure Detection and Recovery Primary Oscillator Failure The Z8F04xA family devices can generate nonmaskable interrupt-like events when the primary oscillator fails. To maintain system function in this situation, the clock failure recovery circuitry automatically forces the Watchdog Timer Oscillator to drive the system clock. The Watchdog Timer Oscillator must be enabled to allow the recovery. Although this oscillator runs at a much slower speed than the original system clock, the CPU contin- ues to operate, allowing execution of a clock failure vector and software routines that either remedy the oscillator failure or issue a failure alert. This automatic switch-over is not available if the Watchdog Timer is the primary oscillator. It is also unavailable if the Watchdog Timer Oscillator is disabled, though it is not necessary to enable the Watchdog Timer reset function outlined in the Watchdog Timer chapter of this document. The primary oscillator failure detection circuitry asserts if the system clock frequency drops below 1 KHz ±50%. If an external signal is selected as the system oscillator, it is possible that a very slow but nonfailing clock can generate a failure condition. Under these conditions, do not enable the clock failure circuitry (POFEN must be deasserted in the OSCCTL Register). Watchdog Timer Failure In the event of failure of a Watchdog Timer Oscillator, a similar nonmaskable interrupt- like event is issued. This event does not trigger an attendant clock switch-over, but alerts the CPU of the failure. After a Watchdog Timer failure, it is no longer possible to detect a primary oscillator failure. The failure detection circuitry does not function if the Watchdog Timer is used as the primary oscillator or if the Watchdog Timer Oscillator has been dis- abled. For either of these cases, it is necessary to disable the detection circuitry by deas- serting the WDFEN bit of the OSCCTL Register. The Watchdog Timer Oscillator failure detection circuit counts system clocks while look- ing for a Watchdog Timer clock. The logic counts 8004 system clock cycles before deter- mining that a failure has occurred. The system clock rate determines the speed at which the Watchdog Timer failure is detected. A very slow system clock results in very slow detection times.
can only be recovered by power-on-reset. The following section provides the bit definitions for the Oscillator Control Register. which becomes the system clock. is locked at successful completion of a register write to the OSCCTL. to review the waiting times of various oscillator circuits. Table 99. Oscillator Control Register (OSCCTL) 1 = Internal Precision Oscillator is enabled. 0 = Internal Precision Oscillator is disabled. This setting overrides the GPIO register control for PA0 and PA1. 1 = Crystal oscillator is enabled. 0 = Crystal oscillator is disabled. 1 = Watchdog Timer Oscillator is enabled. 0 = Watchdog Timer Oscillator is disabled.
PS025113-1212 Oscillator Control Register Definitions Z8 Encore!® F0830 Series Product Specification 155 [4] POFEN Primary Oscillator Failure Detection Enable 1 = Failure detection and recovery of primary oscillator is enabled. 0 = Failure detection and recovery of primary oscillator is disabled. [3] WDFEN Watchdog Timer Oscillator Failure Detection Enable 1 = Failure detection of Watchdog Timer Oscillator is enabled. 0 = Failure detection of Watchdog Timer Oscillator is disabled. [2:0] SCKSEL System Clock Oscillator Select 000 = Internal Precision Oscillator functions as system clock at 5.53 MHz. 001 = Internal Precision Oscillator functions as system clock at 32 kHz. 010 = Crystal oscillator or external RC oscillator functions as system clock. 011 = Watchdog Timer Oscillator functions as system clock. 100 = External clock signal on PB3 functions as system clock. 101 = Reserved. 110 = Reserved. 111 = Reserved. Bit Description (Continued)
Figure 24. Oscillator Control Clock Switching Flow Chart
PS025113-1212 Crystal Oscillator Z8 Encore!® F0830 Series Product Specification 157 Crystal Oscillator The products in the Z8 Encore! F0830 Series contain an on-chip crystal oscillator for use with external crystals with 32 kHz to 20 MHz frequencies. In addition, the oscillator sup- ports external RC networks with oscillation frequencies up to 4 MHz or ceramic resonators with frequencies up to 8 MHz. The on-chip crystal oscillator can be used to generate the primary system clock for the internal eZ8 CPU and the majority of its on-chip peripherals. Alternatively, the XIN input pin can also accept a CMOS-level clock input signal (32 kHz– 20 MHz). If an external clock generator is used, the XOUT pin must remain unconnected. The on-chip crystal oscillator also contains a clock filter function. To see the settings for this clock filter, see Table 90 on page 133. By default, however, this clock filter is dis- abled; therefore, no divide to the input clock (namely, the frequency of the signal on the XIN input pin) can determine the frequency of the system clock when using the default set- tings. Although the XIN pin can be used as an input for an external clock generator, the CLKIN pin is better suited for such use. See the System Clock Selection section on page 151 for more information. Operating Modes The Z8 Encore! F0830 Series products support the following four OSCILLATOR Modes:
- Minimum power for use with very low frequency crystals (32 kHz to 1 MHz)
- Medium power for use with medium frequency crystals or ceramic resonators (0.5 MHz to 8 MHz)
- Maximum power for use with high frequency crystals (8 MHz to 20 MHz)
- On-chip oscillator configured for use with external RC networks (< 4 MHz) The OSCILLATOR Mode is selected using user-programmable Flash option bits. See the Flash Option Bits chapter on page 124 for more information. Crystal Oscillator Operation The XTLDIS Flash option bit controls whether the crystal oscillator is enabled during reset. The crystal may later be disabled after reset if a new oscillator has been selected as the system clock. If the crystal is manually enabled after reset through the OSCCTL Reg- Note:
circuit board should be included in the estimation of the oscillator frequency. capacitance values in excess of 20 pF are recommended. Figure 26. Connecting the On-Chip Oscillator to an External RC Network
old. The oscillator resumes oscillation when the supply voltage exceeds 2.7 V . Figure 27. Typical RC Oscillator Frequency as a Function of External Capacitance
PS025113-1212 Internal Precision Oscillator Z8 Encore!® F0830 Series Product Specification 161 Internal Precision Oscillator The Internal Precision Oscillator (IPO) is designed for use without external components. The user can either manually trim the oscillator for a nonstandard frequency or use the automatic factory-trimmed version to achieve a 5.53 MHz frequency with ± 4% accuracy and 45%~55% duty cycle over the operating temperature and supply voltage of the device. The maximum start-up time of the IPO is 25 µs. IPO features include:
- On-chip RC oscillator that does not require external components
- Output frequency of either 5.53 MHz or 32.8 kHz (contains both a FAST and a SLOW mode)
- Trimming possible through Flash option bits, with user override
- Elimination of crystals or ceramic resonators in applications where high timing accu- racy is not required Operation The internal oscillator is an RC relaxation oscillator with a minimized sensitivity to power supply variations. By using ratio-tracking thresholds, the effect of power supply voltage is cancelled out. The dominant source of oscillator error is the absolute variance of chip- level fabricated components, such as capacitors. An 8-bit trimming register, incorporated into the design, compensates for absolute variation of oscillator frequency. Once trimmed, the oscillator frequency is stable and does not require subsequent calibration. Trimming was performed during manufacturing and is not necessary for the user to repeat unless a frequency other than 5.53 MHz (FAST mode) or 32.8 kHz (SLOW mode) is required. The user can power down the IPO block for minimum system power. By default, the oscillator is configured through the Flash option bits. However, the user code can override these trim values, as described in the Trim Bit Address Space section on page 129. Select one of two frequencies for the oscillator: 5.53 MHz or 32.8 kHz, using the OSCSEL bits described in the Oscillator Control chapter on page 151. Note:
PS025113-1212 eZ8 CPU Instruction Set Z8 Encore!® F0830 Series Product Specification 162 eZ8 CPU Instruction Set This chapter describes the following features of the eZ8 CPU instruction set: Assembly Language Programming Introduction: see page 162 Assembly Language Syntax: see page 163 eZ8 CPU Instruction Notation: see page 164 eZ8 CPU Instruction Classes: see page 166 eZ8 CPU Instruction Summary: see page 171 Assembly Language Programming Introduction The eZ8 CPU assembly language provides a means for writing an application program without concern for actual memory addresses or machine instruction formats. A program written in assembly language is called a source program. Assembly language allows the use of symbolic addresses to identify memory locations. It also allows mnemonic codes (op codes and operands) to represent the instructions themselves. The op codes identify the instruction while the operands represent memory locations, registers or immediate data values. Each assembly language program consists of a series of symbolic commands called state- ments. Each statement contains labels, operations, operands and comments. Labels can be assigned to a particular instruction step in a source program. The label iden- tifies that step in the program as an entry point for use by other instructions. The assembly language also includes assembler directives that supplement the machine instruction. The assembler directives, or pseudo-ops, are not translated into a machine instruction. Rather, these pseudo-ops are interpreted as directives that control or assist the assembly process. The source program is processed (assembled) by the assembler to obtain a machine lan- guage program called the object code. The object code is executed by the eZ8 CPU. An example segment of an assembly language program is provided in the following example.
the operands in the order source, destination, but ordering is op code-dependent. users that prefer manual program coding or intend to implement their own assembler. JP START ; Everything after the semicolon is a comment. ; program where the START label occurs. ther Load (LD) instruction with two operands. Table 101. Assembly Language Syntax Example 1
available. The register file size varies, depending on the device type. Table 102. Assembly Language Syntax Example 2 Table 103. Notational Shorthand b Bit b b represents a value from 0 to 7 (000B to 111B).
and instruction set description sections. Assignment of a value is indicated by an arrow, as shown in the following example. Table 104. Additional Symbols Table 103. Notational Shorthand (Continued)
stored in the destination location.
- Arithmetic
- Bit manipulation
- Block transfer
- CPU control
- Load
- Logical
- Program control
- Rotate and shift Tables 105 through 112 contain the instructions belonging to each group and the number of operands required for each instruction. Some instructions appear in more than one table as these instructions can be considered as a subset of more than one category. Within these tables, the source operand is identified as src, the destination operand is dst and a condi- tion code is cc.
Table 105. Arithmetic Instructions
Table 106. Bit Manipulation Instructions Table 107. Block Transfer Instructions Table 105. Arithmetic Instructions (Continued)
Table 108. CPU Control Instructions Table 109. Load Instructions
Table 110. Logical Instructions Table 111. Program Control Instructions Table 112. Rotate and Shift Instructions
Table 112. Rotate and Shift Instructions (Continued)
required for the instruction execution. Table 113. eZ8 CPU Instruction Summary
Table 113. eZ8 CPU Instruction Summary (Continued)
A description of the opcode map data and the abbreviations are provided in Figure 28. Table 114 on page 181 lists opcode map abbreviations. Figure 28. Op Code Map Cell Description
Table 114. Op Code Map Abbreviations
Figures 29 and 30 provide information about each of the eZ8 CPU instructions. Figure 29. First Op Code Map
Figure 30. Second Op Code Map after 1FH
Z8 Encore!® F0830 Series Product Specification 184 The data in this chapter represents all known data prior to qualification and characteriza- tion of the F0830 Series of products, and is therefore subject to change. Additional electri- cal characteristics may be found in the individual chapters of this document. Absolute Maximum Ratings Stresses greater than those listed in Table 115 may cause permanent damage to the device. These ratings are stress ratings only. Operation of the device at any condition outside those indicated in the operational sections of these specifications is not implied. Exposure to absolute maximum rating conditions for extended periods may affect device reliability. For improved reliability, tie unused inputs to one of the supply voltages (VDD or VSS). Table 115. Absolute Maximum Ratings
ages are referenced to VSS, the primary system ground. Table 116. DC Characteristics
- This condition excludes all pins that have on-chip pull-ups, when driven Low.
- These values are provided for design guid ance only and are not tested in production.
- See Figure 31 for HALT Mode current.
Table 116. DC Characteristics (Continued)
- This condition excludes all pins that have on-chip pull-ups, when driven Low.
- These values are provided for design guid ance only and are not tested in production.
- See Figure 31 for HALT Mode current.
information assumes a standard load of 50 pF on all outputs. Table 117. AC Characteristics
20.0 MHz Program or erasure of
5.5296 MHz Oscillator is not adjust-
Table 118. Power-On Reset and Voltage Brown-Out Electrical Characteristics and Timing ance only and are not tested in production. Table 117. AC Characteristics (Continued)
ance only and are not tested in production.
Table 119. Flash Memory Electrical Characteristics and Timing Table 120. Watchdog Timer Electrical Characteristics and Timing
write can take up to 58 ms to complete. Table 121. Nonvolatile Data Storage
20 MHz
Table 122. Analog-to-Digital Converter Electrical Characteristics and Timing Note: 1When the input voltage is lower than 20 mV, the conversion error is out of spec.
10 External refer-
Table 123. Comparator Electrical Characteristics Table 122. Analog-to-Digital Converter Electrical Characteristics and Timing (Continued) Note: 1When the input voltage is lower than 20 mV, the conversion error is out of spec.
the eZ8 CPU on the second rising clock edge following the change of the port value. Figure 33. Port Input Sample Timing Table 124. GPIO Port Input Timing
0 Latched
Table 127. Power Consumption Reference Table Note: The values in this table are s ubject to change after characterization. Figure 36. Flash Current Diagram
Z8 Encore!® F0830 Series Product Specification 199 Packaging Zilog’s F0830 Series of MCUs includes the Z8F0130, Z8F0131, Z8F0230, Z8F0231, Z8F1232 and Z8F1233 devices, which are available in the following packages:
- 20-Pin Quad Flat No-Lead Package (QFN)
- 20-pin Small Outline Integrated Circuit Package (SOIC)
- 20-pin Plastic Dual-Inline Package (PDIP)
- 20-pin Small Shrink Outline Package (SSOP)
- 28-Pin Quad Flat No-Lead Package (QFN)
- 28-pin Small Outline Integrated Circuit Package (SOIC)
- 28-pin Plastic Dual-Inline Package (PDIP)
- 28-pin Small Shrink Outline Package (SSOP) Current diagrams for each of these packages are published in Zilog’s Packaging Product Specification (PS0072), which is available free for download from the Zilog website.
Z8 Encore!® F0830 Series Product Specification 200
Ordering Information
Order your F0830 Series products from Zilog using the part numbers shown in Table 128. For more information about ordering, please consult your local Zilog sales office. The Sales Location page on the Zilog website lists all regional offices. Table 128. Z8 Encore! XP F0830 Series Ordering Matrix
within a 0ºC to +70ºC temperature range and built using lead-free solder.
PS025113-1212 Part Number Suffix Designations Z8 Encore!® F0830 Series Product Specification 206 Z8 F 08 30 S H 020 S G Environmental Flow G = Green Plastic Packaging Compound Temperature Range S = Standard, 0°C to 70°C E = Extended, –40°C to +105°C Speed 020 = 20 MHz Pin Count* H = 20 J = 28 Package* P = PDIP Q = QFN S = SOIC H = SSOP Device Type 30 = Equipped with ADC and with NVDS. 31 = Equipped without ADC and with NVDS. 32 = Equipped with ADC and without NVDS (12 K version only). 33 = Equipped without ADC and without NVDS (12 K version only). Memory Size 12 = 12 KB Flash 08 = 8 KB Flash 04 = 4 KB Flash 02 = 2 KB Flash 01 = 1 KB Flash Memory Type F = Flash Device Family Z8 = Zilog’s 8-bit microcontroller
Table 129 lists the pin count by package. Table 129. Package and Pin Count Description
purpose random access memory, as follows. the Register File section on page 14. This address range is reserved. Definitions section on page 83. Table 130. Timer 0 High Byte Register (T0H)
Table 131. Timer 0 Low Byte Register (T0L) Table 132. Timer 0 Reload High Byte Register (T0RH) Table 133. Timer 0 Reload Low Byte Register (T0RL) Table 134. Timer 0 PWM High Byte Register (T0PWMH)
Table 135. Timer 0 PWM Low Byte Register (T0PWML) Table 136. Timer 0 Control Register 0 (T0CTL0) Table 137. Timer 0 Control Register 1 (T0CTL1) Table 138. Timer 1 High Byte Register (T1H)
Table 139. Timer 1 Low Byte Register (T1L) Table 140. Timer 1 Reload High Byte Register (T1RH) Table 141. Timer 1 Reload Low Byte Register (T1RL) Table 142. Timer 1 PWM High Byte Register (T1PWMH)
This address range is reserved. Table 143. Timer 1 PWM Low Byte Register (T1PWML) Table 144. Timer 1 Control Register 0 (T1CTL0) Table 145. Timer 1 Control Register 1 (T1CTL1)
Table 146. ADC Control Register 0 (ADCCTL0) [6] This bit is reserved and must be programmed to 0. 0 = ADC is disabled for low power operation. 1 = ADC is enabled for normal use. [3] This bit is reserved and must be programmed to 0. 000 = ANA0 input is selected for analog to digital conversion. 001 = ANA1 input is selected for analog to digital conversion. 010 = ANA2 input is selected for analog to digital conversion. 011 = ANA3 input is selected for analog to digital conversion. 100 = ANA4 input is selected for analog to digital conversion. 101 = ANA5 input is selected for analog to digital conversion. 110 = ANA6 input is selected for analog to digital conversion. 111 = ANA7 input is selected for analog to digital conversion.
This address range is reserved. Table 147. ADC Data High Byte Register (ADCD_H) Table 148. ADC Data Low Bits Register (ADCD_L) These bits are reserved and must be programmed to 000000.
This address range is reserved. Table 149. ADC Sample Settling Time (ADCSST) These bits are reserved and must be programmed to 0000. 0h–Fh = Number of system clock periods to meet 0.5 µs minimum. Table 150. ADC Sample Time (ADCST) This register is reserved and must be programmed to 0. 0h–Fh = Number of system clock periods to meet 1 µs minimum.
Definitions section on page 31. This address range is reserved. Table 151. Power Control Register 0 (PWRCTL0) Table 152. LED Drive Enable (LEDEN)
This address range is reserved. Register Definitions section on page 154. Table 153. LED Drive Level High Register (LEDLVLH) Table 154. LED Drive Level Low Register (LEDLVLL) Table 155. Oscillator Control Register (OSCCTL)
This address range is reserved. ter Definitions section on page 107. This address range is reserved. ister Definitions section on page 57. Table 156. Comparator Control Register (CMP0) Table 157. Interrupt Request 0 Register (IRQ0)
Table 158. IRQ0 Enable High Bit Register (IRQ0ENH) Table 159. IRQ0 Enable Low Bit Register (IRQ0ENL) Table 160. Interrupt Request 1 Register (IRQ1) Table 161. IRQ1 Enable High Bit Register (IRQ1ENH)
Table 162. IRQ1 Enable Low Bit Register (IRQ1ENL) Table 163. Interrupt Request 2 Register (IRQ2) Table 164. IRQ2 Enable High Bit Register (IRQ2ENH) Table 165. IRQ2 Enable Low Bit Register (IRQ2ENL)
This address range is reserved. Table 166. Interrupt Edge Select Register (IRQES) Table 167. Shared Interrupt Select Register (IRQSS) Table 168. Interrupt Control Register (IRQCTL)
Table 169. Port A GPIO Address Register (PAADDR) Table 170. Port A Control Registers (PACTL) Table 171. Port A Input Data Registers (PAIN)
Table 172. Port A Output Data Register (PAOUT) Table 173. Port B GPIO Address Register (PBADDR) Table 174. Port B Control Registers (PBCTL) Table 175. Port B Input Data Registers (PBIN)
Table 176. Port B Output Data Register (PBOUT) Table 177. Port C GPIO Address Register (PCADDR) Table 178. Port C Control Registers (PCCTL) Table 179. Port C Input Data Registers (PCIN)
This address range is reserved. Table 180. Port C Output Data Register (PCOUT) Table 181. Port D GPIO Address Register (PDADDR) Table 182. Port D Control Registers (PDCTL)
This address range is reserved. trol Register Definitions section on page 95. Table 183. Port D Output Data Register (PDOUT) Table 184. Watchdog Timer Control Register (WDTCTL) Table 185. Reset Status Register (RSTSTAT)
This address range is reserved. Table 186. Watchdog Timer Reload Upper Byte Register (WDTU) Note: *Read returns the current WDT count value; write sets the appropriate reload value. Table 187. Watchdog Timer Reload High Byte Register (WDTH) Note: *Read returns the current WDT count value; write sets the appropriate reload value. Table 188. Watchdog Timer Reload Low Byte Register (WDTL) Note: *Read returns the current WDT count value; write sets the appropriate reload value.
trol Register Definitions section on page 126. Definitions section on page 118. Table 189. Trim Bit Address Register (TRMADR) Table 190. Trim Bit Data Register (TRMDR) Table 191. Flash Control Register (FCTL)
The Flash Page Select Register is shared with the Flash Sector Protect Register. Table 192. Flash Status Register (FSTAT) Table 193. Flash Page Select Register (FPS) Table 194. Flash Sector Protect Register (FPROT) Table 195. Flash Frequency High Byte Register (FFREQH)
Table 196. Flash Frequency Low Byte Register (FFREQL)
PS025113-1212 P R E L I M I N A R Y Index Z8 Encore!® F0830 Series Product Specification 231 Index Symbols @ 165 # 165 % 165 Numerics 10-bit ADC 4 A absolute maximum ratings 184 AC characteristics 189 ADC 166 block diagram 99 overview 98 ADC Channel Register 1 (ADCCTL) 102 ADC Data High Byte Register (ADCDH) 103 ADC Data Low Bit Register (ADCDL) 103, 104, 105 ADCX 166 ADD 166 add - extended addressing 166 add with carry 166 add with carry - extended addressing 166 additional symbols 165 address space 14 ADDX 166 analog block/PWM signal synchronization 100 analog block/PWM signal zynchronization 100 analog signals 11 analog-to-digital converter overview 98 AND 169 ANDX 169 architecture voltage measurements 98 arithmetic instructions 166 assembly language programming 162 assembly language syntax 163 B B 165 b 164 BCLR 167 binary number suffix 165 BIT 167 bit 164 clear 167 manipulation instructions 167 set 167 set or clear 167 swap 167 test and jump 169 test and jump if non-zero 169 test and jump if zero 169 bit jump and test if non-zero 166 bit swap 169 block diagram 3 block transfer instructions 167 BRK 169 BSET 167 BSWAP 167, 169 BTJ 169 BTJNZ 166, 169 BTJZ 169 C calibration and compensation, motor control mea- surements 101 CALL procedure 169 capture mode 89, 90 capture/compare mode 89 cc 164 CCF 168 characteristics, electrical 184 clear 168 CLR 168 COM 169 compare 89
PS025113-1212 P R E L I M I N A R Y Index Z8 Encore!® F0830 Series Product Specification 232 compare - extended addressing 166 compare mode 89 compare with carry 166 compare with carry - extended addressing 166 complement 169 complement carry flag 167, 168 condition code 164 continuous mode 89 Control Registers 14, 17 counter modes 89 CP 166 CPC 166 CPCX 166 CPU and peripheral overview 4 CPU control instructions 168 CPX 166 current measurement architecture 98 operation 99 Customer Feedback Form 239 Customer Information 239 D DA 164, 166 data memory 16 DC characteristics 185 debugger, on-chip 139 DEC 166 decimal adjust 166 decrement 166 decrement and jump non-zero 169 decrement word 166 DECW 166 destination operand 165 device, port availability 33 DI 168 direct address 164 disable interrupts 168 DJNZ 169 dst 165 E EI 168 electrical characteristics 184 GPIO input data sample timing 195 watch-dog timer 194 electrical noise 98 enable interrupt 168 ER 164 extended addressing register 164 external pin reset 25 eZ8 CPU features 4 eZ8 CPU instruction classes 166 eZ8 CPU instruction notation 164 eZ8 CPU instruction set 162 eZ8 CPU instruction summary 171 F FCTL register 119, 126, 127, 228 features, Z8 Encore! 1 first opcode map 182 FLAGS 165 flags register 165 flash controller 4 option bit address space 127 option bit configuration - reset 124 program memory address 0000H 127 program memory address 0001H 128 flash memory 108 byte programming 116 code protection 114 configurations 108 control register definitions 118, 126 controller bypass 117 flash control register 119, 126, 127, 228 flash option bits 115 flash status register 120 flow chart 113 frequency high and low byte registers 123 mass erase 117 operation 112 operation timing 114 page erase 117
PS025113-1212 P R E L I M I N A R Y Index Z8 Encore!® F0830 Series Product Specification 233 page select register 121, 122 FPS register 121, 122 FSTAT register 120 G gated mode 89 general-purpose I/O 33 GPIO 4, 33 alternate functions 34 architecture 34 control register definitions 39 input data sample timing 195 interrupts 39 port A-C pull-up enable sub-registers 46, 47, 48 port A-H address registers 40 port A-H alternate function sub-registers 42 port A-H control registers 41 port A-H data direction sub-registers 41 port A-H high drive enable sub-registers 44 port A-H input data registers 49 port A-H output control sub-registers 43 port A-H output data registers 50, 51 port A-H stop mode recovery sub-registers 45 port availability by device 33 port input timing 195 port output timing 196 H H 165 HALT 168 halt mode 31, 168 hexadecimal number prefix/suffix 165 I IM 164 immediate data 164 immediate operand prefix 165 INC 166 increment 166 increment word 167 INCW 167 indexed 165 indirect address prefix 165 indirect register 164 indirect register pair 164 indirect working register 164 indirect working register pair 164 instruction set, ez8 CPU 162 instructions ADC 166 ADCX 166 ADD 166 ADDX 166 AND 169 ANDX 169 arithmetic 166 BCLR 167 BIT 167 bit manipulation 167 block transfer 167 BRK 169 BSET 167 BSWAP 167, 169 BTJ 169 BTJNZ 166, 169 BTJZ 169 CALL 169 CCF 167, 168 CLR 168 COM 169 CP 166 CPC 166 CPCX 166 CPU control 168 CPX 166 DA 166 DEC 166 DECW 166 DI 168 DJNZ 169 EI 168 HALT 168 INC 166 INCW 167 IRET 169
PS025113-1212 P R E L I M I N A R Y Index Z8 Encore!® F0830 Series Product Specification 234 JP 169 LD 168 LDC 168 LDCI 167, 168 LDE 168 LDEI 167 LDX 168 LEA 168 load 168 logical 169 MULT 167 NOP 168 OR 169 ORX 169 POP 168 POPX 168 program control 169 PUSH 168 PUSHX 168 RCF 167, 168 RET 169 RL 169 RLC 169 rotate and shift 169 RR 170 RRC 170 SBC 167 SCF 167, 168 SRA 170 SRL 170 SRP 168 STOP 168 SUB 167 SUBX 167 SWAP 170 TCM 167 TCMX 167 TM 167 TMX 167 TRAP 169 watch-dog timer refresh 168 XOR 169 XORX 169 instructions, eZ8 classes of 166 interrupt control register 67 interrupt controller 53 architecture 53 interrupt assertion types 56 interrupt vectors and priority 56 operation 55 register definitions 57 software interrupt assertion 57 interrupt edge select register 65 interrupt request 0 register 58 interrupt request 1 register 59 interrupt request 2 register 60 interrupt return 169 interrupt vector listing 53 IR 164 Ir 164 IRET 169 IRQ0 enable high and low bit registers 60 IRQ1 enable high and low bit registers 62 IRQ2 enable high and low bit registers 63 IRR 164 Irr 164 J JP 169 jump, conditional, relative, and relative conditional 169 L LD 168 LDC 168 LDCI 167, 168 LDE 168 LDEI 167, 168 LDX 168 LEA 168 load 168 load constant 167 load constant to/from program memory 168 load constant with auto-increment addresses 168 load effective address 168 load external data 168
PS025113-1212 P R E L I M I N A R Y Index Z8 Encore!® F0830 Series Product Specification 235 load external data to/from data memory and auto- increment addresses 167 load external to/from data memory and auto-incre- ment addresses 168 load instructions 168 load using extended addressing 168 logical AND 169 logical AND/extended addressing 169 logical exclusive OR 169 logical exclusive OR/extended addressing 169 logical instructions 169 logical OR 169 logical OR/extended addressing 169 low power modes 30 M master interrupt enable 55 memory data 16 program 15 mode capture 89, 90 capture/compare 89 continuous 89 counter 89 gated 89 one-shot 89 PWM 89, 90 modes 89 motor control measurements ADC Control register definitions 101 calibration and compensation 101 interrupts 101 overview 98 MULT 167 multiply 167 N noise, electrical 98 NOP (no operation) 168 notation b 164 cc 164 DA 164 ER 164 IM 164 IR 164 Ir 164 IRR 164 Irr 164 p 164 R 165 r 164 RA 165 RR 165 rr 165 vector 165 X 165 notational shorthand 164 O OCD architecture 139 auto-baud detector/generator 142 baud rate limits 142 block diagram 139 breakpoints 143 commands 144 control register 148 data format 142 DBG pin to RS-232 Interface 140 debug mode 141 debugger break 169 interface 140 serial errors 143 status register 150 timing 197 OCD commands execute instruction (12H) 148 read data memory (0DH) 147 read OCD control register (05H) 146 read OCD revision (00H) 145 read OCD status register (02H) 145 read program counter (07H) 146 read program memory (0BH) 147
PS025113-1212 P R E L I M I N A R Y Index Z8 Encore!® F0830 Series Product Specification 236 read program memory CRC (0EH) 147 read register (09H) 146 read runtime counter (03H) 145 step instruction (10H) 148 stuff instruction (11H) 148 write data memory (0CH) 147 write OCD control register (04H) 145 write program counter (06H) 146 write program memory (0AH) 146 write register (08H) 146 on-chip debugger (OCD) 139 on-chip debugger signals 12 on-chip oscillator 157 one-shot mode 89 opcode map abbreviations 181 cell description 180 first 182 second after 1FH 183 operation 100 current measurement 99 voltage measurement timing diagram 100 Operational Description 21, 30, 33, 53, 68, 92, 98, 106, 108, 124, 134, 139, 151, 157, 161 OR 169 ordering information 200 ORX 169 oscillator signals 12 P p 164 Packaging 199 part selection guide 2 PC 165 peripheral AC and DC electrical characteristics 190 pin characteristics 13 Pin Descriptions 7 polarity 164 POP 168 pop using extended addressing 168 POPX 168 port availability, device 33 port input timing (GPIO) 195 port output timing, GPIO 196 power supply signals 12 power-on reset (POR) 23 program control instructions 169 program counter 165 program memory 15 PUSH 168 push using extended addressing 168 PUSHX 168 PWM mode 89, 90 PxADDR register 40, 222, 223, 224, 225 PxCTL register 41, 222, 223, 224, 225 R R 165 r 164 RA register address 165 RCF 167, 168 register 165 flash control (FCTL) 119, 126, 127, 228 flash high and low byte (FFREQH and FRE- EQL) 123 flash page select (FPS) 121, 122 flash status (FSTAT) 120 GPIO port A-H address (PxADDR) 40, 222, 223, 224, 225 GPIO port A-H alternate function sub-registers GPIO port A-H control address (PxCTL) 41, 222, 223, 224, 225 GPIO port A-H data direction sub-registers 41 OCD control 148 OCD status 150 watch-dog timer control (WDTCTL) 95, 107, 154, 217, 218, 226 watchdog timer control (WDTCTL) 29 watch-dog timer reload high byte (WDTH) 227 watchdog timer reload high byte (WDTH) 96 watch-dog timer reload low byte (WDTL) 227 watchdog timer reload low byte (WDTL) 97 watch-dog timer reload upper byte (WDTU) 227
Table 134. Power Consumption Reference Table
PS025113-1212 P R E L I M I N A R Y Index Z8 Encore!® F0830 Series Product Specification 238 reload high and low byte registers 85 timer control register definitions 83 timer output signal operation 82 timers 0-3 control registers 87, 88 high and low byte registers 83, 86 TM 167 TMX 167 TRAP 169 V vector 165 voltage brown-out reset (VBR) 24 voltage measurement timing diagram 100 W watch-dog timer approximate time-out delay 92 approximate time-out delays 92, 106, 134, 151, 161 CNTL 24 control register 95, 154 electrical characteristics and timing 194 interrupt in noromal operation 93 interrupt in stop mode 93 operation 92, 106, 134, 151, 161 refresh 93 reload unlock sequence 94 reload upper, high and low registers 96 reset 25 reset in normal operation 94 reset in Stop mode 94 time-out response 93 watchdog timer refresh 168 WDTCTL register 29, 95, 107, 154, 217, 218, 226 WDTH register 96, 227 WDTL register 97, 227 working register 164 working register pair 165 WTDU register 96, 227 X X 165 XOR 169 XORX 169 Z Z8 Encore! block diagram 3 features 1 part selection guide 2
PS025113-1212 Customer Support Z8 Encore!® F0830 Series Product Specification 239 Customer Support To share comments, get your technical questions answered or report issues you may be experiencing with our products, please visit Zilog’s Technical Support page at http://support.zilog.com. To learn more about this product, find additional documentation or to discover other facets about Zilog product offerings, please visit the Zilog Knowledge Base at http://zilog.com/ kb or consider participating in the Zilog Forum at http://zilog.com/forum. This publication is subject to replacement by a later edition. To determine whether a later edition exists, please visit the Zilog website at http://www.zilog.com.