EFM8 Busy Bee Family EFM8BB1 Reference Manual
EFM8 Busy Bee Family EFM8BB1 Reference Manual
EFM8 Busy Bee Family EFM8BB1 Reference Manual
The EFM8BB1, part of the Busy Bee family of MCUs, is a multi- KEY FEATURES
purpose line of 8-bit microcontrollers with a comprehensive feature
set in small packages. • Pipelined 8-bit C8051 core with 25 MHz
maximum operating frequency
These devices offer high-value by integrating advanced analog and communication pe- • Up to 18 multifunction, 5 V tolerant I/O pins
ripherals into small packages, making them ideal for space-constrained applications. • One 12-bit Analog to Digital converter
With an efficient 8051 core, enhanced pulse-width modulation, and precision analog, the (ADC)
EFM8BB1 family is also optimal for embedded applications. • Two low-current analog comparators
Flash Program
RAM Memory Debug Interface Low Frequency
Memory Brown-Out Detector
(up to 512 bytes) with C2 RC Oscillator
(up to 8 KB)
Serial Interfaces I/O Ports Timers and Triggers Analog Interfaces Security
I2C / SMBus General Purpose I/O Watchdog Timer Internal Voltage Reference
1. System Overview
1.1 Introduction
VDD VREF
24.5 MHz
2%
Oscillator VDD
AMUX
12/10 bit
ADC
Low-Freq. Temp
Oscillator Sensor
CMOS
EXTCLK Oscillator +
-+
Input -
2 Comparators
1.2 Power
All internal circuitry draws power from the VDD supply pin. External I/O pins are powered from the VIO supply voltage (or VDD on devi-
ces without a separate VIO connection), while most of the internal circuitry is supplied by an on-chip LDO regulator. Control over the
device power can be achieved by enabling/disabling individual peripherals as needed. Each analog peripheral can be disabled when
not in use and placed in low power mode. Digital peripherals, such as timers and serial buses, have their clocks gated off and draw little
power when they are not in use.
Shutdown • All internal power nets shut down 1. Set STOPCF bit in • RSTb pin reset
• Pins retain state REG0CN • Power-on reset
• Exit on pin or power-on reset 2. Set STOP bit in
PCON0
1.3 I/O
Digital and analog resources are externally available on the device’s multi-purpose I/O pins. Port pins P0.0-P1.7 can be defined as gen-
eral-purpose I/O (GPIO), assigned to one of the internal digital resources through the crossbar or dedicated channels, or assigned to an
analog function. Port pins P2.0 and P2.1 can be used as GPIO. Additionally, the C2 Interface Data signal (C2D) is shared with P2.0.
1.4 Clocking
The CPU core and peripheral subsystem may be clocked by both internal and external oscillator resources. By default, the system
clock comes up running from the 24.5 MHz oscillator divided by 8.
The programmable counter array (PCA) provides multiple channels of enhanced timer and PWM functionality while requiring less CPU
intervention than standard counter/timers. The PCA consists of a dedicated 16-bit counter/timer and one 16-bit capture/compare mod-
ule for each channel. The counter/timer is driven by a programmable timebase that has flexible external and internal clocking options.
Each capture/compare module may be configured to operate independently in one of five modes: Edge-Triggered Capture, Software
Timer, High-Speed Output, Frequency Output, or Pulse-Width Modulated (PWM) Output. Each capture/compare module has its own
associated I/O line (CEXn) which is routed through the crossbar to port I/O when enabled.
Several counter/timers are included in the device: two are 16-bit counter/timers compatible with those found in the standard 8051, and
the rest are 16-bit auto-reload timers for timing peripherals or for general purpose use. These timers can be used to measure time inter-
vals, count external events and generate periodic interrupt requests. Timer 0 and Timer 1 are nearly identical and have four primary
modes of operation. The other timers offer both 16-bit and split 8-bit timer functionality with auto-reload and capture capabilities.
Timer 2 and Timer 3 are 16-bit timers including the following features:
• Clock sources include SYSCLK, SYSCLK divided by 12, or the External Clock divided by 8.
• 16-bit auto-reload timer mode
• Dual 8-bit auto-reload timer mode
• External pin capture (Timer 2)
• LFOSC0 capture (Timer 3)
The device includes a programmable watchdog timer (WDT) running off the low-frequency oscillator. A WDT overflow forces the MCU
into the reset state. To prevent the reset, the WDT must be restarted by application software before overflow. If the system experiences
a software or hardware malfunction preventing the software from restarting the WDT, the WDT overflows and causes a reset. Following
a reset, the WDT is automatically enabled and running with the default maximum time interval. If needed, the WDT can be disabled by
system software or locked on to prevent accidental disabling. Once locked, the WDT cannot be disabled until the next system reset.
The state of the RST pin is unaffected by this reset.
UART0 is an asynchronous, full duplex serial port offering modes 1 and 3 of the standard 8051 UART. Enhanced baud rate support
allows a wide range of clock sources to generate standard baud rates. Received data buffering allows UART0 to start reception of a
second incoming data byte before software has finished reading the previous data byte.
The serial peripheral interface (SPI) module provides access to a flexible, full-duplex synchronous serial bus. The SPI can operate as a
master or slave device in both 3-wire or 4-wire modes, and supports multiple masters and slaves on a single SPI bus. The slave-select
(NSS) signal can be configured as an input to select the SPI in slave mode, or to disable master mode operation in a multi-master
environment, avoiding contention on the SPI bus when more than one master attempts simultaneous data transfers. NSS can also be
configured as a firmware-controlled chip-select output in master mode, or disabled to reduce the number of pins required. Additional
general purpose port I/O pins can be used to select multiple slave devices in master mode.
The SMBus I/O interface is a two-wire, bi-directional serial bus. The SMBus is compliant with the System Management Bus Specifica-
tion, version 1.1, and compatible with the I2C serial bus.
The cyclic redundancy check (CRC) module performs a CRC using a 16-bit polynomial. CRC0 accepts a stream of 8-bit data and posts
the 16-bit result to an internal register. In addition to using the CRC block for data manipulation, hardware can automatically CRC the
flash contents of the device.
The CRC module is designed to provide hardware calculations for flash memory verification and communications protocols. The CRC
module supports the standard CCITT-16 16-bit polynomial (0x1021), and includes the following features:
• Support for CCITT-16 polynomial
• Byte-level bit reversal
• Automatic CRC of flash contents on one or more 256-byte blocks
• Initial seed selection of 0x0000 or 0xFFFF
1.7 Analog
The ADC is a successive-approximation-register (SAR) ADC with 12-, 10-, and 8-bit modes, integrated track-and hold and a program-
mable window detector. The ADC is fully configurable under software control via several registers. The ADC may be configured to
measure different signals using the analog multiplexer. The voltage reference for the ADC is selectable between internal and external
reference sources.
• Up to 16 external inputs.
• Single-ended 12-bit and 10-bit modes.
• Supports an output update rate of 200 ksps samples per second in 12-bit mode or 800 ksps samples per second in 10-bit mode.
• Operation in low power modes at lower conversion speeds.
• Asynchronous hardware conversion trigger, selectable between software, external I/O and internal timer sources.
• Output data window comparator allows automatic range checking.
• Support for burst mode, which produces one set of accumulated data per conversion-start trigger with programmable power-on set-
tling and tracking time.
• Conversion complete and window compare interrupts supported.
• Flexible output data formatting.
• Includes an internal fast-settling reference with two levels (1.65 V and 2.4 V) and support for external reference and signal ground.
• Integrated temperature sensor.
Analog comparators are used to compare the voltage of two analog inputs, with a digital output indicating which input voltage is higher.
External input connections to device I/O pins and internal connections are available through separate multiplexers on the positive and
negative inputs. Hysteresis, response time, and current consumption may be programmed to suit the specific needs of the application.
Reset circuitry allows the controller to be easily placed in a predefined default condition. On entry to this reset state, the following occur:
• The core halts program execution.
• Module registers are initialized to their defined reset values unless the bits reset only with a power-on reset.
• External port pins are forced to a known state.
• Interrupts and timers are disabled.
All registers are reset to the predefined values noted in the register descriptions unless the bits only reset with a power-on reset. The
contents of RAM are unaffected during a reset; any previously stored data is preserved as long as power is not lost. The Port I/O latch-
es are reset to 1 in open-drain mode. Weak pullups are enabled during and after the reset. For Supply Monitor and power-on resets,
the RSTb pin is driven low until the device exits the reset state. On exit from the reset state, the program counter (PC) is reset, and the
system clock defaults to an internal oscillator. The Watchdog Timer is enabled, and program execution begins at location 0x0000.
1.9 Debugging
The EFM8BB1 devices include an on-chip Silicon Labs 2-Wire (C2) debug interface to allow flash programming and in-system debug-
ging with the production part installed in the end application. The C2 interface uses a clock signal (C2CK) and a bi-directional C2 data
signal (C2D) to transfer information between the device and a host system. See the C2 Interface Specification for details on the C2
protocol.
1.10 Bootloader
All devices come pre-programmed with a UART bootloader. This bootloader resides in flash and can be erased if it is not needed.
2. Memory Organization
The memory organization of the CIP-51 System Controller is similar to that of a standard 8051. There are two separate memory
spaces: program memory and data memory. Program and data memory share the same address space but are accessed via different
instruction types. Program memory consists of a non-volatile storage area that may be used for either program code or non-volatile
data storage. The data memory, consisting of "internal" and "external" data space, is implemented as RAM, and may be used only for
data storage. Program execution is not supported from the data memory space.
The CIP-51 core has a 64 KB program memory space. The product family implements some of this program memory space as in-sys-
tem, re-programmable flash memory. Flash security is implemented by a user-programmable location in the flash block and provides
read, write, and erase protection. All addresses not specified in the device memory map are reserved and may not be used for code or
data storage.
The MOVX instruction in an 8051 device is typically used to access external data memory. On the devices, the MOVX instruction is
normally used to read and write on-chip XRAM, but can be re-configured to write and erase on-chip flash memory space. MOVC in-
structions are always used to read flash memory, while MOVX write instructions are used to erase and write flash. This flash access
feature provides a mechanism for the product to update program code and use the program memory space for non-volatile data stor-
age.
The RAM space on the chip includes both an "internal" RAM area which is accessed with MOV instructions, and an on-chip "external"
RAM area which is accessed using MOVX instructions. Total RAM varies, based on the specific device. The device memory map has
more details about the specific amount of RAM available in each area for the different device variants.
Internal RAM
There are 256 bytes of internal RAM mapped into the data memory space from 0x00 through 0xFF. The lower 128 bytes of data memo-
ry are used for general purpose registers and scratch pad memory. Either direct or indirect addressing may be used to access the lower
128 bytes of data memory. Locations 0x00 through 0x1F are addressable as four banks of general purpose registers, each bank con-
sisting of eight byte-wide registers. The next 16 bytes, locations 0x20 through 0x2F, may either be addressed as bytes or as 128 bit
locations accessible with the direct addressing mode.
The upper 128 bytes of data memory are accessible only by indirect addressing. This region occupies the same address space as the
Special Function Registers (SFR) but is physically separate from the SFR space. The addressing mode used by an instruction when
accessing locations above 0x7F determines whether the CPU accesses the upper 128 bytes of data memory space or the SFRs. In-
structions that use direct addressing will access the SFR space. Instructions using indirect addressing above 0x7F access the upper
128 bytes of data memory.
The lower 32 bytes of data memory, locations 0x00 through 0x1F, may be addressed as four banks of general-purpose registers. Each
bank consists of eight byte-wide registers designated R0 through R7. Only one of these banks may be enabled at a time. Two bits in
the program status word (PSW) register, RS0 and RS1, select the active register bank. This allows fast context switching when entering
subroutines and interrupt service routines. Indirect addressing modes use registers R0 and R1 as index registers.
In addition to direct access to data memory organized as bytes, the sixteen data memory locations at 0x20 through 0x2F are also ac-
cessible as 128 individually addressable bits. Each bit has a bit address from 0x00 to 0x7F. Bit 0 of the byte at 0x20 has bit address
0x00 while bit 7 of the byte at 0x20 has bit address 0x07. Bit 7 of the byte at 0x2F has bit address 0x7F. A bit access is distinguished
from a full byte access by the type of instruction used (bit source or destination operands as opposed to a byte source or destination).
The MCS-51™ assembly language allows an alternate notation for bit addressing of the form XX.B where XX is the byte address and B
is the bit position within the byte. For example, the instruction:
Mov C, 22.3h
moves the Boolean value at 0x13 (bit 3 of the byte at location 0x22) into the Carry flag.
Stack
A programmer's stack can be located anywhere in the 256-byte data memory. The stack area is designated using the Stack Pointer
(SP) SFR. The SP will point to the last location used. The next value pushed on the stack is placed at SP+1 and then SP is incremen-
ted. A reset initializes the stack pointer to location 0x07. Therefore, the first value pushed on the stack is placed at location 0x08, which
is also the first register (R0) of register bank 1. Thus, if more than one register bank is to be used, the SP should be initialized to a
location in the data memory not being used for data storage. The stack depth can extend up to 256 bytes.
External RAM
On devices with more than 256 bytes of on-chip RAM, the additional RAM is mapped into the external data memory space (XRAM).
Addresses in XRAM area accessed using the external move (MOVX) instructions.
Note: The 16-bit MOVX write instruction is also used for writing and erasing the flash memory. More details may be found in the flash
memory section.
0xFFFF
Reserved
0x2000
0x1FFF Lock Byte
0x1FFE
Security Page
512 Bytes
0x1E00
8 KB Flash
(16 x 512 Byte pages)
0x0000
0xFFFF
Reserved
0x1000
0x0FFF Lock Byte
0x0FFE
Security Page
512 Bytes
0x0E00
4 KB Flash
(8 x 512 Byte pages)
0x0000
0xFFFF
Reserved
0x0800
0x07FF Lock Byte
0x07FE
Security Page
512 Bytes
0x0600
2 KB Flash
(4 x 512 Byte pages)
0x0000
On-Chip RAM
Accessed with MOV Instructions as Indicated
0xFF
Upper 128 Bytes Special Function
RAM Registers
(Indirect Access) (Direct Access)
0x80
0x7F
0x30
0x2F
Bit-Addressable
0x20
0x1F
General-Purpose Register Banks
0x00
On-Chip XRAM
Accessed with MOVX Instructions
0xFFFF
Shadow XRAM
Duplicates 0x0000-0x00FF
On 256 B boundaries
0x0100
0x00FF
XRAM
256 Bytes
0x0000
The direct-access data memory locations from 0x80 to 0xFF constitute the special function registers (SFRs). The SFRs provide control
and data exchange with the CIP-51's resources and peripherals. The CIP-51 duplicates the SFRs found in a typical 8051 implementa-
tion as well as implementing additional SFRs used to configure and access the sub-systems unique to the MCU. This allows the addi-
tion of new functionality while retaining compatibility with the MCS-51™ instruction set.
The SFR registers are accessed anytime the direct addressing mode is used to access memory locations from 0x80 to 0xFF. SFRs
with addresses ending in 0x0 or 0x8 (e.g., P0, TCON, SCON0, IE, etc.) are bit-addressable as well as byte-addressable. All other SFRs
are byte-addressable only. Unoccupied addresses in the SFR space are reserved for future use. Accessing these areas will have an
indeterminate effect and should be avoided.
B 0xF0 B Register
4. Flash Memory
4.1 Introduction
On-chip, re-programmable flash memory is included for program code and non-volatile data storage. The flash memory is organized in
512-byte pages. It can be erased and written through the C2 interface or from firmware by overloading the MOVX instruction. Any indi-
vidual byte in flash memory must only be written once between page erase operations.
0xFFFF
Reserved
0x2000
0x1FFF Lock Byte
0x1FFE
Security Page
512 Bytes
0x1E00
8 KB Flash
(16 x 512 Byte pages)
0x0000
0xFFFF
Reserved
0x1000
0x0FFF Lock Byte
0x0FFE
Security Page
512 Bytes
0x0E00
4 KB Flash
(8 x 512 Byte pages)
0x0000
0xFFFF
Reserved
0x0800
0x07FF Lock Byte
0x07FE
Security Page
512 Bytes
0x0600
2 KB Flash
(4 x 512 Byte pages)
0x0000
4.2 Features
The CIP-51 provides security options to protect the flash memory from inadvertent modification by software as well as to prevent the
viewing of proprietary program code and constants. The Program Store Write Enable (bit PSWE in register PSCTL) and the Program
Store Erase Enable (bit PSEE in register PSCTL) bits protect the flash memory from accidental modification by software. PSWE must
be explicitly set to 1 before software can modify the flash memory; both PSWE and PSEE must be set to 1 before software can erase
flash memory. Additional security features prevent proprietary program code and data constants from being read or altered across the
C2 interface.
A Security Lock Byte located in flash user space offers protection of the flash program memory from access (reads, writes, or erases)
by unprotected code or the C2 interface. See the specific device memory map for the location of the security byte. The flash security
mechanism allows the user to lock "n" flash pages, starting at page 0, where "n" is the 1s complement number represented by the
Security Lock Byte.
Note: The page containing the flash Security Lock Byte is unlocked when no other flash pages are locked (all bits of the Lock Byte are
1) and locked when any other flash pages are locked (any bit of the Lock Byte is 0).
1s Complement 00000010b
Flash Pages Locked 3 (First two flash pages + Lock Byte Page)
The level of flash security depends on the flash access method. The three flash access methods that can be restricted are reads,
writes, and erases from the C2 debug interface, user firmware executing on unlocked pages, and user firmware executing on locked
pages.
Target Area for Read / Write / Erase Unlocked User Locked User Page Unlocked Data Locked Data Page
Page Page
Any Unlocked Page [R] [W] [E] [R] [W] [E] [R] [W] [E] [R] [W] [E]
Locked Page (except security page) reset [R] [W] [E] reset [R] [W] [E]
Device Erase Only = No read, write, or individual page erase is allowed. Must erase entire flash space.
Writes to flash memory clear bits from logic 1 to logic 0 and can be performed on single byte locations. Flash erasures set bits back to
logic 1 and occur only on full pages. The write and erase operations are automatically timed by hardware for proper execution; data
polling to determine the end of the write/erase operation is not required. Code execution is stalled during a flash write/erase operation.
The simplest means of programming the flash memory is through the C2 interface using programming tools provided by Silicon Labs or
a third party vendor. Firmware may also be loaded into the device to implement code-loader functions or allow non-volatile data stor-
age. To ensure the integrity of flash contents, it is strongly recommended that the on-chip supply monitor be enabled in any system that
includes code that writes and/or erases flash memory from software.
Flash writes and erases by user software are protected with a lock and key function. The FLKEY register must be written with the cor-
rect key codes, in sequence, before flash operations may be performed. The key codes are 0xA5 and 0xF1. The timing does not mat-
ter, but the codes must be written in order. If the key codes are written out of order or the wrong codes are written, flash writes and
erases will be disabled until the next system reset. Flash writes and erases will also be disabled if a flash write or erase is attempted
before the key codes have been written properly. The flash lock resets after each write or erase; the key codes must be written again
before another flash write or erase operation can be performed.
The flash memory is erased one page at a time by firmware using the MOVX write instruction with the address targeted to any byte
within the page. Before erasing a page of flash memory, flash write and erase operations must be enabled by setting the PSWE and
PSEE bits in the PSCTL register to logic 1 (this directs the MOVX writes to target flash memory and enables page erasure) and writing
the flash key codes in sequence to the FLKEY register. The PSWE and PSEE bits remain set until cleared by firmware.
Erase operation applies to an entire page (setting all bytes in the page to 0xFF). To erase an entire page, perform the following steps:
1. Disable interrupts (recommended).
2. Write the first key code to FLKEY: 0xA5.
3. Write the second key code to FLKEY: 0xF1.
4. Set the PSEE bit (register PSCTL).
5. Set the PSWE bit (register PSCTL).
6. Using the MOVX instruction, write a data byte to any location within the page to be erased.
7. Clear the PSWE and PSEE bits.
The flash memory is written by firmware using the MOVX write instruction with the address and data byte to be programmed provided
as normal operands in DPTR and A. Before writing to flash memory using MOVX, flash write operations must be enabled by setting the
PSWE bit in the PSCTL register to logic 1 (this directs the MOVX writes to target flash memory) and writing the flash key codes in
sequence to the FLKEY register. The PSWE bit remains set until cleared by firmware. A write to flash memory can clear bits to logic 0
but cannot set them. A byte location to be programmed should be erased (already set to 0xFF) before a new value is written.
Any system which contains routines which write or erase flash memory from software involves some risk that the write or erase routines
will execute unintentionally if the CPU is operating outside its specified operating range of supply voltage, system clock frequency or
temperature. This accidental execution of flash modifying code can result in alteration of flash memory contents causing a system fail-
ure that is only recoverable by re-flashing the code in the device.
To help prevent the accidental modification of flash by firmware, hardware restricts flash writes and erasures when the supply monitor is
not active and selected as a reset source. As the monitor is enabled and selected as a reset source by default, it is recommended that
systems writing or erasing flash simply maintain the default state.
The following sections provide general guidelines for any system which contains routines which write or erase flash from code. Addi-
tional flash recommendations and example code can be found in AN201: Writing to Flash From Firmware, available from the Silicon
Laboratories website.
• If the system power supply is subject to voltage or current "spikes," add sufficient transient protection devices to the power supply to
ensure that the supply voltages listed in the Absolute Maximum Ratings table are not exceeded.
• Make certain that the minimum supply rise time specification is met. If the system cannot meet this rise time specification, then add
an external supply brownout circuit to the RSTb pin of the device that holds the device in reset until the voltage supply reaches the
lower limit, and re-asserts RSTb if the supply drops below the low supply limit.
• Do not disable the supply monitor. If the supply monitor must be disabled in the system, firmware should be added to the startup
routine to enable the on-chip supply monitor and enable the supply monitor as a reset source as early in code as possible. This
should be the first set of instructions executed after the reset vector. For C-based systems, this may involve modifying the startup
code added by the C compiler. See your compiler documentation for more details. Make certain that there are no delays in software
between enabling the supply monitor and enabling the supply monitor as a reset source.
Note: The supply monitor must be enabled and enabled as a reset source when writing or erasing flash memory. A flash error reset
will occur if either condition is not met.
• As an added precaution if the supply monitor is ever disabled, explicitly enable the supply monitor and enable the supply monitor as
a reset source inside the functions that write and erase flash memory. The supply monitor enable instructions should be placed just
after the instruction to set PSWE to a 1, but before the flash write or erase operation instruction.
• Make certain that all writes to the RSTSRC (Reset Sources) register use direct assignment operators and explicitly do not use the
bit-wise operators (such as AND or OR). For example, "RSTSRC = 0x02" is correct. "RSTSRC |= 0x02" is incorrect.
• Make certain that all writes to the RSTSRC register explicitly set the PORSF bit to a 1. Areas to check are initialization code which
enables other reset sources, such as the Missing Clock Detector or Comparator, for example, and instructions which force a Soft-
ware Reset. A global search on "RSTSRC" can quickly verify this.
PSWE Maintenance
• Reduce the number of places in code where the PSWE bit (in register PSCTL) is set to a 1. There should be exactly one routine in
code that sets PSWE to a 1 to write flash bytes and one routine in code that sets PSWE and PSEE both to a 1 to erase flash pages.
• Minimize the number of variable accesses while PSWE is set to a 1. Handle pointer address updates and loop variable maintenance
outside the "PSWE = 1;... PSWE = 0;" area.
• Disable interrupts prior to setting PSWE to a 1 and leave them disabled until after PSWE has been reset to 0. Any interrupts posted
during the flash write or erase operation will be serviced in priority order after the flash operation has been completed and interrupts
have been re-enabled by software.
• Make certain that the flash write and erase pointer variables are not located in XRAM. See your compiler documentation for instruc-
tions regarding how to explicitly locate variables in different memory areas.
• Add address bounds checking to the routines that write or erase flash memory to ensure that a routine called with an illegal address
does not result in modification of the flash.
System Clock
• If operating from an external crystal-based source, be advised that crystal performance is susceptible to electrical interference and is
sensitive to layout and to changes in temperature. If the system is operating in an electrically noisy environment, use the internal
oscillator or use an external CMOS clock.
• If operating from the external oscillator, switch to the internal oscillator during flash write or erase operations. The external oscillator
can continue to run, and the CPU can switch back to the external oscillator after the flash operation has completed.
Bit 7 6 5 4 3 2 1 0
Access R RW RW
Reset 0x00 0 0
Setting this bit (in combination with PSWE) allows an entire page of flash program memory to be erased. If this bit is logic 1
and flash writes are enabled (PSWE is logic 1), a write to flash memory using the MOVX instruction will erase the entire
page that contains the location addressed by the MOVX instruction. The value of the data byte written does not matter.
Setting this bit allows writing a byte of data to the flash program memory using the MOVX write instruction. The flash loca-
tion should be erased before writing data.
1 WRITE_ENABLED Writes to flash program memory enabled; the MOVX write instruction targets flash
memory.
Bit 7 6 5 4 3 2 1 0
Name FLKEY
Access RW
Reset 0x00
Write:
This register provides a lock and key function for flash erasures and writes. Flash writes and erases are enabled by writing
0xA5 followed by 0xF1 to the FLKEY register. Flash writes and erases are automatically disabled after the next write or
erase is complete. If any writes to FLKEY are performed incorrectly, or if a flash write or erase operation is attempted while
these operations are disabled, the flash will be permanently locked from writes or erasures until the next device reset. If an
application never writes to flash, it can intentionally lock the flash by writing a non-0xA5 value to FLKEY from firmware.
Read:
When read, bits 1-0 indicate the current flash lock state.
5. Device Identification
The SFR map includes registers that may be used to identify the device family (DEVICEID), derivative (DERIVID), and revision (RE-
VID). These SFRs can be read by firmware at runtime to determine the capabilities of the MCU that is executing code. This allows the
same firmware image to run on MCUs with different memory sizes and peripherals, and dynamically change functionality to suit the
capabilities of that MCU.
A 32-bit unique identifier (UID) is pre-loaded upon device reset into the RAM area on all devices. The UID resides in the last four bytes
of XRAM on devices which include XRAM, or the last four bytes of the RAM space for devices without XRAM. For devices with the UID
in RAM, the UID can be read by firmware using indirect data accesses. For devices with the UID in XRAM, the UID can be read by
firmware using MOVX instructions. The UID can also be read through the debug port for all devices.
As the UID appears in RAM, firmware can overwrite the UID during normal operation. The bytes in memory will be automatically reini-
tialized with the UID value after any device reset. Firmware using this area of memory should always initialize the memory to a known
value, as any previous data stored at these locations will be overwritten and not retained through a reset.
Bit 7 6 5 4 3 2 1 0
Name DEVICEID
Access R
Reset 0x30
Bit 7 6 5 4 3 2 1 0
Name DERIVID
Access R
Reset Varies
This read-only register returns the 8-bit derivative ID, which can be used by firmware to identify which device in the product
family the code is executing on. The '{R}' tag in the part numbers indicates the device revision letter in the ordering code.
The revision letter may be determined by decoding the REVID register.
Bit 7 6 5 4 3 2 1 0
Name REVID
Access R
Reset Varies
6. Interrupts
6.1 Introduction
The MCU core includes an extended interrupt system supporting multiple interrupt sources and priority levels. The allocation of interrupt
sources between on-chip peripherals and external input pins varies according to the specific version of the device.
Interrupt sources may have one or more associated interrupt-pending flag(s) located in an SFR local to the associated peripheral.
When a peripheral or external source meets a valid interrupt condition, the associated interrupt-pending flag is set to logic 1.
If interrupts are enabled for the source, an interrupt request is generated when the interrupt-pending flag is set. As soon as execution of
the current instruction is complete, the CPU generates an LCALL to a predetermined address to begin execution of an interrupt service
routine (ISR). Each ISR must end with an RETI instruction, which returns program execution to the next instruction that would have
been executed if the interrupt request had not occurred. If interrupts are not enabled, the interrupt-pending flag is ignored by the hard-
ware and program execution continues as normal. The interrupt-pending flag is set to logic 1 regardless of whether the interrupt is ena-
bled.
Each interrupt source can be individually enabled or disabled through the use of an associated interrupt enable bit in the IE and EIEn
registers. However, interrupts must first be globally enabled by setting the EA bit to logic 1 before the individual interrupt enables are
recognized. Setting the EA bit to logic 0 disables all interrupt sources regardless of the individual interrupt-enable settings.
Some interrupt-pending flags are automatically cleared by the hardware when the CPU vectors to the ISR or by other hardware condi-
tions. However, most are not cleared by the hardware and must be cleared by software before returning from the ISR. If an interrupt-
pending flag remains set after the CPU completes the return-from-interrupt (RETI) instruction, a new interrupt request will be generated
immediately and the CPU will re-enter the ISR after the completion of the next instruction.
The CIP51 core supports interrupt sources for each peripheral on the device. Software can simulate an interrupt for many peripherals
by setting any interrupt-pending flag to logic 1. If interrupts are enabled for the flag, an interrupt request will be generated and the CPU
will vector to the ISR address associated with the interrupt-pending flag. Refer to the data sheet section associated with a particular on-
chip peripheral for information regarding valid interrupt conditions for the peripheral and the behavior of its interrupt-pending flag(s).
Each interrupt source can be individually programmed to one of two priority levels: low or high. A low priority interrupt service routine
can be preempted by a high priority interrupt. A high priority interrupt cannot be preempted. Each interrupt has an associated interrupt
priority bit in the IP and EIPn registers, which are used to configure its priority level. Low priority is the default. If two interrupts are
recognized simultaneously, the interrupt with the higher priority is serviced first. If both interrupts have the same priority level, a fixed
order is used to arbitrate, based on the interrupt source's location in the interrupt vector table. Interrupts with a lower number in the
vector table have priority.
Interrupt response time depends on the state of the CPU when the interrupt occurs. Pending interrupts are sampled and priority deco-
ded on every system clock cycle. Therefore, the fastest possible response time is 5 system clock cycles: 1 clock cycle to detect the
interrupt and 4 clock cycles to complete the LCALL to the ISR. If an interrupt is pending when a RETI is executed, a single instruction is
executed before an LCALL is made to service the pending interrupt. Therefore, the maximum response time for an interrupt (when no
other interrupt is currently being serviced or the new interrupt is of greater priority) occurs when the CPU is performing an RETI instruc-
tion followed by a DIV as the next instruction. In this case, the response time is 18 system clock cycles: 1 clock cycle to detect the
interrupt, 5 clock cycles to execute the RETI, 8 clock cycles to complete the DIV instruction and 4 clock cycles to execute the LCALL to
the ISR. If the CPU is executing an ISR for an interrupt with equal or higher priority, the new interrupt will not be serviced until the
current ISR completes, including the RETI and following instruction. If more than one interrupt is pending when the CPU exits an ISR,
the CPU will service the next highest priority interrupt that is pending.
Interrupt Source Vector Priority Primary Enable Auxiliary Enable(s) Pending Flag(s)
SCON0_TI
SPI0CN0_RXOVRN
SPI0CN0_SPIF
SPI0CN0_WCOL
PCA0CPM1_ECCF PCA0CN0_CCF1
PCA0CPM2_ECCF PCA0CN0_CCF2
PCA0PWM_ECOV PCA0CN0_CF
PCA0PWM_COVF
CMP0MD_CPFIE CMP0CN0_CPRIF
CMP1MD_CPRIE CMP1CN0_CPRIF
Bit 7 6 5 4 3 2 1 0
Access RW RW RW RW RW RW RW RW
Reset 0 0 0 0 0 0 0 0
Globally enables/disables all interrupts and overrides individual interrupt mask settings.
Bit 7 6 5 4 3 2 1 0
Access R RW RW RW RW RW RW RW
Reset 1 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
Access RW RW RW RW RW RW RW RW
Reset 0 0 0 0 0 0 0 0
1 ENABLED Enable interrupt requests generated by the comparator 1 CPRIF or CPFIF flags.
1 ENABLED Enable interrupt requests generated by the comparator 0 CPRIF or CPFIF flags.
This bit sets the masking of the ADC0 Conversion Complete interrupt.
1 ENABLED Enable interrupt requests generated by ADC0 Window Compare flag (ADWINT).
This bit sets the masking of the Port Match Event interrupt.
Bit 7 6 5 4 3 2 1 0
Access RW RW RW RW RW RW RW RW
Reset 0 0 0 0 0 0 0 0
This bit sets the priority of the ADC0 Conversion Complete interrupt.
This bit sets the priority of the Port Match Event interrupt.
7.1 Introduction
All internal circuitry draws power from the VDD supply pin. External I/O pins are powered from the VIO supply voltage (or VDD on devi-
ces without a separate VIO connection), while most of the internal circuitry is supplied by an on-chip LDO regulator. Control over the
device power can be achieved by enabling/disabling individual peripherals as needed. Each analog peripheral can be disabled when
not in use and placed in low power mode. Digital peripherals, such as timers and serial buses, have their clocks gated off and draw little
power when they are not in use.
Power Distribution
VDD
1.8V
Core LDO Digital I/O
Interface
GND CPU Core Port I/O Pins
Analog
RAM
Muxes
Flash
Oscillators
Peripheral
Logic
Shutdown • All internal power nets shut down 1. Set STOPCF bit in • RSTb pin reset
• Pins retain state REG0CN • Power-on reset
• Exit on pin or power-on reset 2. Set STOP bit in
PCON0
7.2 Features
Note: Legacy 8051 Stop mode is also supported, where internal LDO remains active, but a device reset is required to wake.
• Fully internal core LDO supplies power to majority of blocks.
In idle mode, CPU core execution is halted while any enabled peripherals and clocks remain active. Power consumption in idle mode is
dependent upon the system clock frequency and any active peripherals.
Setting the IDLE bit in the PCON0 register causes the hardware to halt the CPU and enter idle mode as soon as the instruction that
sets the bit completes execution. All internal registers and memory maintain their original data. All analog and digital peripherals can
remain active during idle mode.
Idle mode is terminated when an enabled interrupt is asserted or a reset occurs. The assertion of an enabled interrupt will cause the
IDLE bit to be cleared and the CPU to resume operation. The pending interrupt will be serviced and the next instruction to be executed
after the return from interrupt (RETI) will be the instruction immediately following the one that set the IDLE bit. If idle mode is terminated
by an internal or external reset, the CIP-51 performs a normal reset sequence and begins program execution at address 0x0000.
Note: If the instruction following the write of the IDLE bit is a single-byte instruction and an interrupt occurs during the execution phase
of the instruction that sets the IDLE bit, the CPU may not wake from idle mode when a future interrupt occurs. Therefore, instructions
that set the IDLE bit should be followed by an instruction that has two or more opcode bytes. For example:
// in ‘C’:
PCON0 |= 0x01; // set IDLE bit
PCON0 = PCON0; // ... followed by a 3-cycle dummy instruction
; in assembly:
ORL PCON0, #01h ; set IDLE bit
MOV PCON0, PCON0 ; ... followed by a 3-cycle dummy instruction
If enabled, the Watchdog Timer (WDT) will eventually cause an internal watchdog reset and thereby terminate the Idle mode. This fea-
ture protects the system from an unintended permanent shutdown in the event of an inadvertent write to the PCON0 register. If this
behavior is not desired, the WDT may be disabled by software prior to entering the idle mode if the WDT was initially configured to
allow this operation. This provides the opportunity for additional power savings, allowing the system to remain in the idle mode indefi-
nitely, waiting for an external stimulus to wake up the system.
In stop mode, the CPU is halted and peripheral clocks are stopped. Analog peripherals remain in their selected states.
Setting the STOP bit in the PCON0 register causes the controller core to enter stop mode as soon as the instruction that sets the bit
completes execution. Before entering stop mode, the system clock must be sourced by HFOSC0. In stop mode, the CPU and internal
clocks are stopped. Analog peripherals may remain enabled, but will not be provided a clock. Each analog peripheral may be shut down
individually by firmware prior to entering stop mode. Stop mode can only be terminated by an internal or external reset. On reset, the
device performs the normal reset sequence and begins program execution at address 0x0000.
If enabled as a reset source, the missing clock detector will cause an internal reset and thereby terminate the stop mode. If this reset is
undesirable in the system, and the CPU is to be placed in stop mode for longer than the missing clock detector timeout, the missing
clock detector should be disabled in firmware prior to setting the STOP bit.
In shutdown mode, the CPU is halted and the internal LDO is powered down. External I/O will retain their configured states.
To enter Shutdown mode, firmware should set the STOPCF bit in the regulator control register to 1, and then set the STOP bit in
PCON0. In Shutdown, the RSTb pin and a full power cycle of the device are the only methods of generating a reset and waking the
device.
Note: In Shutdown mode, all internal device circuitry is powered down, and no RAM nor registers are retained. The debug circuitry will
not be able to connect to a device while it is in Shutdown. Coming out of Shutdown mode, whether by POR or pin reset, will appear as
a power-on reset of the device.
Bit 7 6 5 4 3 2 1 0
Access RW RW RW RW RW RW RW RW
Reset 0 0 0 0 0 0 0 0
This flag is a general purpose flag for use under firmware control.
This flag is a general purpose flag for use under firmware control.
This flag is a general purpose flag for use under firmware control.
This flag is a general purpose flag for use under firmware control.
This flag is a general purpose flag for use under firmware control.
This flag is a general purpose flag for use under firmware control.
Setting this bit will place the CIP-51 in Stop mode. This bit will always be read as 0.
Setting this bit will place the CIP-51 in Idle mode. This bit will always be read as 0.
Bit 7 6 5 4 3 2 1 0
Access R RW R
This bit configures the regulator's behavior when the device enters stop mode.
0 ACTIVE Regulator is still active in stop mode. Any enabled reset source will reset the de-
vice.
1 SHUTDOWN Regulator is shut down in stop mode. Only the RSTb pin or power cycle can reset
the device.
8.1 Introduction
The CPU core and peripheral subsystem may be clocked by both internal and external oscillator resources. By default, the system
clock comes up running from the 24.5 MHz oscillator divided by 8.
Clock Control
24.5 MHz
Oscillator
(HFOSC0)
Programmable SYSCLK
External Clock
Divider:
Input (EXTCLK)
1, 2, 4...128 To core and peripherals
8.2 Features
The CLKSEL register is used to select the clock source for the system (SYSCLK). The CLKSL field selects which oscillator source is
used as the system clock, while CLKDIV controls the programmable divider. When an internal oscillator source is selected as the
SYSCLK, the external oscillator may still clock certain peripherals. In these cases, the external oscillator source is synchronized to the
SYSCLK source. The system clock may be switched on-the-fly between any of the oscillator sources so long as the selected clock
source is enabled and has settled, and CLKDIV may be changed at any time.
Note: Some device families do place restrictions on the difference in operating frequency when switching clock sources. Please see the
CLKSEL register description for details.
HFOSC0 is a programmable internal high-frequency oscillator that is factory-calibrated to 24.5 MHz. The oscillator is automatically ena-
bled when it is requested. The oscillator period can be adjusted via the HFO0CAL register to obtain other frequencies.
LFOSC0 is a progammable low-frequency oscillator, factory calibrated to a nominal frequency of 80 kHz. A dedicated divider at the
oscillator output is capable of dividing the output clock by 1, 2, 4, or 8, using the OSCLD bits in the LFO0CN register. The OSCLF bits
can be used to coarsely adjust the oscillator’s output frequency.
The LFOSC0 circuit requires very little start-up time and may be selected as the system clock immediately following the register write
which enables the oscillator.
Calibrating LFOSC0
On-chip calibration of the LFOSC0 can be performed using a timer to capture the oscillator period, when running from a known time
base. When a timer is configured for L-F Oscillator capture mode, a rising edge of the low-frequency oscillator’s output will cause a
capture event on the corresponding timer. As a capture event occurs, the current timer value is copied into the timer reload registers.
By recording the difference between two successive timer capture values, the low-frequency oscillator’s period can be calculated. The
OSCLF bits can then be adjusted to produce the desired oscillator frequency.
An external CMOS clock source is also supported as a core clock source. The EXTCLK pin on the device serves as the external clock
input when running in this mode. The EXTCLK input may also be used to clock certain digital peripherals (e.g., Timers, PCA, etc.) while
SYSCLK runs from one of the internal oscillator sources. When not selected as the SYSCLK source, the EXTCLK input is always re-
synchronized to SYSCLK.
Note: When selecting the EXTCLK pin as a clock input source, the pin should be skipped in the crossbar and configured as a digital
input. Firmware should ensure that the external clock source is present or enable the missing clock detector before switching the
CLKSL field.
Bit 7 6 5 4 3 2 1 0
Access R RW R RW
This field controls the divider applied to the clock source selected by CLKSL. The output of this divider is the system clock
(SYSCLK).
0x1 EXTOSC Clock derived from the External CMOS clock circuit.
There are no restrictions when switching between clock sources or divider values for this family.
Bit 7 6 5 4 3 2 1 0
Name HFO0CAL
Access RW
Reset Varies
These bits determine the period for high frequency oscillator 0. When set to 0x00, the oscillator operates at its fastest set-
ting. When set to 0xFF, the oscillator operates at its slowest setting. The reset value is factory calibrated, and the oscillator
will revert to the calibrated frequency upon reset.
Bit 7 6 5 4 3 2 1 0
Access RW R RW RW
This bit enables the internal low-frequency oscillator. Note that the low-frequency oscillator is automatically enabled when
the watchdog timer is active.
Fine-tune control bits for the Internal L-F oscillator frequency. When set to 0000b, the L-F oscillator operates at its fastest
setting. When set to 1111b, the L-F oscillator operates at its slowest setting. The OSCLF bits should only be changed by
firmware when the L-F oscillator is disabled (OSCLEN = 0).
OSCLRDY is only set back to 0 in the event of a device reset or a change to the OSCLD bits.
9.1 Introduction
Reset circuitry allows the controller to be easily placed in a predefined default condition. On entry to this reset state, the following occur:
• The core halts program execution.
• Module registers are initialized to their defined reset values unless the bits reset only with a power-on reset.
• External port pins are forced to a known state.
• Interrupts and timers are disabled.
All registers are reset to the predefined values noted in the register descriptions unless the bits only reset with a power-on reset. The
contents of RAM are unaffected during a reset; any previously stored data is preserved as long as power is not lost. The Port I/O latch-
es are reset to 1 in open-drain mode. Weak pullups are enabled during and after the reset. For Supply Monitor and power-on resets,
the RSTb pin is driven low until the device exits the reset state. On exit from the reset state, the program counter (PC) is reset, and the
system clock defaults to an internal oscillator. The Watchdog Timer is enabled, and program execution begins at location 0x0000.
Reset Sources
RSTb
Supply Monitor or
Power-up
Watchdog Timer
system reset
Software Reset
Comparator 0
Flash Error
9.2 Features
Upon entering a reset state from any source, the following events occur:
• The processor core halts program execution.
• Special Function Registers (SFRs) are initialized to their defined reset values.
• External port pins are placed in a known state.
• Interrupts and timers are disabled.
SFRs are reset to the predefined reset values noted in the detailed register descriptions. The contents of internal data memory are
unaffected during a reset; any previously stored data is preserved. However, since the stack pointer SFR is reset, the stack is effective-
ly lost, even though the data on the stack is not altered.
The port I/O latches are reset to 0xFF (all logic ones) in open-drain mode. Weak pullups are enabled during and after the reset. For
Supply Monitor and power-on resets, the RSTb pin is driven low until the device exits the reset state.
Note: During a power-on event, there may be a short delay before the POR circuitry fires and the RSTb pin is driven low. During that
time, the RSTb pin will be weakly pulled to the supply pin.
On exit from the reset state, the program counter (PC) is reset, the watchdog timer is enabled, and the system clock defaults to an
internal oscillator. Program execution begins at location 0x0000.
During power-up, the POR circuit fires. When POR fires, the device is held in a reset state and the RSTb pin is driven low until the
supply voltage settles above VRST. Two delays are present during the supply ramp time. First, a delay occurs before the POR circuitry
fires and pulls the RSTb pin low. A second delay occurs before the device is released from reset; the delay decreases as the supply
ramp time increases (supply ramp time is defined as how fast the supply pin ramps from 0 V to VRST). For ramp times less than 1 ms,
the power-on reset time (TPOR) is typically less than 0.3 ms. Additionally, the power supply must reach VRST before the POR circuit
releases the device from reset.
On exit from a power-on reset, the PORSF flag is set by hardware to logic 1. When PORSF is set, all of the other reset flags in the
RSTSRC register are indeterminate. (PORSF is cleared by all other resets.) Since all resets cause program execution to begin at the
same location (0x0000), software can read the PORSF flag to determine if a power-up was the cause of reset. The content of internal
data memory should be assumed to be undefined after a power-on reset. The supply monitor is enabled following a power-on reset.
volts
ge
lta
Vo
ly
pp
Su
RSTb
Logic HIGH
TPOR
Logic LOW
Power-On Reset
The supply monitor senses the voltage on the device's supply pin and can generate a reset if the supply drops below the corresponding
threshold. This monitor is enabled and enabled as a reset source after initial power-on to protect the device until the supply is an ade-
quate and stable voltage. When enabled and selected as a reset source, any power down transition or power irregularity that causes
the supply to drop below the reset threshold will drive the RSTb pin low and hold the core in a reset state. When the supply returns to a
level above the reset threshold, the monitor will release the core from the reset state. The reset status can then be read using the
device reset sources module. After a power-fail reset, the PORF flag reads 1 and all of the other reset flags in the RSTSRC register are
indeterminate. The power-on reset delay (tPOR) is not incurred after a supply monitor reset. The contents of RAM should be presumed
invalid after a supply monitor reset. The enable state of the supply monitor and its selection as a reset source is not altered by device
resets. For example, if the supply monitor is de-selected as a reset source and disabled by software using the VDMEN bit in the
VDM0CN register, and then firmware performs a software reset, the supply monitor will remain disabled and de-selected after the reset.
To protect the integrity of flash contents, the supply monitor must be enabled and selected as a reset source if software contains rou-
tines that erase or write flash memory. If the supply monitor is not enabled, any erase or write performed on flash memory will be ignor-
ed. volts
Supply Voltage
Reset Threshold
(VRST)
RSTb
Supply Monitor
Reset
The external RSTb pin provides a means for external circuitry to force the device into a reset state. Asserting an active-low signal on
the RSTb pin generates a reset; an external pullup and/or decoupling of the RSTb pin may be necessary to avoid erroneous noise-
induced resets. The PINRSF flag is set on exit from an external reset.
The Missing Clock Detector (MCD) is a one-shot circuit that is triggered by the system clock. If the system clock remains high or low for
more than the MCD time window, the one-shot will time out and generate a reset. After a MCD reset, the MCDRSF flag will read 1,
signifying the MCD as the reset source; otherwise, this bit reads 0. Writing a 1 to the MCDRSF bit enables the Missing Clock Detector;
writing a 0 disables it. The state of the RSTb pin is unaffected by this reset.
Comparator0 can be configured as a reset source by writing a 1 to the C0RSEF flag. Comparator0 should be enabled and allowed to
settle prior to writing to C0RSEF to prevent any turn-on chatter on the output from generating an unwanted reset. The Comparator0
reset is active-low: if the non-inverting input voltage (on CP0+) is less than the inverting input voltage (on CP0–), the device is put into
the reset state. After a Comparator0 reset, the C0RSEF flag will read 1 signifying Comparator0 as the reset source; otherwise, this bit
reads 0. The state of the RSTb pin is unaffected by this reset.
The programmable Watchdog Timer (WDT) can be used to prevent software from running out of control during a system malfunction.
The WDT function can be enabled or disabled by software as described in the watchdog timer section. If a system malfunction prevents
user software from updating the WDT, a reset is generated and the WDTRSF bit is set to 1. The state of the RSTb pin is unaffected by
this reset.
If a flash read/write/erase or program read targets an illegal address, a system reset is generated. This may occur due to any of the
following:
• A flash write or erase is attempted above user code space.
• A flash read is attempted above user code space.
• A program read is attempted above user code space (i.e., a branch instruction to the reserved area).
• A flash read, write or erase attempt is restricted due to a flash security setting.
The FERROR bit is set following a flash error reset. The state of the RSTb pin is unaffected by this reset.
Software may force a reset by writing a 1 to the SWRSF bit. The SWRSF bit will read 1 following a software forced reset. The state of
the RSTb pin is unaffected by this reset.
Bit 7 6 5 4 3 2 1 0
Access RW R RW RW R RW RW R
This read-only bit is set to '1' if a flash read/write/erase error caused the last reset.
Read: This bit reads 1 if last reset was caused by a write to SWRSF.
This read-only bit is set to '1' if a watchdog timer overflow caused the last reset.
Read: This bit reads 1 if a missing clock detector timeout caused the last reset.
Write: Writing a 1 to this bit enables the missing clock detector. The MCD triggers a reset if a missing clock condition is
detected.
1 PORSF Varies RW Power-On / Supply Monitor Reset Flag, and Supply Monitor Reset Enable.
Read: This bit reads 1 anytime a power-on or supply monitor reset has occurred.
Write: Writing a 1 to this bit enables the supply monitor as a reset source.
This read-only bit is set to '1' if the RSTb pin caused the last reset.
Reads and writes of the RSTSRC register access different logic in the device. Reading the register always returns status information
to indicate the source of the most recent reset. Writing to the register activates certain options as reset sources. It is recommended to
not use any kind of read-modify-write operation on this register.
When the PORSF bit reads back '1' all other RSTSRC flags are indeterminate.
Writing '1' to the PORSF bit when the supply monitor is not enabled and stabilized may cause a system reset.
Bit 7 6 5 4 3 2 1 0
Access RW R R
This bit turns the supply monitor circuit on/off. The supply monitor cannot generate system resets until it is also selected as
a reset source in register RSTSRC. Selecting the supply monitor as a reset source before it has stabilized may generate a
system reset. In systems where this reset would be undesirable, a delay should be introduced between enabling the supply
monitor and selecting it as a reset source.
This bit indicates the current power supply status (supply monitor output).
10.1 Introduction
The CIP-51 microcontroller core is a high-speed, pipelined, 8-bit core utilizing the standard MCS-51™ instruction set. Any standard
803x/805x assemblers and compilers can be used to develop software. The MCU family has a superset of all the peripherals included
with a standard 8051. The CIP-51 includes on-chip debug hardware and interfaces directly with the analog and digital subsystems pro-
viding a complete data acquisition or control system solution.
DATA BUS
D8
D8
D8
D8
D8
ACCUMULATOR B REGISTER STACK POINTER
DATA BUS
TMP1 TMP2
SRAM
PSW SRAM
ADDRESS
(256 X 8)
ALU REGISTER
D8
D8
D8
D8
DATA BUS
SFR_ADDRESS
BUFFER D8
SFR_CONTROL
SFR
D8 BUS SFR_WRITE_DATA
DATA POINTER D8
INTERFACE
SFR_READ_DATA
PC INCREMENTER
DATA BUS
D8 MEM_ADDRESS
PROGRAM COUNTER (PC)
MEM_CONTROL
MEMORY
PRGM. ADDRESS REG. A16 INTERFACE MEM_WRITE_DATA
MEM_READ_DATA
PIPELINE D8
RESET CONTROL
LOGIC
SYSTEM_IRQs
CLOCK
INTERRUPT
D8
INTERFACE EMULATION_IRQ
STOP
POWER CONTROL
D8
IDLE REGISTER
Performance
The CIP-51 employs a pipelined architecture that greatly increases its instruction throughput over the standard 8051 architecture. The
CIP-51 core executes 76 of its 109 instructions in one or two clock cycles, with no instructions taking more than eight clock cycles. The
table below shows the distribution of instructions vs. the number of clock cycles required for execution.
Clocks to 1 2 2 or 3 3 3 or 4 4 4 or 5 5 8
Execute
Number of 26 50 5 14 7 3 1 2 1
Instructions
Notes:
1. Conditional branch instructions (indicated by "2 or 3", "3 or 4" and "4 or 5") require an extra clock cycle if the branch is taken.
10.2 Features
The CIP-51 Microcontroller core implements the standard 8051 organization and peripherals as well as additional custom peripherals
and functions to extend its capability. The CIP-51 includes the following features:
• Fast, efficient, pipelined architecture.
• Fully compatible with MCS-51 instruction set.
• 0 to 25 MHz operating clock frequency.
• 25 MIPS peak throughput with 25 MHz clock.
• Extended interrupt handler.
• Power management modes.
• On-chip debug logic.
• Program and data memory security.
In-system programming of the flash program memory and communication with on-chip debug support logic is accomplished via the Sili-
con Labs 2-Wire development interface (C2).
The on-chip debug support logic facilitates full speed in-circuit debugging, allowing the setting of hardware breakpoints, starting, stop-
ping and single stepping through program execution (including interrupt service routines), examination of the program's call stack, and
reading/writing the contents of registers and memory. This method of on-chip debugging is completely non-intrusive, requiring no RAM,
stack, timers, or other on-chip resources.
The CIP-51 is supported by development tools from Silicon Labs and third party vendors. Silicon Labs provides an integrated develop-
ment environment (IDE) including editor, debugger and programmer. The IDE's debugger and programmer interface to the CIP-51 via
the C2 interface to provide fast and efficient in-system device programming and debugging. Third party macro assemblers and C com-
pilers are also available.
The instruction set of the CIP-51 System Controller is fully compatible with the standard MCS-51™ instruction set. Standard 8051 de-
velopment tools can be used to develop software for the CIP-51. All CIP-51 instructions are the binary and functional equivalent of their
MCS-51™ counterparts, including opcodes, addressing modes and effect on PSW flags. However, instruction timing is much faster
than that of the standard 8051.
All instruction timing on the CIP-51 controller is based directly on the core clock timing. This is in contrast to many other 8-bit architec-
tures, where a distinction is made between machine cycles and clock cycles, with machine cycles taking multiple core clock cycles.
Due to the pipelined architecture of the CIP-51, most instructions execute in the same number of clock cycles as there are program
bytes in the instruction. Conditional branch instructions take one less clock cycle to complete when the branch is not taken as opposed
to when the branch is taken. The following table summarizes the instruction set, including the mnemonic, number of bytes, and number
of clock cycles for each instruction.
Arithmetic Operations
INC A Increment A 1 1
DEC A Decrement A 1 1
DIV AB Divide A by B 1 8
DA A Decimal adjust A 1 1
Logical Operations
ORL A, Rn OR Register to A 1 1
CLR A Clear A 1 1
CPL A Complement A 1 1
RL A Rotate A left 1 1
RR A Rotate A right 1 1
Data Transfer
Boolean Manipulation
JBC bit, rel Jump if direct bit is set and clear bit 3 3 or 4
Program Branching
CJNE A, direct, rel Compare direct byte to A and jump if not equal 3 3 or 4
CJNE Rn, #data, rel Compare immediate to Register and jump if not equal 3 3 or 4
CJNE @Ri, #data, rel Compare immediate to indirect and jump if not equal 3 4 or 5
DJNZ direct, rel Decrement direct byte and jump if not zero 3 3 or 4
NOP No operation 1 1
Notes:
• Rn: Register R0–R7 of the currently selected register bank.
• @Ri: Data RAM location addressed indirectly through R0 or R1.
• rel: 8-bit, signed (twos complement) offset relative to the first byte of the following instruction. Used by SJMP and all conditional
jumps.
• direct: 8-bit internal data location’s address. This could be a direct-access Data RAM location (0x00–0x7F) or an SFR (0x80–
0xFF).
• #data: 8-bit constant.
• #data16: 16-bit constant.
• bit: Direct-accessed bit in Data RAM or SFR.
• addr11: 11-bit destination address used by ACALL and AJMP. The destination must be within the same 2 KB page of program
memory as the first byte of the following instruction.
• addr16: 16-bit destination address used by LCALL and LJMP. The destination may be anywhere within the 8 KB program memory
space.
• There is one unused opcode (0xA5) that performs the same function as NOP. All mnemonics copyrighted © Intel Corporation
1980.
Bit 7 6 5 4 3 2 1 0
Name DPL
Access RW
Reset 0x00
The DPL register is the low byte of the 16-bit DPTR. DPTR is used to access indirectly addressed flash memory or XRAM.
Bit 7 6 5 4 3 2 1 0
Name DPH
Access RW
Reset 0x00
The DPH register is the high byte of the 16-bit DPTR. DPTR is used to access indirectly addressed flash memory or XRAM.
Bit 7 6 5 4 3 2 1 0
Name SP
Access RW
Reset 0x07
The Stack Pointer holds the location of the top of the stack. The stack pointer is incremented before every PUSH operation.
The SP register defaults to 0x07 after reset.
Bit 7 6 5 4 3 2 1 0
Name ACC
Access RW
Reset 0x00
10.4.5 B: B Register
Bit 7 6 5 4 3 2 1 0
Name B
Access RW
Reset 0x00
Bit 7 6 5 4 3 2 1 0
Name CY AC F0 RS OV F1 PARITY
Access RW RW RW RW RW RW R
Reset 0 0 0 0x0 0 0 0
7 CY 0 RW Carry Flag.
This bit is set when the last arithmetic operation resulted in a carry (addition) or a borrow (subtraction). It is cleared to logic
0 by all other arithmetic operations.
This bit is set when the last arithmetic operation resulted in a carry into (addition) or a borrow from (subtraction) the high
order nibble. It is cleared to logic 0 by all other arithmetic operations.
5 F0 0 RW User Flag 0.
This is a bit-addressable, general purpose flag for use under firmware control.
These bits select which register bank is used during register accesses.
2 OV 0 RW Overflow Flag.
The OV bit is cleared to 0 by the ADD, ADDC, SUBB, MUL, and DIV instructions in all other cases.
1 F1 0 RW User Flag 1.
This is a bit-addressable, general purpose flag for use under firmware control.
This bit is set to logic 1 if the sum of the eight bits in the accumulator is odd and cleared if the sum is even.
11.1 Introduction
Digital and analog resources are externally available on the device’s multi-purpose I/O pins. Port pins P0.0-P1.7 can be defined as gen-
eral-purpose I/O (GPIO), assigned to one of the internal digital resources through the crossbar or dedicated channels, or assigned to an
analog function. Port pins P2.0 and P2.1 can be used as GPIO. Additionally, the C2 Interface Data signal (C2D) is shared with P2.0.
2
UART0 Priority Crossbar
4 Decoder
SPI0 P0.0 / VREF
2 P0.1 / AGND
P0, P1
SMB0 P0.2
P0.3 / EXTCLK
2 P0.4
CMP0 Out P0.5
2 P0.6 / CNVSTR
CMP1 Out P0.7
1 P1.0
SYSCLK P0, P1 Port P1.1
ADC0 In Control P1.2
3 P1.3
PCA (CEXn) P0 and P1.4
CMP0 In Config
1 P1.5
PCA (ECI) P1 P1.6
CMP1 In P1.7
1
Timer 0 P0, P1 P2.0
Port Match P2.1
1
Timer 1 P0
INT0 / INT1
1
Timer 2
11.2 Features
Port pins are configured by firmware as digital or analog I/O using the special function registers. Port I/O initialization consists of the
following general steps:
1. Select the input mode (analog or digital) for all port pins, using the Port Input Mode register (PnMDIN).
2. Select the output mode (open-drain or push-pull) for all port pins, using the Port Output Mode register (PnMDOUT).
3. Select any pins to be skipped by the I/O crossbar using the Port Skip registers (PnSKIP).
4. Assign port pins to desired peripherals.
5. Enable the crossbar (XBARE = 1).
WEAKPUD
(Weak Pull-Up Disable)
PxMDOUT.x
(1 for push-pull) VDD VDD
(0 for open-drain)
XBARE
(WEAK)
(Crossbar
Enable)
PORT
Px.x – Output PAD
Logic Value
(Port Latch or
Crossbar)
PxMDIN.x GND
(1 for digital)
(0 for analog)
To/From Analog
Peripheral
Any pins to be used for analog functions should be configured for analog mode. When a pin is configured for analog I/O, its weak pull-
up, digital driver, and digital receiver are disabled. This saves power by eliminating crowbar current, and reduces noise on the analog
input. Pins configured as digital inputs may still be used by analog peripherals; however this practice is not recommended. Port pins
configured for analog functions will always read back a value of 0 in the corresponding Pn Port Latch register. To configure a pin as
analog, the following steps should be taken:
1. Clear the bit associated with the pin in the PnMDIN register to 0. This selects analog mode for the pin.
2. Set the bit associated with the pin in the Pn register to 1.
3. Skip the bit associated with the pin in the PnSKIP register to ensure the crossbar does not attempt to assign a function to the pin.
Any pins to be used by digital peripherals or as GPIO should be configured as digital I/O (PnMDIN.n = 1). For digital I/O pins, one of
two output modes (push-pull or open-drain) must be selected using the PnMDOUT registers.
Push-pull outputs (PnMDOUT.n = 1) drive the port pad to the supply rails based on the output logic value of the port pin. Open-drain
outputs have the high side driver disabled; therefore, they only drive the port pad to the lowside rail when the output logic value is 0 and
become high impedance inputs (both high low drivers turned off) when the output logic value is 1.
When a digital I/O cell is placed in the high impedance state, a weak pull-up transistor pulls the port pad to the high side rail to ensure
the digital input is at a defined logic state. Weak pull-ups are disabled when the I/O cell is driven low to minimize power consumption,
and they may be globally disabled by setting WEAKPUD to 1. The user should ensure that digital I/O are always internally or externally
pulled or driven to a valid logic state to minimize power consumption. Port pins configured for digital I/O always read back the logic
state of the port pad, regardless of the output logic value of the port pin.
Open-drain outputs are configured exactly as digital inputs. The pin may be driven low by an assigned peripheral, or by writing 0 to the
associated bit in the Pn register if the signal is a GPIO.
If a digital pin is to be used as a general-purpose I/O, or with a digital function that is not part of the crossbar, the bit associated with the
pin in the PnSKIP register can be set to 1 to ensure the crossbar does not attempt to assign a function to the pin. The crossbar must be
enabled to use port pins as standard port I/O in output mode. Port output drivers of all I/O pins are disabled whenever the crossbar is
disabled.
Port drive strength can be controlled on a port-by-port basis using the PRTDRV register. Each port has a bit in PRTDRV to select the
high or low drive strength setting for all pins on that port. By default, all ports are configured for high drive strength.
The following table displays the potential mapping of port I/O to each analog function.
Analog Function Potentially Assignable Port Pins SFR(s) Used For Assignment
The following table displays the potential mapping of port I/O to each digital function.
Digital Function Potentially Assignable Port Pins SFR(s) Used For Assignment
UART0, SPI0, SMB0, CP0, CP0A, CP1, Any port pin available for assignment by XBR0, XBR1, XBR2
CP1A, SYSCLK, PCA0 (CEX0-2 and ECI), the crossbar. This includes P0.0 – P1.7
T0, T1, T2 pins which have their PnSKIP bit set to ‘0’.
The crossbar will always assign UART0
pins to P0.4 and P0.5.
The priority crossbar decoder assigns a priority to each I/O function, starting at the top with UART0. The XBRn registers are used to
control which crossbar resources are assigned to physical I/O port pins.
When a digital resource is selected, the least-significant unassigned port pin is assigned to that resource (excluding UART0, which is
always assigned to dedicated pins). If a port pin is assigned, the crossbar skips that pin when assigning the next selected resource.
Additionally, the the PnSKIP registers allow software to skip port pins that are to be used for analog functions, dedicated digital func-
tions, or GPIO. If a port pin is to be used by a function which is not assigned through the crossbar, its corresponding PnSKIP bit should
be set to 1 in most cases. The crossbar skips these pins as if they were already assigned, and moves to the next unassigned pin.
It is possible for crossbar-assigned peripherals and dedicated functions to coexist on the same pin. For example, the port match func-
tion could be configured to watch for a falling edge on a UART RX line and generate an interrupt or wake up the device from a low-
power state. However, if two functions share the same pin, the crossbar will have control over the output characteristics of that pin and
the dedicated function will only have input access. Likewise, it is possible for firmware to read the logic state of any digital I/O pin as-
signed to a crossbar peripheral, but the output state cannot be directly modified.
Figure 11.3 Crossbar Priority Decoder Example Assignments on page 68 shows an example of the resulting pin assignments of the
device with UART0 and SPI0 enabled and P0.3 skipped (P0SKIP = 0x08). UART0 is the highest priority and it will be assigned first.
The UART0 pins can only appear at fixed locations (in this example, P0.4 and P0.5), so it occupies those pins. The next-highest ena-
bled peripheral is SPI0. P0.0, P0.1 and P0.2 are free, so SPI0 takes these three pins. The fourth pin, NSS, is routed to P0.6 because
P0.3 is skipped and P0.4 and P0.5 are already occupied by the UART. Any other pins on the device are available for use as general-
purpose digital I/O or analog functions.
Port P0
Pin Number 0 1 2 3 4 5 6 7
UART0-TX
UART0-RX
SPI0-SCK
SPI0-MISO
SPI0-MOSI
SPI0-NSS
0 0 0 1 0 0 0 0
Pin Skip Settings
P0SKIP
UART0 is assigned to fixed pins and has priority over SPI0.
SPI0 is assigned to available, un-skipped pins.
Figure 11.4 Full Crossbar Map on page 70 shows all of the potential peripheral-to-pin assignments available to the crossbar. Note
that this does not mean any peripheral can always be assigned to the highlighted pins. The actual pin assignments are determined by
the priority of the enabled peripherals.
Port P0 P1 P2
Pin Number 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1
N/A
N/A
N/A
SOIC-16 Package
N/A
N/A
CNVSTR
EXTCLK
VREF
C2D
QFN-20 Package
QSOP-24 Package
UART0-TX
UART0-RX
SPI0-SCK
SPI0-MISO
SPI0-MOSI
SPI0-NSS*
These boxes represent Port pins which can potentially be assigned to a peripheral.
Special Function Signals are not assigned by the crossbar. When these signals are
enabled, the Crossbar should be manually configured to skip the corresponding port pins.
Two direct-pin digital interrupt sources (INT0 and INT1) are included, which can be routed to port 0 pins. Additional I/O interrupts are
available through the port match function. As is the case on a standard 8051 architecture, certain controls for these two interrupt sour-
ces are available in the Timer0/1 registers. Extensions to these controls which provide additional functionality are available in the
IT01CF register. INT0 and INT1 are configurable as active high or low, edge- or level-sensitive. The IN0PL and IN1PL bits in the
IT01CF register select active high or active low; the IT0 and IT1 bits in TCON select level- or edge-sensitive. The table below lists the
possible configurations.
INT0 and INT1 are assigned to port pins as defined in the IT01CF register. INT0 and INT1 port pin assignments are independent of any
crossbar assignments, and may be assigned to pins used by crossbar peripherals. INT0 and INT1 will monitor their assigned port pins
without disturbing the peripheral that was assigned the port pin via the crossbar. To assign a port pin only to INT0 and/or INT1, config-
ure the crossbar to skip the selected pin(s).
IE0 and IE1 in the TCON register serve as the interrupt-pending flags for the INT0 and INT1 external interrupts, respectively. If an INT0
or INT1 external interrupt is configured as edge-sensitive, the corresponding interrupt pending flag is automatically cleared by the hard-
ware when the CPU vectors to the ISR. When configured as level sensitive, the interrupt-pending flag remains logic 1 while the input is
active as defined by the corresponding polarity bit (IN0PL or IN1PL); the flag remains logic 0 while the input is inactive. The external
interrupt source must hold the input active until the interrupt request is recognized. It must then deactivate the interrupt request before
execution of the ISR completes or another interrupt request will be generated.
Port match functionality allows system events to be triggered by a logic value change on one or more port I/O pins. A software control-
led value stored in the PnMATCH registers specifies the expected or normal logic values of the associated port pins (for example,
P0MATCH.0 would correspond to P0.0). A port mismatch event occurs if the logic levels of the port’s input pins no longer match the
software controlled value. This allows software to be notified if a certain change or pattern occurs on the input pins regardless of the
XBRn settings.
The PnMASK registers can be used to individually select which pins should be compared against the PnMATCH registers. A port mis-
match event is generated if (Pn & PnMASK) does not equal (PnMATCH & PnMASK) for all ports with a PnMAT and PnMASK register.
A port mismatch event may be used to generate an interrupt or wake the device from low power modes. See the interrupts and power
options chapters for more details on interrupt and wake-up sources.
All port I/O are accessed through corresponding special function registers. When writing to a port, the value written to the SFR is latch-
ed to maintain the output data value at each pin. When reading, the logic levels of the port's input pins are returned regardless of the
XBRn settings (i.e., even when the pin is assigned to another signal by the crossbar, the port register can always read its corresponding
port I/O pin). The exception to this is the execution of the read-modify-write instructions that target a Port Latch register as the destina-
tion. The read-modify-write instructions when operating on a port SFR are the following: ANL, ORL, XRL, JBC, CPL, INC, DEC, DJNZ
and MOV, CLR or SETB, when the destination is an individual bit in a port SFR. For these instructions, the value of the latch register
(not the pin) is read, modified, and written back to the SFR.
Bit 7 6 5 4 3 2 1 0
Access RW RW RW RW RW RW RW RW
Reset 0 0 0 0 0 0 0 0
1 ENABLED SPI I/O routed to Port pins. The SPI can be assigned either 3 or 4 GPIO pins.
Bit 7 6 5 4 3 2 1 0
Access R RW RW RW RW RW RW
5 T2E 0 RW T2 Enable.
4 T1E 0 RW T1 Enable.
3 T0E 0 RW T0 Enable.
Bit 7 6 5 4 3 2 1 0
Access RW RW R
Reset 0 0 0x00
0 PULL_UPS_ENABLED Weak Pullups enabled (except for Ports whose I/O are configured for analog
mode).
Bit 7 6 5 4 3 2 1 0
Access R RW RW RW
Reset 0x00 1 1 1
Bit 7 6 5 4 3 2 1 0
Name B7 B6 B5 B4 B3 B2 B1 B0
Access RW RW RW RW RW RW RW RW
Reset 0 0 0 0 0 0 0 0
0 IGNORED P0.7 pin logic value is ignored and will not cause a port mismatch event.
Bit 7 6 5 4 3 2 1 0
Name B7 B6 B5 B4 B3 B2 B1 B0
Access RW RW RW RW RW RW RW RW
Reset 1 1 1 1 1 1 1 1
Bit 7 6 5 4 3 2 1 0
Name B7 B6 B5 B4 B3 B2 B1 B0
Access RW RW RW RW RW RW RW RW
Reset 1 1 1 1 1 1 1 1
Writing this register sets the port latch logic value for the associated I/O pins configured as digital I/O.
Reading this register returns the logic value at the pin, regardless if it is configured as output or input.
Bit 7 6 5 4 3 2 1 0
Name B7 B6 B5 B4 B3 B2 B1 B0
Access RW RW RW RW RW RW RW RW
Reset 1 1 1 1 1 1 1 1
Port pins configured for analog mode have their weak pullup, digital driver, and digital receiver disabled.
Bit 7 6 5 4 3 2 1 0
Name B7 B6 B5 B4 B3 B2 B1 B0
Access RW RW RW RW RW RW RW RW
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
Name B7 B6 B5 B4 B3 B2 B1 B0
Access RW RW RW RW RW RW RW RW
Reset 0 0 0 0 0 0 0 0
Bit 7 6 5 4 3 2 1 0
Name B7 B6 B5 B4 B3 B2 B1 B0
Access RW RW RW RW RW RW RW RW
Reset 0 0 0 0 0 0 0 0
0 IGNORED P1.7 pin logic value is ignored and will not cause a port mismatch event.
Port 1 consists of 8 bits (P1.0-P1.7) on QSOP24 packages and 7 bits (P1.0-P1.6) on QFN20 packages and 4 bits (P1.0-P1.3) on
SOIC16 packages.
Bit 7 6 5 4 3 2 1 0
Name B7 B6 B5 B4 B3 B2 B1 B0
Access RW RW RW RW RW RW RW RW
Reset 1 1 1 1 1 1 1 1
Port 1 consists of 8 bits (P1.0-P1.7) on QSOP24 packages and 7 bits (P1.0-P1.6) on QFN20 packages and 4 bits (P1.0-P1.3) on
SOIC16 packages.
Bit 7 6 5 4 3 2 1 0
Name B7 B6 B5 B4 B3 B2 B1 B0
Access RW RW RW RW RW RW RW RW
Reset 1 1 1 1 1 1 1 1
Writing this register sets the port latch logic value for the associated I/O pins configured as digital I/O.
Reading this register returns the logic value at the pin, regardless if it is configured as output or input.
Port 1 consists of 8 bits (P1.0-P1.7) on QSOP24 packages, 7 bits (P1.0-P1.6) on QFN20 packages, and 4 bits (P1.0-P1.3) on SOIC16
packages.
Bit 7 6 5 4 3 2 1 0
Name B7 B6 B5 B4 B3 B2 B1 B0
Access RW RW RW RW RW RW RW RW
Reset 1 1 1 1 1 1 1 1
Port pins configured for analog mode have their weak pullup, digital driver, and digital receiver disabled.
Port 1 consists of 8 bits (P1.0-P1.7) on QSOP24 packages, 7 bits (P1.0-P1.6) on QFN20 packages, and 4 bits (P1.0-P1.3) on SOIC16
packages.
Bit 7 6 5 4 3 2 1 0
Name B7 B6 B5 B4 B3 B2 B1 B0
Access RW RW RW RW RW RW RW RW
Reset 0 0 0 0 0 0 0 0
Port 1 consists of 8 bits (P1.0-P1.7) on QSOP24 packages, 7 bits (P1.0-P1.6) on QFN20 packages, and 4 bits (P1.0-P1.3) on SOIC16
packages.
Bit 7 6 5 4 3 2 1 0
Name B7 B6 B5 B4 B3 B2 B1 B0
Access RW RW RW RW RW RW RW RW
Reset 0 0 0 0 0 0 0 0
Port 1 consists of 8 bits (P1.0-P1.7) on QSOP24 packages, 7 bits (P1.0-P1.6) on QFN20 packages, and 4 bits (P1.0-P1.3) on SOIC16
packages.
Bit 7 6 5 4 3 2 1 0
Name Reserved B1 B0
Access R RW RW
Reset 0x01 1 1
Writing this register sets the port latch logic value for the associated I/O pins configured as digital I/O.
Reading this register returns the logic value at the pin, regardless if it is configured as output or input.
Port 2 consists of 2 bits (P2.0-P2.1) on QSOP24 devices and 1 bit (P2.0) on QFN20 and SOIC16 packages.
Bit 7 6 5 4 3 2 1 0
Name Reserved B1 B0
Access R RW RW
Reset 0x00 0 0
Port 2 consists of 2 bits (P2.0-P2.1) on QSOP24 devices and 1 bit (P2.0) on QFN20 and SOIC16 packages.
Bit 7 6 5 4 3 2 1 0
Access RW RW RW RW
These bits select which port pin is assigned to INT1. This pin assignment is independent of the Crossbar; INT1 will monitor
the assigned port pin without disturbing the peripheral that has been assigned the port pin via the Crossbar. The Crossbar
will not assign the port pin to a peripheral if it is configured to skip the selected pin.
These bits select which port pin is assigned to INT0. This pin assignment is independent of the Crossbar; INT0 will monitor
the assigned port pin without disturbing the peripheral that has been assigned the port pin via the Crossbar. The Crossbar
will not assign the port pin to a peripheral if it is configured to skip the selected pin.
12.1 Introduction
The ADC is a successive-approximation-register (SAR) ADC with 12-, 10-, and 8-bit modes, integrated track-and hold and a program-
mable window detector. The ADC is fully configurable under software control via several registers. The ADC may be configured to
measure different signals using the analog multiplexer. The voltage reference for the ADC is selectable between internal and external
reference sources.
ADC0
Input Multiplexer
Selection
Less Greater
Control /
Than Than
Configuration
GND ADINT
(Interrupt Flag)
Internal LDO
Temp
Sensor ADBUSY (On Demand)
Timer 0 Overflow
Timer 2 Overflow
1.65 V / 2.4 V
Reference
Timer 3 Overflow
12.2 Features
• Up to 16 external inputs.
• Single-ended 12-bit and 10-bit modes.
• Supports an output update rate of 200 ksps samples per second in 12-bit mode or 800 ksps samples per second in 10-bit mode.
• Operation in low power modes at lower conversion speeds.
• Asynchronous hardware conversion trigger, selectable between software, external I/O and internal timer sources.
• Output data window comparator allows automatic range checking.
• Support for burst mode, which produces one set of accumulated data per conversion-start trigger with programmable power-on set-
tling and tracking time.
• Conversion complete and window compare interrupts supported.
• Flexible output data formatting.
• Includes an internal fast-settling reference with two levels (1.65 V and 2.4 V) and support for external reference and signal ground.
• Integrated temperature sensor.
12.3.1 Clocking
The ADC is clocked by an adjustable conversion clock (SARCLK). SARCLK is a divided version of the selected system clock when
burst mode is disabled (ADBMEN = 0), or a divided version of the HFOSC0 oscillator when burst mode is enabled (ADBMEN = 1). The
clock divide value is determined by the AD0SC field. In most applications, SARCLK should be adjusted to operate as fast as possible,
without exceeding the maximum electrical specifications. The SARCLK does not directly determine sampling times or sampling rates.
The voltage reference multiplexer is configurable to use a number of different internal and external reference sources. The ground ref-
erence mux allows the ground reference for ADC0 to be selected between the ground pin (GND) or a port pin dedicated to analog
ground (AGND). The voltage and ground reference options are configured using the REF0CN register. The REFSL field selects be-
tween the different reference options, while GNDSL configures the ground connection.
The high-speed internal reference offers two programmable voltage levels, and is self-contained and stabilized. It is not routed to an
external pin and requires no external decoupling. When selected, the internal reference will be automatically enabled/disabled on an as-
needed basis by the ADC. The reference can be set to one of two voltage values: 1.65 V or 2.4 V, depending on the value of the
IREFLVL bit. The electrical specifications tables detail SAR clock and throughput limitations for each reference source.
For applications with a non-varying power supply voltage, using the power supply as the voltage reference can provide the ADC with
added dynamic range at the cost of reduced power supply noise rejection. Additionally, the internal 1.8 V LDO supply to the core may
be used as a reference. Neither of these reference sources are routed to the VREF pin, and do not require additional external decou-
pling.
An external reference may be applied to the VREF pin. Bypass capacitors should be added as recommended by the manufacturer of
the external voltage reference. If the manufacturer does not provide recommendations, a 4.7 µF in parallel with a 0.1 µF capacitor is
recommended.
Note: The VREF pin is a multi-function GPIO pin. When using an external voltage reference, VREF should be configured as an analog
input and skipped by the crossbar.
To prevent ground noise generated by switching digital logic from affecting sensitive analog measurements, a separate analog ground
reference option is available. When enabled, the ground reference for the ADC during both the tracking/sampling and the conversion
periods is taken from the AGND pin. Any external sensors sampled by the ADC should be referenced to the AGND pin. If an external
voltage reference is used, the AGND pin should be connected to the ground of the external reference and its associated decoupling
capacitor. The separate analog ground reference option is enabled by setting GNDSL to 1. Note that when sampling the internal tem-
perature sensor, the internal chip ground is always used for the sampling operation, regardless of the setting of the GNDSL bit.
Similarly, whenever the internal high-speed reference is selected, the internal chip ground is always used during the conversion period,
regardless of the setting of the GNDSL bit.
Note: The AGND pin is a multi-function GPIO pin. When using AGND as the ground reference to the ADC, AGND should be configured
as an analog input and skipped by the crossbar.
The ADC has an analog multiplexer which allows selection of external pins, the on-chip temperature sensor, the internal regulated sup-
ply, the VDD supply, or GND. ADC input channels are selected using the ADC0MX register.
Note: Any port pins selected as ADC inputs should be configured as analog inputs in their associated port configuration register, and
configured to be skipped by the crossbar.
ADC0MX setting Signal Name Enumeration Name QSOP24 Pin QFN20 Pin SOIC16 Pin
Name Name Name
The ADC has gain settings of 1x and 0.5x. In 1x mode, the full scale reading of the ADC is determined directly by VREF. In 0.5x mode,
the full-scale reading of the ADC occurs when the input voltage is VREF x 2. The 0.5x gain setting can be useful to obtain a higher input
voltage range when using a small VREF voltage, or to measure input voltages that are between VREF and the supply voltage. Gain
settings for the ADC are controlled by the ADGN bit in register ADC0CF. Note that even with a gain setting of 0.5, voltages above the
supply rail cannot be measured directly by the ADC.
A conversion can be initiated in many ways, depending on the programmed state of the ADCM bitfield. Conversions may be initiated by
one of the following:
1. Software-triggered—Writing a 1 to the ADBUSY bit initiates the conversion.
2. Hardware-triggered—An automatic internal event such as a timer overflow initiates the conversion.
3. External pin-triggered—A rising edge on the CNVSTR input signal initiates the conversion.
Writing a 1 to ADBUSY provides software control of ADC0 whereby conversions are performed "on-demand". All other trigger sources
occur autonomous to code execution. When the conversion is complete, the ADC posts the result to its output register and sets the
ADC interrupt flag (ADINT). ADINT may be used to trigger a system interrupts, if enabled, or polled by firmware.
During a conversion, the ADBUSY bit is set to logic 1 and reset to logic 0 when the conversion is complete. However, the ADBUSY bit
should not be used to poll for ADC conversion completion. The ADC0 interrupt flag (ADINT) should be used instead of the ADBUSY bit.
Converted data is available in the ADC0 data registers, ADC0H:ADC0L, when the conversion is complete.
Note: The CNVSTR pin is a multi-function GPIO pin. When the CNVSTR input is used as the ADC conversion source, the associated
port pin should be skipped in the crossbar settings.
Each ADC conversion must be preceded by a minimum tracking time to allow the voltage on the sampling capacitor to settle, and for
the converted result to be accurate.
The absolute minimum tracking time is given in the electrical specifications tables. It may be necessary to track for longer than the mini-
mum tracking time specification, depending on the application. For example, if the ADC input is presented with a large series impe-
dance, it will take longer for the sampling cap to settle on the final value during the tracking phase. The exact amount of tracking time
required is a function of all series impedance (including the internal mux impedance and any external impedance sources), the sam-
pling capacitance, and the desired accuracy.
MUX Select
Input
Channel
RMUX
CSAMPLE
Note: The value of CSAMPLE depends on the PGA gain. See the electrical specifications for details.
The required ADC0 settling time for a given settling accuracy (SA) may be approximated as follows:
t = ln ( )
2n
SA
x RTOTAL x CSAMPLE
Where: SA is the settling accuracy, given as a fraction of an LSB (for example, 0.25 to settle within 1/4 LSB)
RTOTAL is the sum of the ADC mux resistance and any external source resistance.
When measuring any internal source, RTOTAL reduces to RMUX. See the electrical specification tables in the datasheet for ADC mini-
mum settling time requirements as well as the mux impedance and sampling capacitor values.
When burst mode is disabled, the ADTM bit controls the ADC track-and-hold mode. In its default state the ADC input is continuously
tracked, except when a conversion is in progress. A conversion will begin immediately when the start-of-conversion trigger occurs.
When the ADTM bit is logic 1, each conversion is preceded by a tracking period of 4 SAR clocks (after the start-of-conversion signal)
for any internal conversion trigger source. When the CNVSTR signal is used to initiate conversions with ADTM set to 1, ADC0 tracks
only when CNVSTR is low; conversion begins on the rising edge of CNVSTR. Setting ADTM to 1 is primarily useful when AMUX set-
tings are frequently changed and conversions are started using the ADBUSY bit.
CNVSTR
1 2 3 4 5 6 7 8 9 10 11 12 13 14
SAR Clocks
1 2 3 4 5 6 7 8 9 10 11 12 13 14
SAR
Clocks
Track or
ADTM = 0 Convert Track
Convert
Figure 12.3. Track and Conversion Example Timing (Normal, Non-Burst Operation)
When burst mode is enabled, additional tracking times may need to be specified. Because burst mode may power the ADC on from an
unpowered state and take multiple conversions for each start-of-conversion source, two additional timing fields are provided. If the ADC
is powered down when the burst sequence begins, it will automatically power up and wait for the time specified in the ADPWR bit field.
If the ADC is already powered on, tracking depends solely on ADTM for the first conversion. The ADTK field determines the amount of
tracking time given to any subsequent samples in burst mode—essentially, ADTK specifies how long the ADC will wait between burt-
mode conversions. If ADTM is set, an additional 4 SAR clocks will be added to the tracking phase of all conversions in burst mode.
Convert Start
ADPWR ADTK
Burst mode is a power saving feature that allows the ADC to remain in a low power state between conversions. When burst mode is
enabled, the ADC wakes from a low power state, accumulates 1, 4, 8, 16, 32, or 64 samples using the internal low-power high-frequen-
cy oscillator, then re-enters a low power state. Since the burst mode clock is independent of the system clock, the ADC can perform
multiple conversions then enter a low power state within a single system clock cycle, even if the system clock is running from a slow
oscillator.
Note: When using burst mode, care must be taken to issue a convert start signal no faster than once every four SYSCLK periods. This
includes external convert start signals. The ADC will ignore convert start signals which arrive before a burst is finished.
Burst mode is enabled by setting ADBMEN to logic 1. When in burst mode, ADEN controls the ADC idle power state (i.e., the state the
ADC enters when not tracking or performing conversions). If ADEN is set to logic 0, the ADC is powered down after each burst. If AD-
EN is set to logic 1, the ADC remains enabled after each burst. On each convert start signal, the ADC is awakened from its idle power
state. If the ADC is powered down, it will automatically power up and wait for the amount of time programmed to the ADPWR bits be-
fore performing a conversion. Otherwise, the ADC will start tracking and converting immediately.
When burst mode is enabled, a single convert start will initiate a number of conversions equal to the repeat count. When burst mode is
disabled, a convert start is required to initiate each conversion. In both modes, the ADC end of conversion interrupt flag (ADINT) will be
set after “repeat count” conversions have been accumulated. Similarly, the window comparator will not compare the result to the great-
er-than and less-than registers until “repeat count” conversions have been accumulated.
Setting the AD8BE bit to 1 will put the ADC in 8-bit mode. In 8-bit mode, only the 8 MSBs of data are converted, allowing the conversion
to be completed in fewer SAR clock cycles than a 10-bit conversion. The two LSBs of a conversion are always 00 in this mode, and the
ADC0L register will always read back 0x00.
When configured for 12-bit conversions, the ADC performs four 10-bit conversions using four different reference voltages and combines
the results into a single 12-bit value. Unlike simple averaging techniques, this method provides true 12-bit resolution of ac or dc input
signals without depending on noise to provide dithering. The converter also employs a hardware dynamic element matching algorithm
that reconfigures the largest elements of the internal DAC for each of the four 10-bit conversions. This reconfiguration cancels any
matching errors and enables the converter to achieve 12-bit linearity performance to go along with its 12-bit resolution.
The 12-bit mode is enabled by setting the AD12BE bit in register ADC0AC to logic 1 and configuring the ADC in burst mode (ADBMEN
= 1) for four or more conversions. The conversion can be initiated using any of the conversion start sources, and the 12-bit result will
appear in the ADC0H and ADC0L registers. Since the 12-bit result is formed from a combination of four 10-bit results, the maximum
output value is 4 x (1023) = 4092, rather than the max value of (2^12 – 1) = 4095 that is produced by a traditional 12-bit converter. To
further increase resolution, the burst mode repeat value may be configured to any multiple of four conversions. For example, if a repeat
value of 16 is selected, the ADC0 output will be a 14-bit number (sum of four 12-bit numbers) with 13 effective bits of resolution.
The AD12SM bit in register ADC0TK controls when the ADC will track and sample the input signal. When AD12SM is set to 1, the
selected input signal will be tracked before the first conversion of a set and held internally during all four conversions. When AD12SM is
cleared to 0, the ADC will track and sample the selected input before each of the four conversions in a set. When maximum throughput
(180-200 ksps) is needed, it is recommended that AD12SM be set to 1 and ADTK to 0x3F, and that the ADC be placed in always-on
mode (ADEN = 1). For sample rates under 180 ksps, or when accumulating multiple samples, AD12SM should normally be cleared to
0, and ADTK should be configured to provide the appropriate settling time for the subsequent conversions.
The registers ADC0H and ADC0L contain the high and low bytes of the output conversion code from the ADC at the completion of each
conversion. Data can be right-justified or left-justified, depending on the setting of the ADSJST field. When the repeat count is set to 1
in 10-bit mode, conversion codes are represented as 10-bit unsigned integers. Inputs are measured from 0 to VREF x 1023/1024. Ex-
ample codes are shown below for both right-justified and left-justified data. Unused bits in the ADC0H and ADC0L registers are set to 0.
ADC0H:L ADC0H:L
0 0x0000 0x0000
When the repeat count is greater than 1, the output conversion code represents the accumulated result of the conversions performed
and is updated after the last conversion in the series is finished. Sets of 4, 8, 16, 32, or 64 consecutive samples can be accumulated
and represented in unsigned integer format. The repeat count can be selected using the ADRPT bit field. When a repeat count is higher
than 1, the ADC output must be right-justified (ADSJST = 0xx); unused bits in the ADC0H and ADC0L registers are set to 0. The exam-
ple below shows the right-justified result for various input voltages and repeat counts. Notice that accumulating 2n samples is equiva-
lent to left-shifting by n bit positions when all samples returned from the ADC have the same value.
Additionally, the ADSJST bit field can be used to format the contents of the 16-bit accumulator. The accumulated result can be shifted
right by 1, 2, or 3 bit positions. Based on the principles of oversampling and averaging, the effective ADC resolution increases by 1 bit
each time the oversampling rate is increased by a factor of 4. The example below shows how to increase the effective ADC resolution
by 1, 2, and 3 bits to obtain an effective ADC resolution of 11- bit, 12-bit, or 13-bit respectively without CPU intervention.
The ADC has several power-saving features which can help the user optimize power consumption according to the needs of the appli-
cation. The most efficient way to use the ADC for slower sample rates is by using burst mode. Burst mode dynamically controls power
to the ADC and (if used) the internal voltage reference. By completely powering off these circuits when the ADC is not tracking or con-
verting, the average supply current required for lower sampling rates is reduced significantly.
The ADC also provides low power options that allow reduction in operating current when operating at low SAR clock frequencies or with
longer tracking times. The internal common-mode buffer can be configured for low power mode by setting the ADLPM bit in ADC0PWR
to 1. Two other fields in the ADC0PWR register (ADBIAS and ADMXLP) may be used together to adjust the power consumed by the
ADC and its multiplexer and reference buffers, respectively. In general, these options are used together, when operating with a SAR
conversion clock frequency of 4 MHz.
Table 12.5. ADC Optimal Power Configuration (8- and 10-bit Mode)
Required Reference Source Mode Configuration SAR Clock Speed Other Register Field Set-
Throughput tings
ADRPT = 0
ADRPT = 0
ADRPT = 0
ADRPT = 0
ADRPT = 0
Notes:
1. For always-on configuration, ADSC settings assume SYSCLK is the internal 24.5 MHz high-frequency oscillator. Adjust ADSC as
needed if using a different source for SYSCLK.
2. ADRPT reflects the minimum setting for this bit field. When using the ADC in Burst Mode, up to 64 samples may be auto-accumu-
lated per conversion start by adjusting ADRPT.
Required Reference Source Mode Configuration SAR Clock Speed Other Register Field Set-
Throughput tings
180-200 ksps Any Always-On + Burst Mode 12.25 MHz ADC0PWR = 0x40
ADRPT = 1
Required Reference Source Mode Configuration SAR Clock Speed Other Register Field Set-
Throughput tings
125-180 ksps Any Always-On + Burst Mode 12.25 MHz ADC0PWR = 0x40
ADRPT = 1
ADRPT = 1
ADRPT = 1
ADRPT = 1
Notes:
1. ADRPT reflects the minimum setting for this bit field. When using the ADC in burst mode, up to 64 samples may be auto-accumu-
lated per conversion trigger by adjusting ADRPT.
For applications where burst mode is used to automatically accumulate multiple results, additional supply current savings can be realiz-
ed. The length of time the ADC is active during each burst contains power-up time at the beginning of the burst as well as the conver-
sion time required for each conversion in the burst. The power-on time is only required at the beginning of each burst. When compared
with single-sample bursts to collect the same number of conversions, multi-sample bursts will consume significantly less power. For
example, performing an eight-cycle burst of 10-bit conversions consumes about 61% of the power required to perform those same eight
samples in single-cycle bursts. For 12-bit conversions, an eight-cycle burst results in about 85% of the equivalent single-cycle bursts.
See the electrical characteristics tables for details on power consumption and the maximum clock frequencies allowed in each mode.
The ADC's programmable window detector continuously compares the ADC output registers to user-programmed limits, and notifies the
system when a desired condition is detected. This is especially effective in an interrupt driven system, saving code space and CPU
bandwidth while delivering faster system response times. The window detector interrupt flag (ADWINT) can also be used in polled
mode. The ADC Greater-Than (ADC0GTH, ADC0GTL) and Less-Than (ADC0LTH, ADC0LTL) registers hold the comparison values.
The window detector flag can be programmed to indicate when measured data is inside or outside of the user-programmed limits, de-
pending on the contents of the ADC0GT and ADC0LT registers. The following tables show how the ADC0GT and ADC0LT registers
may be configured to set the ADWINT flag when the ADC output code is above, below, beween, or outside of specific values.
0x03FF ADWINT = 1
...
0x0081
0x007F
...
0x0001
0x03FE
...
0x0041
0x003F ADWINT = 1
...
0x0000
Table 12.9. ADC Window Comparator Example (Between 0x0040 and 0x0080)
...
0x0081
0x007F ADWINT = 1
...
0x0041
0x003F
...
0x0000
Table 12.10. ADC Window Comparator Example (Outside the 0x0040 to 0x0080 range)
0x03FF ADWINT = 1
...
0x0081
0x007F
...
0x0041
0x003F ADWINT = 1
...
0x0000
An on-chip analog temperature sensor is available to the ADC multiplexer input. To use the ADC to measure the temperature sensor,
the ADC mux channel should select the temperature sensor. The temperature sensor transfer function is shown in Figure 12.6 Temper-
ature Sensor Transfer Function on page 105. The output voltage (VTEMP) is the positive ADC input when the ADC multiplexer is set
correctly. The TEMPE bit in register REF0CN enables/ disables the temperature sensor. While disabled, the temperature sensor de-
faults to a high impedance state and any ADC measurements performed on the sensor will result in meaningless data. Refer to the
electrical specification tables for the slope and offset parameters of the temperature sensor.
Slope (V / deg C)
Voltage
Temperature
The uncalibrated temperature sensor output is extremely linear and suitable for relative temperature measurements. For absolute tem-
perature measurements, offset and/or gain calibration is recommended. Typically a 1-point (offset) calibration includes the following
steps:
1. Control/measure the ambient temperature (this temperature must be known).
2. Power the device, and delay for a few seconds to allow for self-heating.
3. Perform an ADC conversion with the temperature sensor selected as the ADC input.
4. Calculate the offset characteristics, and store this value in non-volatile memory for use with subsequent temperature sensor meas-
urements.
Bit 7 6 5 4 3 2 1 0
Access RW RW RW RW RW RW
Reset 0 0 0 0 0 0x0
Set by hardware upon completion of a data conversion (ADBMEN=0), or a burst of conversions (ADBMEN=1). Can trigger
an interrupt. Must be cleared by firmware.
Writing 1 to this bit initiates an ADC conversion when ADCM = 000. This bit should not be polled to indicate when a conver-
sion is complete. Instead, the ADINT bit should be used when polling for conversion completion.
Set by hardware when the contents of ADC0H:ADC0L fall within the window specified by ADC0GTH:ADC0GTL and
ADC0LTH:ADC0LTL. Can trigger an interrupt. Must be cleared by firmware.
Specifies the ADC0 start of conversion source. All remaining bit combinations are reserved.
Bit 7 6 5 4 3 2 1 0
Access R RW
Reset 0x00 0
0 CM_BUFFER_DISA- Disable the common mode buffer. This setting should be used only if the tracking
BLED time of the signal is greater than 1.5 us.
1 CM_BUFFER_ENA- Enable the common mode buffer. This setting should be used in most cases, and
BLED will give the best dynamic ADC performance. The common mode buffer must be
enabled if signal tracking time is less than or equal to 1.5 us.
Bit 7 6 5 4 3 2 1 0
Access RW RW RW RW
Reset 0x1F 0 0 0
This field sets the ADC clock divider value. It should be configured to be as close to the maximum SAR clock speed as the
datasheet will allow. The SAR clock frequency is given by the following equation:
FADCCLK is equal to the selected SYSCLK when ADBMEN is 0 and the high-frequency oscillator when ADBMEN is 1.
0 TRACK_NORMAL Normal Track Mode. When ADC0 is enabled, conversion begins immediately fol-
lowing the start-of-conversion signal.
1 TRACK_DELAYED Delayed Track Mode. When ADC0 is enabled, conversion begins 4 SAR clock cy-
cles following the start-of-conversion signal. The ADC is allowed to track during
this time.
Bit 7 6 5 4 3 2 1 0
Access RW RW RW RW
Enables 12-bit mode. In 12-bit mode, the ADC throughput is reduced by a factor of 4.
0 ACC_DISABLED ADC0H:ADC0L contain the result of the latest conversion when Burst Mode is
disabled.
1 ACC_ENABLED ADC0H:ADC0L contain the accumulated conversion results when Burst Mode is
disabled. Firmware must write 0x0000 to ADC0H:ADC0L to clear the accumula-
ted result.
Specifies the format of data read from ADC0H:ADC0L. All remaining bit combinations are reserved.
Selects the number of conversions to perform and accumulate in Burst Mode. This bit field must be set to 000 if Burst Mode
is disabled.
0x0 ACC_1 Perform and Accumulate 1 conversion (not used in 12-bit mode).
0x5 ACC_64 Perform and Accumulate 64 conversions (16 conversions in 12-bit mode).
Bit 7 6 5 4 3 2 1 0
Access RW RW RW RW
This field can be used to adjust the ADC's power consumption based on the conversion speed. Higher bias currents allow
for faster conversion times.
Enables low power mode operation for the multiplexer and voltage reference buffers.
This bit can be used to reduce power to the ADC's internal common mode buffer. It can be set to 1 to reduce power when
tracking times in the application are longer (slower sample rates).
This field sets the time delay allowed for the ADC to power up from a low power state. When ADTM is set, an additional 4
SARCLKs are added to this time.
Bit 7 6 5 4 3 2 1 0
Access RW RW RW
Reset 0 0 0x1E
This bit controls the way that the ADC samples the input when in 12-bit mode. When the ADC is configured for multiple 12-
bit conversions in burst mode, the AD12SM bit should be cleared to 0.
0 SAMPLE_FOUR The ADC will re-track and sample the input four times during a 12-bit conversion.
1 SAMPLE_ONCE The ADC will sample the input once at the beginning of each 12-bit conversion.
The ADTK field can be set to 63 to maximize throughput.
This field sets the time delay between consecutive conversions performed in Burst Mode. When ADTM is set, an additional
4 SARCLKs are added to this time.
The Burst Mode track delay is not inserted prior to the first conversion. The required tracking time for the first conversion
should be defined with the ADPWR field.
Bit 7 6 5 4 3 2 1 0
Name ADC0H
Access RW
Reset 0x00
When read, this register returns the most significant byte of the 16-bit ADC0 accumulator, formatted according to the set-
tings in ADSJST. The register may also be written, to set the upper byte of the 16-bit ADC0 accumulator.
If Accumulator shifting is enabled, the most significant bits of the value read will be zeros.
Bit 7 6 5 4 3 2 1 0
Name ADC0L
Access RW
Reset 0x00
When read, this register returns the least significant byte of the 16-bit ADC0 accumulator, formatted according to the set-
tings in ADSJST. The register may also be written, to set the lower byte of the 16-bit ADC0 accumulator.
If Accumulator shifting is enabled, the most significant bits of the value read will be zeros.
Bit 7 6 5 4 3 2 1 0
Name ADC0GTH
Access RW
Reset 0xFF
Bit 7 6 5 4 3 2 1 0
Name ADC0GTL
Access RW
Reset 0xFF
Bit 7 6 5 4 3 2 1 0
Name ADC0LTH
Access RW
Reset 0x00
Bit 7 6 5 4 3 2 1 0
Name ADC0LTL
Access RW
Reset 0x00
Bit 7 6 5 4 3 2 1 0
Access R RW
Selects the positive input channel for ADC0. For reserved bit combinations, no input is selected.
Bit 7 6 5 4 3 2 1 0
Access RW R RW RW RW R
0x2 INTERNAL_LDO The ADC0 voltage reference is the internal 1.8 V digital supply voltage.
0x3 INTERNAL_VREF The ADC0 voltage reference is the internal voltage reference.
13.1 Introduction
Analog comparators are used to compare the voltage of two analog inputs, with a digital output indicating which input voltage is higher.
External input connections to device I/O pins and internal connections are available through separate multiplexers on the positive and
negative inputs. Hysteresis, response time, and current consumption may be programmed to suit the specific needs of the application.
CMPn
Positive Input
Selection Programmable
Hysteresis
Port Pins
CPnA
(asynchronous)
Internal LDO CMPn+
CPn
(synchronous)
CMPn- D Q
SYSCLK
Port Pins
Q
GND
Programmable
Negative Input Response Time
Selection
13.2 Features
Response time is the amount of time delay between a change at the comparator inputs and the comparator's reaction at the output.
The comparator response time may be configured in software via the CPMD field in the CMPnMD register. Selecting a longer response
time reduces the comparator supply current, while shorter response times require more supply current.
13.3.2 Hysteresis
The comparator hysteresis is software-programmable via its Comparator Control register CMPnCN. The user can program both the
amount of hysteresis voltage (referred to the input voltage) and the positive and negative-going symmetry of this hysteresis around the
threshold voltage.
The comparator hysteresis is programmable using the CPHYN and CPHYP fields in the Comparator Control Register CMPnCN. The
amount of negative hysteresis voltage is determined by the settings of the CPHYN bits. Settings of 20, 10, or 5 mV (nominal) of nega-
tive hysteresis can be programmed, or negative hysteresis can be disabled. In a similar way, the amount of positive hysteresis is deter-
mined by the setting the CPHYP bits.
Positive programmable
hysteresis (CPHYP)
CPn-
CPn+
Negative programmable
hysteresis (CPHYN)
CP0 (out)
Comparator inputs may be routed to port I/O pins or internal signals. When connected externally, the comparator inputs can be driven
from –0.25 V to (VDD) +0.25 V without damage or upset. The CMPnMX register selects the inputs for the associated comparator. The
CMXP field selects the comparator’s positive input (CPnP.x) and the CMXN field selects the comparator’s negative input (CPnN.x).
Note: Any port pins selected as comparator inputs should be configured as analog inputs in their associated port configuration register,
and configured to be skipped by the crossbar.
CMXP Setting in Signal Name Enumeration Name QSOP24 Pin QFN20 Pin SOIC16 Pin
Register Name Name Name
CMP0MX
CMXN Setting in Signal Name Enumeration Name QSOP24 Pin QFN20 Pin SOIC16 Pin
Register Name Name Name
CMP0MX
CMXP Setting in Signal Name Enumeration Name QSOP24 Pin QFN20 Pin SOIC16 Pin
Register Name Name Name
CMP1MX
CMXP Setting in Signal Name Enumeration Name QSOP24 Pin QFN20 Pin SOIC16 Pin
Register Name Name Name
CMP1MX
CMXN Setting in Signal Name Enumeration Name QSOP24 Pin QFN20 Pin SOIC16 Pin
Register Name Name Name
CMP1MX
The comparator’s synchronous and asynchronous outputs can optionally be routed to port I/O pins through the port I/O crossbar. The
output of either comparator may be configured to generate a system interrupt on rising, falling, or both edges. CMP0 may also be used
as a reset source or as a trigger to kill a PCA output channel.
The output state of the comparator can be obtained at any time by reading the CPOUT bit. The comparator is enabled by setting the
CPEN bit to logic 1, and is disabled by clearing this bit to logic 0. When disabled, the comparator output (if assigned to a port I/O pin via
the crossbar) defaults to the logic low state, and the power supply to the comparator is turned off.
Comparator interrupts can be generated on both rising-edge and falling-edge output transitions. The CPFIF flag is set to logic 1 upon a
comparator falling-edge occurrence, and the CPRIF flag is set to logic 1 upon the comparator rising-edge occurrence. Once set, these
bits remain set until cleared by software. The comparator rising-edge interrupt mask is enabled by setting CPRIE to a logic 1. The com-
parator falling-edge interrupt mask is enabled by setting CPFIE to a logic 1.
False rising edges and falling edges may be detected when the comparator is first powered on or if changes are made to the hysteresis
or response time control bits. Therefore, it is recommended that the rising-edge and falling-edge flags be explicitly cleared to logic 0 a
short time after the comparator is enabled or its mode bits have been changed, before enabling comparator interrupts.
Bit 7 6 5 4 3 2 1 0
Access RW R RW RW RW RW
0 NOT_SET No comparator rising edge has occurred since this flag was last cleared.
0 NOT_SET No comparator falling edge has occurred since this flag was last cleared.
Bit 7 6 5 4 3 2 1 0
Access RW R RW RW R RW
This bit represents the comparator output value at the most recent PCA counter overflow.
These bits affect the response time and power consumption of the comparator.
Bit 7 6 5 4 3 2 1 0
Access RW RW
Bit 7 6 5 4 3 2 1 0
Access RW R RW RW RW RW
0 NOT_SET No comparator rising edge has occurred since this flag was last cleared.
0 NOT_SET No comparator falling edge has occurred since this flag was last cleared.
Bit 7 6 5 4 3 2 1 0
Access RW R RW RW R RW
This bit represents the comparator output value at the most recent PCA counter overflow.
These bits affect the response time and power consumption of the comparator.
Bit 7 6 5 4 3 2 1 0
Access RW RW
14.1 Introduction
The cyclic redundancy check (CRC) module performs a CRC using a 16-bit polynomial. CRC0 accepts a stream of 8-bit data and posts
the 16-bit result to an internal register. In addition to using the CRC block for data manipulation, hardware can automatically CRC the
flash contents of the device.
CRC
8
CRC0IN
Automatic
Flash 8 Hardware CRC
flash read
Memory control Seed Calculation Unit
(0x0000 or
0xFFFF)
8 8
8 byte-level bit 8
CRC0FLIP
reversal
CRC0DAT
14.2 Features
The CRC module is designed to provide hardware calculations for flash memory verification and communications protocols. The CRC
module supports the standard CCITT-16 16-bit polynomial (0x1021), and includes the following features:
• Support for CCITT-16 polynomial
• Byte-level bit reversal
• Automatic CRC of flash contents on one or more 256-byte blocks
• Initial seed selection of 0x0000 or 0xFFFF
The CRC unit generates a 16-bit CRC result equivalent to the following algorithm:
1. XOR the input with the most-significant bits of the current CRC result. If this is the first iteration of the CRC unit, the current CRC
result will be the set initial value (0x0000 or 0xFFFF).
2. If the MSB of the CRC result is set, shift the CRC result and XOR the result with the polynomial.
3. If the MSB of the CRC result is not set, shift the CRC result.
4. Repeat steps 2 and 3 for all 8 bits.
// "Divide" the poly into the dividend using CRC XOR subtraction
// CRC_acc holds the "remainder" of each divide
//
// Only complete this division for 8 bits since input is 1 byte
for (i = 0; i < 8; i++)
{
// Check if the MSB is set (if MSB is 1, then the POLY can "divide"
// into the "dividend")
if ((CRC_acc & 0x8000) == 0x8000)
{
// if so, shift the CRC value, and XOR "subtract" the poly
CRC_acc = CRC_acc << 1;
CRC_acc ^= POLY;
}
else
{
// if not, just shift the CRC value
CRC_acc = CRC_acc << 1;
}
}
The following table lists several input values and the associated outputs using the 16-bit CRC algorithm:
Input Output
0x63 0xBD35
0x8C 0xB1F4
0x7D 0x4ECA
The CRC module may be used to perform CRC calculations on any data set available to the firmware. To perform a CRC on an arbitra-
ry data sream:
1. Select the initial result value using CRCVAL.
2. Set the result to its initial value (write 1 to CRCINIT).
3. Write the data to CRC0IN one byte at a time. The CRC result registers are automatically updated after each byte is written.
4. Write the CRCPNT bit to 0 to target the low byte of the result.
5. Read CRC0DAT multiple times to access each byte of the CRC result. CRCPNT will automatically point to the next value after
each read.
The CRC module may be configured to automatically perform a CRC on one or more blocks of code memory. To perform a CRC on
code contents:
1. Select the initial result value using CRCVAL.
2. Set the result to its initial value (write 1 to CRCINIT).
3. Write the high byte of the starting address to the CRCST bit field.
4. Set the AUTOEN bit to 1.
5. Write the number of byte blocks to perform in the CRC calculation to CRCCNT.
6. Write any value to CRC0CN0 (or OR its contents with 0x00) to initiate the CRC calculation. The CPU will not execute code any
additional code until the CRC operation completes.
Note: Upon initiation of an automatic CRC calculation, the three cycles following a write to CRC0CN0 that initiate a CRC operation
must only contain instructions which execute in the same number of cycles as the number of bytes in the instruction. An example of
such an instruction is a 3-byte MOV that targets the CRC0FLIP register. When programming in C, the dummy value written to
CRC0FLIP should be a non-zero value to prevent the compiler from generating a 2-byte MOV instruction.
CRC0 includes hardware to reverse the bit order of each bit in a byte. Writing a byte to CRC0FLIP initiates the bit reversal operation,
and the result may be read back from CRC0FLIP on the next instruction. For example, if 0xC0 is written to CRC0FLIP, the data read
back is 0x03. Bit reversal can be used to change the order of information passing through the CRC engine and is also used in algo-
rithms such as FFT.
Bit 7 6 5 4 3 2 1 0
Access R RW RW R RW
Reset 0x1 0 0 0 0
Writing a 1 to this bit initializes the entire CRC result based on CRCVAL.
Specifies the byte of the CRC result to be read/written on the next access to CRC0DAT. This bit will automatically toggle
upon each read or write.
Upon initiation of an automatic CRC calculation, the three cycles following a write to CRC0CN0 that initiate a CRC operation must
only contain instructions which execute in the same number of cycles as the number of bytes in the instruction. An example of such an
instruction is a 3-byte MOV that targets the CRC0FLIP register. When programming in C, the dummy value written to CRC0FLIP
should be a non-zero value to prevent the compiler from generating a 2-byte MOV instruction.
Bit 7 6 5 4 3 2 1 0
Name CRC0IN
Access RW
Reset 0x00
Each write to CRC0IN results in the written data being computed into the existing CRC result according to the CRC algo-
rithm.
Bit 7 6 5 4 3 2 1 0
Name CRC0DAT
Access RW
Reset 0x00
Each read or write performed on CRC0DAT targets the CRC result bits pointed to by the CRC0 Result Pointer (CRCPNT
bits in CRC0CN0).
CRC0DAT may not be valid for one cycle after setting the CRCINIT bit in the CRC0CN0 register to 1. Any time CRCINIT is written to 1
by firmware, at least one instruction should be performed before reading CRC0DAT.
Bit 7 6 5 4 3 2 1 0
Access RW R RW
Reset 0 0 0x00
When AUTOEN is set to 1, any write to CRC0CN0 will initiate an automatic CRC starting at flash sector CRCST and con-
tinuing for CRCCNT sectors.
These bits specify the flash block to start the automatic CRC calculation. The starting address of the first flash block inclu-
ded in the automatic CRC calculation is CRCST x block_size, where block_size is 256 bytes.
Bit 7 6 5 4 3 2 1 0
Access R R RW
Set to 0 when a CRC calculation is in progress. Code execution is stopped during a CRC calculation; therefore, reads from
firmware will always return 1.
These bits specify the number of flash blocks to include in an automatic CRC calculation. The last address of the last flash
block included in the automatic CRC calculation is (CRCST+CRCCNT) x Block Size - 1. The block size is 256 bytes.
Bit 7 6 5 4 3 2 1 0
Name CRC0FLIP
Access RW
Reset 0x00
Any byte written to CRC0FLIP is read back in a bit-reversed order, i.e., the written LSB becomes the MSB. For example:
15.1 Introduction
The programmable counter array (PCA) provides multiple channels of enhanced timer and PWM functionality while requiring less CPU
intervention than standard counter/timers. The PCA consists of a dedicated 16-bit counter/timer and one 16-bit capture/compare mod-
ule for each channel. The counter/timer is driven by a programmable timebase that has flexible external and internal clocking options.
Each capture/compare module may be configured to operate independently in one of five modes: Edge-Triggered Capture, Software
Timer, High-Speed Output, Frequency Output, or Pulse-Width Modulated (PWM) Output. Each capture/compare module has its own
associated I/O line (CEXn) which is routed through the crossbar to port I/O when enabled.
PCA0
SYSCLK
SYSCLK / 4
SYSCLK / 12
Control / Interrupt
Timer 0 Overflow PCA Counter
Configuration Logic
EXTCLK / 8 Sync
ECI Sync
SYSCLK
Channel 2 CEX2
Mode Control Output
Channel 1 Drive CEX1
Logic
Capture
Mode/ Compare
Control
Channel 0 CEX0
Capture / Compare
Mode Control
Capture / Compare
Comparator 0 Output
Polarity Select
Comparator
Clear Enable
15.2 Features
The 16-bit PCA counter/timer consists of two 8-bit SFRs: PCA0L and PCA0H. PCA0H is the high byte of the 16-bit counter/timer and
PCA0L is the low byte. Reading PCA0L automatically latches the value of PCA0H into a “snapshot” register; the following PCA0H read
accesses this “snapshot” register.
Note: Reading the PCA0L Register first guarantees an accurate reading of the entire 16-bit PCA0 counter.
Reading PCA0H or PCA0L does not disturb the counter operation. The CPS2–CPS0 bits in the PCA0MD register select the timebase
for the counter/timer.
When the counter/timer overflows from 0xFFFF to 0x0000, the Counter Overflow Flag (CF) in PCA0MD is set to logic 1 and an interrupt
request is generated if CF interrupts are enabled. Setting the ECF bit in PCA0MD to logic 1 enables the CF flag to generate an interrupt
request. The CF bit is not automatically cleared by hardware when the CPU vectors to the interrupt service routine and must be cleared
by software. Clearing the CIDL bit in the PCA0MD register allows the PCA to continue normal operation while the CPU is in Idle mode.
CPS2:0 Timebase
111 Reserved
Note:
1. Synchronized with the system clock.
The PCA0 module shares one interrupt vector among all of its modules. There are are several event flags that can be used to generate
a PCA0 interrupt. They are as follows: the main PCA counter overflow flag (CF), which is set upon a 16-bit overflow of the PCA0 coun-
ter; an intermediate overflow flag (COVF), which can be set on an overflow from the 8th–11th bit of the PCA0 counter; and the individu-
al flags for each PCA channel (CCFn), which are set according to the operation mode of that module. These event flags are always set
when the trigger condition occurs. Each of these flags can be individually selected to generate a PCA0 interrupt using the correspond-
ing interrupt enable flag (ECF for CF, ECOV for COVF, and ECCFn for each CCFn). PCA0 interrupts must be globally enabled before
any individual interrupt sources are recognized by the processor. PCA0 interrupts are globally enabled by setting the EA bit and the
EPCA0 bit to logic 1.
Each module can be configured to operate independently in one of six operation modes: edge-triggered capture, software timer, high-
speed output, frequency output, 8 to 11-bit pulse width modulator, or 16-bit pulse width modulator. Table 15.2 PCA0CPM and
PCA0PWM Bit Settings for PCA Capture/Compare Modules on page 135 summarizes the bit settings in the PCA0CPMn and
PCA0PWM registers used to select the PCA capture/compare module’s operating mode. All modules set to use 8-, 9-, 10-, or 11-bit
PWM mode must use the same cycle length (8–11 bits). Setting the ECCFn bit in a PCA0CPMn register enables the module's CCFn
interrupt.
Table 15.2. PCA0CPM and PCA0PWM Bit Settings for PCA Capture/Compare Modules
Reserved
PWM16
ARSEL
CLSEL
ECOM
CAPN
ECOV
CAPP
COVF
ECCF
PWM
MAT
TOG
Bit Name
Software Timer X C 0 0 1 0 0 A 0 X B X X
Frequency Output X C 0 0 0 1 1 A 0 X B X X
Notes:
1. X = Don’t Care (no functional difference for individual module if 1 or 0).
2. A = Enable interrupts for this module (PCA interrupt triggered on CCFn set to 1).
3. B = Enable 8th–11th bit overflow interrupt (Depends on setting of CLSEL).
4. C = When set to 0, the digital comparator is off. For high speed and frequency output modes, the associated pin will not toggle. In
any of the PWM modes, this generates a 0% duty cycle (output = 0).
5. D = Selects whether the Capture/Compare register (0) or the Auto-Reload register (1) for the associated channel is accessed via
addresses PCA0CPHn and PCA0CPLn.
6. E = When set, a match event will cause the CCFn flag for the associated channel to be set.
7. All modules set to 8, 9, 10 or 11-bit PWM mode use the same cycle length setting.
The output polarity of each PCA channel is individually selectable using the PCA0POL register. By default, all output channels are con-
figured to drive the PCA output signals (CEXn) with their internal polarity. When the CEXnPOL bit for a specific channel is set to 1, that
channel’s output signal will be inverted at the pin. All other properties of the channel are unaffected, and the inversion does not apply to
PCA input signals. Changes in the PCA0POL register take effect immediately at the associated output pin.
In this mode, a valid transition on the CEXn pin causes the PCA to capture the value of the PCA counter/timer and load it into the
corresponding module's 16-bit capture/compare register (PCA0CPLn and PCA0CPHn). The CAPPn and CAPNn bits in the PCA0CPMn
register are used to select the type of transition that triggers the capture: low-to-high transition (positive edge), high-to-low transition
(negative edge), or either transition (positive or negative edge). When a capture occurs, the Capture/Compare Flag (CCFn) in
PCA0CN0 is set to logic 1. An interrupt request is generated if the CCFn interrupt for that module is enabled. The CCFn bit is not auto-
matically cleared by hardware when the CPU vectors to the interrupt service routine, and must be cleared by software. If both CAPPn
and CAPNn bits are set to logic 1, then the state of the port pin associated with CEXn can be read directly to determine whether a
rising-edge or falling-edge caused the capture.
Capture
CEXn
CAPNn
Note: The CEXn input signal must remain high or low for at least 2 system clock cycles to be recognized by the hardware.
In Software Timer mode, the PCA counter/timer value is compared to the module's 16-bit capture/compare register (PCA0CPHn and
PCA0CPLn). When a match occurs, the Capture/Compare Flag (CCFn) in PCA0CN0 is set to logic 1. An interrupt request is generated
if the CCFn interrupt for that module is enabled. The CCFn bit is not automatically cleared by hardware when the CPU vectors to the
interrupt service routine, and it must be cleared by software. Setting the ECOMn and MATn bits in the PCA0CPMn register enables
Software Timer mode.
Note: When writing a 16-bit value to the PCA0 Capture/Compare registers, the low byte should always be written first. Writing to
PCA0CPLn clears the ECOMn bit to 0; writing to PCA0CPHn sets ECOMn to 1.
PCA0CPLn PCA0CPHn
match
ECOMn 16-bit Comparator CCFn
(Compare Enable) (Interrupt Flag)
In High-Speed Output mode, a module’s associated CEXn pin is toggled each time a match occurs between the PCA Counter and the
module's 16-bit capture/compare register (PCA0CPHn and PCA0CPLn). When a match occurs, the capture/compare flag (CCFn) in
PCA0CN0 is set to logic 1. An interrupt request is generated if the CCFn interrupt for that module is enabled. The CCFn bit is not auto-
matically cleared by hardware when the CPU vectors to the interrupt service routine. It must be cleared by software. Setting the TOGn,
MATn, and ECOMn bits in the PCA0CPMn register enables the High-Speed Output mode. If ECOMn is cleared, the associated pin
retains its state and not toggle on the next match event.
Note: When writing a 16-bit value to the PCA0 Capture/Compare registers, the low byte should always be written first. Writing to
PCA0CPLn clears the ECOMn bit to 0; writing to PCA0CPHn sets ECOMn to 1.
PCA0CPLn PCA0CPHn
match
ECOMn 16-bit Comparator CCFn
(Compare Enable) (Interrupt Flag)
Toggle
CEXn
PCA Clock PCA0L PCA0H
Frequency Output Mode produces a programmable-frequency square wave on the module’s associated CEXn pin. The capture/
compare module high byte holds the number of PCA clocks to count before the output is toggled. The frequency of the square wave is
then defined as follows:
F PCA
F CEXn =
2 × PCA0CPHn
Note: A value of 0x00 in the PCA0CPHn register is equal to 256 for this equation.
Where FPCA is the frequency of the clock selected by the CPS2–0 bits in the PCA mode register PCA0MD. The lower byte of the cap-
ture/compare module is compared to the PCA counter low byte; on a match, n is toggled and the offset held in the high byte is added to
the matched value in PCA0CPLn. Frequency Output Mode is enabled by setting the ECOMn, TOGn, and PWMn bits in the PCA0CPMn
register.
Note: The MATn bit should normally be set to 0 in this mode. If the MATn bit is set to 1, the CCFn flag for the channel will be set when
the 16-bit PCA0 counter and the 16-bit capture/compare register for the channel are equal.
Adder
Enable
Toggle
8-bit match
ECOMn Comparator
CEXn
(Compare Enable)
The PCA can generate edge- or center-aligned PWM waveforms with resolutions of 8, 9, 10, 11, or 16 bits. PWM resolution depends on
the module setup, as specified within the individual module PCA0CPMn registers as well as the PCA0PWM register. Modules can be
configured for 8-11 bit mode or for 16-bit mode individually using the PCA0CPMn registers. All modules configured for 8-11 bit mode
have the same resolution, specified by the PCA0PWM register. When operating in one of the PWM modes, each module may be indi-
vidually configured for center or edge-aligned PWM waveforms. Each channel has a single bit in the PCA0CENT register to select be-
tween the two options.
When configured for edge-aligned mode, a module generates an edge transition at two points for every 2N PCA clock cycles, where N
is the selected PWM resolution in bits. In edge-aligned mode, these two edges are referred to as the “match” and “overflow” edges. The
polarity at the output pin is selectable and can be inverted by setting the appropriate channel bit to 1 in the PCA0POL register. Prior to
inversion, a match edge sets the channel to logic high, and an overflow edge clears the channel to logic low.
The match edge occurs when the the lowest N bits of the module’s PCA0CPn register match the corresponding bits of the main PCA0
counter register. For example, with 10-bit PWM, the match edge occurs any time bits 9-0 of the PCA0CPn register match bits 9-0 of the
PCA0 counter value.
The overflow edge occurs when an overflow of the PCA0 counter happens at the desired resolution. For example, with 10-bit PWM, the
overflow edge occurs when bits 0-9 of the PCA0 counter transition from all 1s to all 0s. All modules configured for edge-aligned mode at
the same resolution align on the overflow edge of the waveforms.
An example of the PWM timing in edge-aligned mode for two channels is shown here. In this example, the CEX0POL and CEX1POL
bits are cleared to 0.
PCA Clock
Output (CEX0)
match edge
Output (CEX1)
For a given PCA resolution, the unused high bits in the PCA0 counter and the PCA0CPn compare registers are ignored, and only the
used bits of the PCA0CPn register determine the duty cycle. Figure 15.7 N-bit Edge-Aligned PWM Duty Cycle With CEXnPOL = 0 (N =
PWM resolution) on page 140describes the duty cycle when CEXnPOL in the PCA0POL regsiter is cleared to 0. Figure 15.8 N-bit
Edge-Aligned PWM Duty Cycle With CEXnPOL = 1 (N = PWM resolution) on page 141 describes the duty cycle when CEXnPOL in the
PCA0POL regsiter is set to 1. A 0% duty cycle for the channel (with CEXnPOL = 0) is achieved by clearing the module’s ECOM bit to 0.
This will disable the comparison, and prevent the match edge from occuring.
Note: Although the PCA0CPn compare register determines the duty cycle, it is not always appropriate for firmware to update this regis-
ter directly. See the sections on 8 to 11-bit and 16-bit PWM mode for additional details on adjusting duty cycle in the various modes.
2N - PCA0CPn
Duty Cycle =
2N
Figure 15.7. N-bit Edge-Aligned PWM Duty Cycle With CEXnPOL = 0 (N = PWM resolution)
PCA0CPn
Duty Cycle =
2N
Figure 15.8. N-bit Edge-Aligned PWM Duty Cycle With CEXnPOL = 1 (N = PWM resolution)
When configured for center-aligned mode, a module generates an edge transition at two points for every 2(N+1) PCA clock cycles,
where N is the selected PWM resolution in bits. In center-aligned mode, these two edges are referred to as the “up” and “down” edges.
The polarity at the output pin is selectable and can be inverted by setting the appropriate channel bit to 1 in the PCA0POL register.
The generated waveforms are centered about the points where the lower N bits of the PCA0 counter are zero. The (N+1)th bit in the
PCA0 counter acts as a selection between up and down edges. In 16-bit mode, a special 17th bit is implemented internally for this
purpose. At the center point, the (non-inverted) channel output is low when the (N+1)th bit is 0 and high when the (N+1)th bit is 1, except
for cases of 0% and 100% duty cycle. Prior to inversion, an up edge sets the channel to logic high, and a down edge clears the channel
to logic low.
Down edges occur when the (N+1)th bit in the PCA0 counter is one and a logical inversion of the value in the module’s PCA0CPn regis-
ter matches the main PCA0 counter register for the lowest N bits. For example, with 10-bit PWM, the down edge occurs when the one’s
complement of bits 9-0 of the PCA0CPn register match bits 9-0 of the PCA0 counter and bit 10 of the PCA0 counter is 1.
Up edges occur when the (N+1)th bit in the PCA0 counter is zero and the lowest N bits of the module’s PCA0CPn register match the
value of (PCA0 - 1). For example, with 10-bit PWM, the up edge occurs when bits 9-0 of the PCA0CPn register are one less than bits
9-0 of the PCA0 counter and bit 10 of the PCA0 counter is 0.
An example of the PWM timing in center-aligned mode for two channels is shown here. In this example, the CEX0POL and CEX1POL
bits are cleared to 0.
center
PCA Clock
Counter (PCA0L) 0xFB 0xFC 0xFD 0xFE 0xFF 0x00 0x01 0x02 0x03 0x04
Figure 15.10 N-bit Center-Aligned PWM Duty Cycle With CEXnPOL = 0 (N = PWM resolution) on page 143 describes the duty cycle
when CEXnPOL in the PCA0POL regsiter is cleared to 0. Figure 15.11 N-bit Center-Aligned PWM Duty Cycle With CEXnPOL = 1 (N =
PWM resolution) on page 143 describes the duty cycle when CEXnPOL in the PCA0POL regsiter is set to 1. The equations are true
only when the lowest N bits of the PCA0CPn register are not all 0s or all 1s. With CEXnPOL equal to zero, 100% duty cycle is produced
when the lowest N bits of PCA0CPn are all 0, and 0% duty cycle is produced when the lowest N bits of PCA0CPn are all 1. For a given
PCA resolution, the unused high bits in the PCA0 counter and the PCA0CPn compare registers are ignored, and only the used bits of
the PCA0CPn register determine the duty cycle.
Note: Although the PCA0CPn compare register determines the duty cycle, it is not always appropriate for firmware to update this regis-
ter directly. See the sections on 8 to 11-bit and 16-bit PWM mode for additional details on adjusting duty cycle in the various modes.
1
2N - PCA0CPn -
2
Duty Cycle =
2N
Figure 15.10. N-bit Center-Aligned PWM Duty Cycle With CEXnPOL = 0 (N = PWM resolution)
1
PCA0CPn +
2
Duty Cycle =
2N
Figure 15.11. N-bit Center-Aligned PWM Duty Cycle With CEXnPOL = 1 (N = PWM resolution)
Each module can be used independently to generate a pulse width modulated (PWM) output on its associated CEXn pin. The frequen-
cy of the output is dependent on the timebase for the PCA counter/timer and the setting of the PWM cycle length (8 through 11-bits).
For backwards-compatibility with the 8-bit PWM mode available on other devices, the 8-bit PWM mode operates slightly different than 9
through 11-bit PWM modes.
Important: All channels configured for 8 to 11-bit PWM mode use the same cycle length. It is not possible to configure one channel for
8-bit PWM mode and another for 11-bit mode (for example). However, other PCA channels can be configured to Pin Capture, High-
Speed Output, Software Timer, Frequency Output, or 16-bit PWM mode independently. Each channel configured for a PWM mode can
be individually selected to operate in edge-aligned or center-aligned mode.
In 8-bit PWM mode, the duty cycle is determined by the value of the low byte of the PCA0CPn register (PCA0CPLn). To adjust the duty
cycle, PCA0CPLn should not normally be written directly. Instead, the recommendation is to adjust the duty cycle using the high byte of
the PCA0CPn register (register PCA0CPHn). This allows seamless updating of the PWM waveform as PCA0CPLn is reloaded auto-
matically with the value stored in PCA0CPHn during the overflow edge (in edge-aligned mode) or the up edge (in center-aligned mode).
Setting the ECOMn and PWMn bits in the PCA0CPMn register and setting the CLSEL bits in register PCA0PWM to 00b enables 8-Bit
pulse width modulator mode. If the MATn bit is set to 1, the CCFn flag for the module is set each time a match edge or up edge occurs.
The COVF flag in PCA0PWM can be used to detect the overflow (falling edge), which occurs every 256 PCA clock cycles.
In 9 to 11-bit PWM mode, the duty cycle is determined by the value of the least significant N bits of the PCA0CPn register, where N is
the selected PWM resolution.
To adjust the duty cycle, PCA0CPn should not normally be written directly. Instead, the recommendation is to adjust the duty cycle by
writing to an “Auto-Reload” register, which is dual-mapped into the PCA0CPHn and PCA0CPLn register locations. The data written to
define the duty cycle should be right-justified in the registers. The auto-reload registers are accessed (read or written) when the bit AR-
SEL in PCA0PWM is set to 1. The capture/compare registers are accessed when ARSEL is set to 0. This allows seamless updating of
the PWM waveform, as the PCA0CPn register is reloaded automatically with the value stored in the auto-reload registers during the
overflow edge (in edge-aligned mode) or the up edge (in center-aligned mode).
Setting the ECOMn and PWMn bits in the PCA0CPMn register and setting the CLSEL bits in register PCA0PWM to 00b enables 8-Bit
pulse width modulator mode. If the MATn bit is set to 1, the CCFn flag for the module is set each time a match edge or up edge occurs.
The COVF flag in PCA0PWM can be used to detect the overflow or down edge.
The 9 to 11-bit PWM mode is selected by setting the ECOMn and PWMn bits in the PCA0CPMn register and setting the CLSEL bits in
register PCA0PWM to the desired cycle length (other than 8-bits). If the MATn bit is set to 1, the CCFn flag for the module is set each
time a match edge or up edge occurs. The COVF flag in PCA0PWM can be used to detect the overflow or down edge.
Important: When writing a 16-bit value to the PCA0CPn registers, the low byte should always be written first. Writing to PCA0CPLn
clears the ECOMn bit to 0; writing to PCA0CPHn sets ECOMn to 1.
A PCA module may also be operated in 16-Bit PWM mode. 16-bit PWM mode is independent of the other PWM modes. The entire
PCA0CP register is used to determine the duty cycle in 16-bit PWM mode.
To output a varying duty cycle, new value writes should be synchronized with the PCA CCFn match flag to ensure seamless updates.
16-Bit PWM mode is enabled by setting the ECOMn, PWMn, and PWM16n bits in the PCA0CPMn register. For a varying duty cycle,
the match interrupt flag should be enabled (ECCFn = 1 AND MATn = 1) to help synchronize the capture/compare register writes. If the
MATn bit is set to 1, the CCFn flag for the module is set each time a match edge or up edge occurs. The CF flag in PCA0CN0 can be
used to detect the overflow or down edge.
Important: When writing a 16-bit value to the PCA0 Capture/Compare registers, the low byte should always be written first. Writing to
PCA0CPLn clears the ECOMn bit to 0; writing to PCA0CPHn sets ECOMn to 1.
In 8/9/10/11/16-bit PWM modes, the comparator clear function utilizes the Comparator0 output synchronized to the system clock to
clear CEXn to logic low for the current PWM cycle. This comparator clear function can be enabled for each PWM channel by setting the
CPCEn bits to 1 in the PCA0CLR SFR. When the comparator clear function is disabled, CEXn is unaffected.
The asynchronous Comparator 0 output is logic high when the voltage of CP0+ is greater than CP0– and logic low when the voltage of
CP0+ is less than CP0–. The polarity of the Comparator 0 output is used to clear CEXn as follows: when CPCPOL = 0, CEXn is cleared
on the falling edge of the Comparator0 output.
CEXn (CPCEn = 0)
Comparator0 Output
(CPCPOL = 0)
CEXn (CPCEn = 1)
When CPCPOL = 1, CEXn is cleared on the rising edge of the Comparator0 output.
CEXn (CPCEn = 0)
Comparator0 Output
(CPCPOL = 1)
CEXn (CPCEn = 1)
In the PWM cycle following the current cycle, should the Comparator 0 output remain logic low when CPCPOL = 0 or logic high when
CPCPOL = 1, CEXn will continue to be cleared.
CEXn (CPCEn = 0)
Comparator0 Output
(CPCPOL = 0)
CEXn (CPCEn = 1)
CEXn (CPCEn = 0)
Comparator0 Output
(CPCPOL = 1)
CEXn (CPCEn = 1)
Bit 7 6 5 4 3 2 1 0
Access RW RW R RW RW RW
Reset 0 0 0x0 0 0 0
Set by hardware when the PCA Counter/Timer overflows from 0xFFFF to 0x0000. When the Counter/Timer Overflow (CF)
interrupt is enabled, setting this bit causes the CPU to vector to the PCA interrupt service routine. This bit is not automati-
cally cleared by hardware and must be cleared by firmware.
This bit is set by hardware when a match or capture occurs. When the CCF2 interrupt is enabled, setting this bit causes the
CPU to vector to the PCA interrupt service routine. This bit is not automatically cleared by hardware and must be cleared
by firmware.
This bit is set by hardware when a match or capture occurs. When the CCF1 interrupt is enabled, setting this bit causes the
CPU to vector to the PCA interrupt service routine. This bit is not automatically cleared by hardware and must be cleared
by firmware.
This bit is set by hardware when a match or capture occurs. When the CCF0 interrupt is enabled, setting this bit causes the
CPU to vector to the PCA interrupt service routine. This bit is not automatically cleared by hardware and must be cleared
by firmware.
Bit 7 6 5 4 3 2 1 0
Access RW R RW RW
0 NORMAL PCA continues to function normally while the system controller is in Idle Mode.
1 SUSPEND PCA operation is suspended while the system controller is in Idle Mode.
These bits select the timebase source for the PCA counter.
0x3 ECI High-to-low transitions on ECI (max rate = system clock divided by 4).
0x5 EXTOSC_DIV_8 External clock divided by 8 (synchronized with the system clock).
This bit sets the masking of the PCA Counter/Timer Overflow (CF) interrupt.
Bit 7 6 5 4 3 2 1 0
Access RW RW RW R RW
This bit selects whether to read and write the normal PCA capture/compare registers (PCA0CPn), or the Auto-Reload reg-
isters at the same SFR addresses. This function is used to define the reload value for 9 to 11-bit PWM modes. In all other
modes, the Auto-Reload registers have no function.
This bit sets the masking of the Cycle Overflow Flag (COVF) interrupt.
This bit indicates an overflow of the 8th to 11th bit of the main PCA counter (PCA0). The specific bit used for this flag de-
pends on the setting of the Cycle Length Select bits. The bit can be set by hardware or firmware, but must be cleared by
firmware.
0 NO_OVERFLOW No overflow has occurred since the last time this bit was cleared.
1 OVERFLOW An overflow has occurred since the last time this bit was cleared.
When 16-bit PWM mode is not selected, these bits select the length of the PWM cycle. This affects all channels configured
for PWM which are not using 16-bit PWM mode. These bits are ignored for individual channels configured to 16-bit PWM
mode.
Bit 7 6 5 4 3 2 1 0
Access RW R RW RW RW
Reset 0 0x0 0 0 0
Selects the polarity of the comparator result that will clear the PCA channel(s).
0 LOW PCA channel(s) will be cleared when comparator result goes logic low.
1 HIGH PCA channel(s) will be cleared when comparator result goes logic high.
Bit 7 6 5 4 3 2 1 0
Name PCA0L
Access RW
Reset 0x00
The PCA0L register holds the low byte (LSB) of the 16-bit PCA Counter/Timer.
Bit 7 6 5 4 3 2 1 0
Name PCA0H
Access RW
Reset 0x00
The PCA0H register holds the high byte (MSB) of the 16-bit PCA Counter/Timer. Reads of this register will read the con-
tents of a "snapshot" register, whose contents are updated only when the contents of PCA0L are read.
Bit 7 6 5 4 3 2 1 0
Access R RW RW RW
Reset 0x00 0 0 0
Selects the polarity of the CEX2 output channel. When this bit is modified, the change takes effect at the pin immediately.
Selects the polarity of the CEX1 output channel. When this bit is modified, the change takes effect at the pin immediately.
Selects the polarity of the CEX0 output channel. When this bit is modified, the change takes effect at the pin immediately.
Bit 7 6 5 4 3 2 1 0
Access R RW RW RW
Reset 0x00 0 0 0
Selects the alignment properties of the CEX2 output channel when operated in any of the PWM modes. This bit does not
affect the operation of non-PWM modes.
0 EDGE Edge-aligned.
1 CENTER Center-aligned.
Selects the alignment properties of the CEX1 output channel when operated in any of the PWM modes. This bit does not
affect the operation of non-PWM modes.
0 EDGE Edge-aligned.
1 CENTER Center-aligned.
Selects the alignment properties of the CEX0 output channel when operated in any of the PWM modes. This bit does not
affect the operation of non-PWM modes.
0 EDGE Edge-aligned.
1 CENTER Center-aligned.
Bit 7 6 5 4 3 2 1 0
Access RW RW RW RW RW RW RW RW
Reset 0 0 0 0 0 0 0 0
This bit enables 16-bit mode when Pulse Width Modulation mode is enabled.
This bit enables the match function. When enabled, matches of the PCA counter with a module's capture/compare register
cause the CCF0 bit in the PCA0MD register to be set to logic 1.
This bit enables the toggle function. When enabled, matches of the PCA counter with the capture/compare register cause
the logic level on the CEX0 pin to toggle. If the PWM bit is also set to logic 1, the module operates in Frequency Output
Mode.
This bit enables the PWM function. When enabled, a pulse width modulated signal is output on the CEX0 pin. 8 to 11-bit
PWM is used if PWM16 is cleared to 0; 16-bit mode is used if PWM16 is set to 1. If the TOG bit is also set, the module
operates in Frequency Output Mode.
This bit sets the masking of the Capture/Compare Flag (CCF0) interrupt.
Bit 7 6 5 4 3 2 1 0
Name PCA0CPL0
Access RW
Reset 0x00
The PCA0CPL0 register holds the low byte (LSB) of the 16-bit capture module. This register address also allows access to
the low byte of the corresponding PCA channel's auto-reload value for 9 to 11-bit PWM mode. The ARSEL bit in register
PCA0PWM controls which register is accessed.
Bit 7 6 5 4 3 2 1 0
Name PCA0CPH0
Access RW
Reset 0x00
The PCA0CPH0 register holds the high byte (MSB) of the 16-bit capture module. This register address also allows access
to the high byte of the corresponding PCA channel's auto-reload value for 9 to 11-bit PWM mode. The ARSEL bit in register
PCA0PWM controls which register is accessed.
Bit 7 6 5 4 3 2 1 0
Access RW RW RW RW RW RW RW RW
Reset 0 0 0 0 0 0 0 0
This bit enables 16-bit mode when Pulse Width Modulation mode is enabled.
This bit enables the match function. When enabled, matches of the PCA counter with a module's capture/compare register
cause the CCF1 bit in the PCA0MD register to be set to logic 1.
This bit enables the toggle function. When enabled, matches of the PCA counter with the capture/compare register cause
the logic level on the CEX1 pin to toggle. If the PWM bit is also set to logic 1, the module operates in Frequency Output
Mode.
This bit enables the PWM function. When enabled, a pulse width modulated signal is output on the CEX1 pin. 8 to 11-bit
PWM is used if PWM16 is cleared to 0; 16-bit mode is used if PWM16 is set to 1. If the TOG bit is also set, the module
operates in Frequency Output Mode.
This bit sets the masking of the Capture/Compare Flag (CCF1) interrupt.
Bit 7 6 5 4 3 2 1 0
Name PCA0CPL1
Access RW
Reset 0x00
The PCA0CPL1 register holds the low byte (LSB) of the 16-bit capture module. This register address also allows access to
the low byte of the corresponding PCA channel's auto-reload value for 9 to 11-bit PWM mode. The ARSEL bit in register
PCA0PWM controls which register is accessed.
Bit 7 6 5 4 3 2 1 0
Name PCA0CPH1
Access RW
Reset 0x00
The PCA0CPH1 register holds the high byte (MSB) of the 16-bit capture module. This register address also allows access
to the high byte of the corresponding PCA channel's auto-reload value for 9 to 11-bit PWM mode. The ARSEL bit in register
PCA0PWM controls which register is accessed.
Bit 7 6 5 4 3 2 1 0
Access RW RW RW RW RW RW RW RW
Reset 0 0 0 0 0 0 0 0
This bit enables 16-bit mode when Pulse Width Modulation mode is enabled.
This bit enables the match function. When enabled, matches of the PCA counter with a module's capture/compare register
cause the CCF2 bit in the PCA0MD register to be set to logic 1.
This bit enables the toggle function. When enabled, matches of the PCA counter with the capture/compare register cause
the logic level on the CEX2 pin to toggle. If the PWM bit is also set to logic 1, the module operates in Frequency Output
Mode.
This bit enables the PWM function. When enabled, a pulse width modulated signal is output on the CEX2 pin. 8 to 11-bit
PWM is used if PWM16 is cleared to 0; 16-bit mode is used if PWM16 is set to 1. If the TOG bit is also set, the module
operates in Frequency Output Mode.
This bit sets the masking of the Capture/Compare Flag (CCF2) interrupt.
Bit 7 6 5 4 3 2 1 0
Name PCA0CPL2
Access RW
Reset 0x00
The PCA0CPL2 register holds the low byte (LSB) of the 16-bit capture module. This register address also allows access to
the low byte of the corresponding PCA channel's auto-reload value for 9 to 11-bit PWM mode. The ARSEL bit in register
PCA0PWM controls which register is accessed.
Bit 7 6 5 4 3 2 1 0
Name PCA0CPH2
Access RW
Reset 0x00
The PCA0CPH2 register holds the high byte (MSB) of the 16-bit capture module. This register address also allows access
to the high byte of the corresponding PCA channel's auto-reload value for 9 to 11-bit PWM mode. The ARSEL bit in register
PCA0PWM controls which register is accessed.
16.1 Introduction
The serial peripheral interface (SPI) module provides access to a flexible, full-duplex synchronous serial bus. The SPI can operate as a
master or slave device in both 3-wire or 4-wire modes, and supports multiple masters and slaves on a single SPI bus. The slave-select
(NSS) signal can be configured as an input to select the SPI in slave mode, or to disable master mode operation in a multi-master
environment, avoiding contention on the SPI bus when more than one master attempts simultaneous data transfers. NSS can also be
configured as a firmware-controlled chip-select output in master mode, or disabled to reduce the number of pins required. Additional
general purpose port I/O pins can be used to select multiple slave devices in master mode.
SPI0
NSS
SYSCLK Clock Rate Generator Bus Control
SCK
MISO
Shift Register
MOSI
TX Buffer RX Buffer
SPI0DAT
16.2 Features
16.3.1 Signals
The SPI interface consists of up to four signals: MOSI, MISO, SCK, and NSS.
Master Out, Slave In (MOSI): The MOSI signal is the data output pin when configured as a master device and the data input pin when
configured as a slave. It is used to serially transfer data from the master to the slave. Data is transferred on the MOSI pin most-signifi-
cant bit first. When configured as a master, MOSI is driven from the internal shift register in both 3- and 4-wire mode.
Master In, Slave Out (MISO): The MISO signal is the data input pin when configured as a master device and the data output pin when
configured as a slave. It is used to serially transfer data from the slave to the master. Data is transferred on the MISO pin most-signifi-
cant bit first. The MISO pin is placed in a high-impedance state when the SPI module is disabled or when the SPI operates in 4-wire
mode as a slave that is not selected. When acting as a slave in 3-wire mode, MISO is always driven from the internal shift register.
Serial Clock (SCK): The SCK signal is an output from the master device and an input to slave devices. It is used to synchronize the
transfer of data between the master and slave on the MOSI and MISO lines. The SPI module generates this signal when operating as a
master and receives it as a slave. The SCK signal is ignored by a SPI slave when the slave is not selected in 4-wire slave mode.
Slave Select (NSS): The function of the slave-select (NSS) signal is dependent on the setting of the NSSMD bitfield. There are three
possible modes that can be selected with these bits:
• NSSMD[1:0] = 00: 3-Wire Master or 3-Wire Slave Mode: The SPI operates in 3-wire mode, and NSS is disabled. When operating as
a slave device, the SPI is always selected in 3-wire mode. Since no select signal is present, the SPI must be the only slave on the
bus in 3-wire mode. This is intended for point-to-point communication between a master and a single slave.
• NSSMD[1:0] = 01: 4-Wire Slave or Multi-Master Mode: The SPI operates in 4-wire mode, and NSS is configured as an input. When
operating as a slave, NSS selects the SPI device. When operating as a master, a 1-to- 0 transition of the NSS signal disables the
master function of the SPI module so that multiple master devices can be used on the same SPI bus.
• NSSMD[1:0] = 1x: 4-Wire Master Mode: The SPI operates in 4-wire mode, and NSS is enabled as an output. The setting of
NSSMD0 determines what logic level the NSS pin will output. This configuration should only be used when operating the SPI as a
master device.
The setting of NSSMD bits affects the pinout of the device. When in 3-wire master or 3-wire slave mode, the NSS pin will not be map-
ped by the crossbar. In all other modes, the NSS signal will be mapped to a pin on the device.
SCK SCK
MISO MISO
MOSI MOSI
NSS NSS
SCK SCK
MISO MISO
MOSI MOSI
SCK SCK
MISO MISO
MOSI MOSI
NSS NSS
port pin
Master Device 2
NSS
MOSI
MISO
SCK
port pin
An SPI master device initiates all data transfers on a SPI bus. It drives the SCK line and controls the speed at which data is transferred.
To place the SPI in master mode, the MSTEN bit should be set to 1. Writing a byte of data to the SPInDAT register writes to the trans-
mit buffer. If the SPI shift register is empty, a byte is moved from the transmit buffer into the shift register, and a bi-directional data
transfer begins. The SPI module provides the serial clock on SCK, while simultaneously shifting data out of the shift register MSB-first
on MOSI and into the shift register MSB-first on MISO. Upon completing a transfer, the data received is moved from the shift register
into the receive buffer. If the transmit buffer is not empty, the next byte in the transmit buffer will be moved into the shift register and the
next data transfer will begin. If no new data is available in the transmit buffer, the SPI will halt and wait for new data to initiate the next
transfer. Bytes that have been received and stored in the receive buffer may be read from the buffer via the SPInDAT register.
When the SPI block is enabled and not configured as a master, it will operate as a SPI slave. As a slave, bytes are shifted in through
the MOSI pin and out through the MISO pin by an external master device controlling the SCK signal. A bit counter in the SPI logic
counts SCK edges. When 8 bits have been shifted through the shift register, a byte is copied into the receive buffer. Data is read from
the receive buffer by reading SPInDAT. A slave device cannot initiate transfers. Data to be transferred to the master device is pre-loa-
ded into the transmit buffer by writing to SPInDAT and will transfer to the shift register on byte boundaries in the order in which they
were written to the buffer.
When configured as a slave, SPI0 can be configured for 4-wire or 3-wire operation. In the default, 4-wire slave mode, the NSS signal is
routed to a port pin and configured as a digital input. The SPI interface is enabled when NSS is logic 0, and disabled when NSS is logic
1. The internal shift register bit counter is reset on a falling edge of NSS. When operated in 3-wire slave mode, NSS is not mapped to
an external port pin through the crossbar. Since there is no way of uniquely addressing the device in 3-wire slave mode, the SPI must
be the only slave device present on the bus. It is important to note that in 3-wire slave mode there is no external means of resetting the
bit counter that determines when a full byte has been received. The bit counter can only be reset by disabling and re-enabling the SPI
module with the SPIEN bit.
Four combinations of serial clock phase and polarity can be selected using the clock control bits in the SPInCFG register. The CKPHA
bit selects one of two clock phases (edge used to latch the data). The CKPOL bit selects between an active-high or active-low clock.
Both master and slave devices must be configured to use the same clock phase and polarity. The SPI module should be disabled (by
clearing the SPIEN bit) when changing the clock phase or polarity. Note that CKPHA should be set to 0 on both the master and slave
SPI when communicating between two Silicon Labs devices.
SCK
(CKPOL=0, CKPHA=0)
SCK
(CKPOL=0, CKPHA=1)
SCK
(CKPOL=1, CKPHA=0)
SCK
(CKPOL=1, CKPHA=1)
SCK
(CKPOL=0, CKPHA=0)
SCK
(CKPOL=1, CKPHA=0)
SCK
(CKPOL=0, CKPHA=1)
SCK
(CKPOL=1, CKPHA=1)
The SPI bus is inherently full-duplex. It sends and receives a single byte on every transfer. The SPI peripheral may be operated on a
byte-by-byte basis using the SPInDAT register and the SPIF flag. The method firmware uses to send and receive data through the SPI
interface is the same in either mode, but the hardware will react differently.
Master Transfers
As an SPI master, all transfers are initiated with a write to SPInDAT, and the SPIF flag will be set by hardware to indicate the end of
each transfer. The general method for a single-byte master transfer follows:
1. Write the data to be sent to SPInDAT. The transfer will begin on the bus at this time.
2. Wait for the SPIF flag to generate an interrupt, or poll SPIF until it is set to 1.
3. Read the received data from SPInDAT.
4. Clear the SPIF flag to 0.
5. Repeat the sequence for any additional transfers.
Slave Transfers
As a SPI slave, the transfers are initiated by an external master device driving the bus. Slave firmware may anticipate any output data
needs by pre-loading the SPInDAT register before the master begins the transfer.
1. Write any data to be sent to SPInDAT. The transfer will not begin until the external master device initiates it.
2. Wait for the SPIF flag to generate an interrupt, or poll SPIF until it is set to 1.
3. Read the received data from SPInDAT.
4. Clear the SPIF flag to 0.
5. Repeat the sequence for any additional transfers.
SCK*
T T
MCKH MCKL
T T
MIS MIH
MISO
MOSI
* SCK is shown for CKPOL = 0. SCK is the opposite polarity for CKPOL = 1.
SCK*
T T
MCKH MCKL
T T
MIS MIH
MISO
MOSI
* SCK is shown for CKPOL = 0. SCK is the opposite polarity for CKPOL = 1.
NSS
T T T
SE CKL SD
SCK*
T
CKH
T T
SIS SIH
MOSI
T T T
SEZ SOH SDZ
MISO
* SCK is shown for CKPOL = 0. SCK is the opposite polarity for CKPOL = 1.
NSS
T T T
SE CKL SD
SCK*
T
CKH
T T
SIS SIH
MOSI
T T T T
SEZ SOH SLH SDZ
MISO
* SCK is shown for CKPOL = 0. SCK is the opposite polarity for CKPOL = 1.
Note:
1. TSYSCLK is equal to one period of the device system clock (SYSCLK).
Bit 7 6 5 4 3 2 1 0
Access R RW RW RW R R R R
Reset 0 0 0 0 0 1 1 1
This bit is set to logic 1 when a SPI transfer is in progress (master or slave mode).
This bit is set to logic 1 whenever the NSS pin is low indicating SPI0 is the selected slave. It is cleared to logic 0 when NSS
is high (slave not selected). This bit does not indicate the instantaneous value at the NSS pin, but rather a de-glitched ver-
sion of the pin input.
This bit mimics the instantaneous value that is present on the NSS port pin at the time that the register is read. This input is
not de-glitched.
This bit will be set to logic 1 when all data has been transferred in/out of the shift register, and there is no new information
available to read from the transmit buffer or write to the receive buffer. It returns to logic 0 when a data byte is transferred to
the shift register from the transmit buffer or by a transition on SCK.
This bit is valid in slave mode only and will be set to logic 1 when the receive buffer has been read and contains no new
information. If there is new information available in the receive buffer that has not been read, this bit will return to logic 0.
RXBMT = 1 when in Master Mode.
In slave mode, data on MOSI is sampled in the center of each data bit. In master mode, data on MISO is sampled one SYSCLK
before the end of each data bit, to provide maximum settling time for the slave device.
Bit 7 6 5 4 3 2 1 0
Access RW RW RW RW RW R RW
Reset 0 0 0 0 0x1 1 0
This bit is set to logic 1 by hardware at the end of a data transfer. If SPI interrupts are enabled, an interrupt will be gener-
ated. This bit is not automatically cleared by hardware, and must be cleared by firmware.
This bit is set to logic 1 if a write to SPI0DAT is attempted when TXBMT is 0. When this occurs, the write to SPI0DAT will
be ignored, and the transmit buffer will not be written. If SPI interrupts are enabled, an interrupt will be generated. This bit is
not automatically cleared by hardware, and must be cleared by firmware.
This bit is set to logic 1 by hardware when a master mode collision is detected (NSS is low, MSTEN = 1, and NSSMD =
01). If SPI interrupts are enabled, an interrupt will be generated. This bit is not automatically cleared by hardware, and must
be cleared by firmware.
This bit is valid for slave mode only and is set to logic 1 by hardware when the receive buffer still holds unread data from a
previous transfer and the last bit of the current transfer is shifted into the SPI0 shift register. If SPI interrupts are enabled,
an interrupt will be generated. This bit is not automatically cleared by hardware, and must be cleared by firmware.
0x0 3_WIRE 3-Wire Slave or 3-Wire Master Mode. NSS signal is not routed to a port pin.
0x1 4_WIRE_SLAVE 4-Wire Slave or Multi-Master Mode. NSS is an input to the device.
0x2 4_WIRE_MAS- 4-Wire Single-Master Mode. NSS is an output and logic low.
TER_NSS_LOW
0x3 4_WIRE_MAS- 4-Wire Single-Master Mode. NSS is an output and logic high.
TER_NSS_HIGH
This bit will be set to logic 0 when new data has been written to the transmit buffer. When data in the transmit buffer is
transferred to the SPI shift register, this bit will be set to logic 1, indicating that it is safe to write a new byte to the transmit
buffer.
Bit 7 6 5 4 3 2 1 0
Name SPI0CKR
Access RW
Reset 0x00
These bits determine the frequency of the SCK output when the SPI0 module is configured for master mode operation. The
SCK clock frequency is a divided version of the system clock, and is given in the following equation, where SYSCLK is the
system clock frequency and SPI0CKR is the 8-bit value held in the SPI0CKR register.
Bit 7 6 5 4 3 2 1 0
Name SPI0DAT
Access RW
Reset Varies
The SPI0DAT register is used to transmit and receive SPI0 data. Writing data to SPI0DAT places the data into the transmit
buffer and initiates a transfer when in master mode. A read of SPI0DAT returns the contents of the receive buffer.
17.1 Introduction
The SMBus I/O interface is a two-wire, bi-directional serial bus. The SMBus is compliant with the System Management Bus Specifica-
tion, version 1.1, and compatible with the I2C serial bus.
SMB0
Data /
SMB0DAT Shift Register SDA
Address
17.2 Features
It is assumed the reader is familiar with or has access to the following supporting documents:
• The I2C-Bus and How to Use It (including specifications), Philips Semiconductor.
• The I2C-Bus Specification—Version 2.0, Philips Semiconductor.
• System Management Bus Specification—Version 1.1, SBS Implementers Forum.
The SMBus specification allows any recessive voltage between 3.0 and 5.0 V; different devices on the bus may operate at different
voltage levels. However, the maximum voltage on any port pin must conform to the electrical characteristics specifications. The bi-direc-
tional SCL (serial clock) and SDA (serial data) lines must be connected to a positive power supply voltage through a pullup resistor or
similar circuit. Every device connected to the bus must have an open-drain or open-collector output for both the SCL and SDA lines, so
that both are pulled high (recessive state) when the bus is free. The maximum number of devices on the bus is limited only by the
requirement that the rise and fall times on the bus not exceed 300 ns and 1000 ns, respectively.
SDA
SCL
Two types of data transfers are possible: data transfers from a master transmitter to an addressed slave receiver (WRITE), and data
transfers from an addressed slave transmitter to a master receiver (READ). The master device initiates both types of data transfers and
provides the serial clock pulses on SCL. The SMBus interface may operate as a master or a slave, and multiple master devices on the
same bus are supported. If two or more masters attempt to initiate a data transfer simultaneously, an arbitration scheme is employed
with a single master always winning the arbitration. It is not necessary to specify one device as the Master in a system; any device who
transmits a START and a slave address becomes the master for the duration of that transfer.
A typical SMBus transaction consists of a START condition followed by an address byte (Bits7–1: 7-bit slave address; Bit0: R/W direc-
tion bit), one or more bytes of data, and a STOP condition. Bytes that are received (by a master or slave) are acknowledged (ACK) with
a low SDA during a high SCL (see Figure 17.3 SMBus Transaction on page 172). If the receiving device does not ACK, the transmit-
ting device will read a NACK (not acknowledge), which is a high SDA during a high SCL.
The direction bit (R/W) occupies the least-significant bit position of the address byte. The direction bit is set to logic 1 to indicate a
"READ" operation and cleared to logic 0 to indicate a "WRITE" operation.
All transactions are initiated by a master, with one or more addressed slave devices as the target. The master generates the START
condition and then transmits the slave address and direction bit. If the transaction is a WRITE operation from the master to the slave,
the master transmits the data a byte at a time waiting for an ACK from the slave at the end of each byte. For READ operations, the
slave transmits the data waiting for an ACK from the master at the end of each byte. At the end of the data transfer, the master gener-
ates a STOP condition to terminate the transaction and free the bus. Figure 17.3 SMBus Transaction on page 172 illustrates a typical
SMBus transaction.
SCL
SDA
SLA6 SLA5-0 R/W D7 D6-0
On the SMBus communications interface, a device is the “transmitter” when it is sending an address or data byte to another device on
the bus. A device is a “receiver” when an address or data byte is being sent to it from another device on the bus. The transmitter con-
trols the SDA line during the address or data byte. After each byte of address or data information is sent by the transmitter, the receiver
sends an ACK or NACK bit during the ACK phase of the transfer, during which time the receiver controls the SDA line.
Arbitration
A master may start a transfer only if the bus is free. The bus is free after a STOP condition or after the SCL and SDA lines remain high
for a specified time (see ● SCL High (SMBus Free) Timeout on page 172). In the event that two or more devices attempt to begin a
transfer at the same time, an arbitration scheme is employed to force one master to give up the bus. The master devices continue
transmitting until one attempts a HIGH while the other transmits a LOW. Since the bus is open-drain, the bus will be pulled LOW. The
master attempting the HIGH will detect a LOW SDA and lose the arbitration. The winning master continues its transmission without
interruption; the losing master becomes a slave and receives the rest of the transfer if addressed. This arbitration scheme is non-de-
structive: one device always wins, and no data is lost.
SMBus provides a clock synchronization mechanism, similar to I2C, which allows devices with different speed capabilities to coexist on
the bus. A clock-low extension is used during a transfer in order to allow slower slave devices to communicate with faster masters. The
slave may temporarily hold the SCL line LOW to extend the clock low period, effectively decreasing the serial clock frequency.
If the SCL line is held low by a slave device on the bus, no further communication is possible. Furthermore, the master cannot force the
SCL line high to correct the error condition. To solve this problem, the SMBus protocol specifies that devices participating in a transfer
must detect any clock cycle held low longer than 25 ms as a “timeout” condition. Devices that have detected the timeout condition must
reset the communication no later than 10 ms after detecting the timeout condition.
For the SMBus 0 interface, Timer 3 is used to implement SCL low timeouts. The SCL low timeout feature is enabled by setting the
SMB0TOE bit in SMB0CF. The associated timer is forced to reload when SCL is high, and allowed to count when SCL is low. With the
associated timer enabled and configured to overflow after 25 ms (and SMB0TOE set), the timer interrupt service routine can be used to
reset (disable and re-enable) the SMBus in the event of an SCL low timeout.
The SMBus specification stipulates that if the SCL and SDA lines remain high for more that 50 μs, the bus is designated as free. When
the SMB0FTE bit in SMB0CF is set, the bus will be considered free if SCL and SDA remain high for more than 10 SMBus clock source
periods (as defined by the timer configured for the SMBus clock source). If the SMBus is waiting to generate a Master START, the
START will be generated following this timeout. A clock source is required for free timeout detection, even in a slave-only implementa-
tion.
The SMBus can operate in both Master and Slave modes. The interface provides timing and shifting control for serial transfers; higher
level protocol is determined by user software. The SMBus interface provides the following application-independent features:
• Byte-wise serial data transfers
• Clock signal generation on SCL (Master Mode only) and SDA data synchronization
• Timeout/bus error recognition, as defined by the SMB0CF configuration register
• START/STOP timing, detection, and generation
• Bus arbitration
• Interrupt generation
• Status information
• Optional hardware recognition of slave address and automatic acknowledgement of address/data
SMBus interrupts are generated for each data byte or slave address that is transferred. When hardware acknowledgement is disabled,
the point at which the interrupt is generated depends on whether the hardware is acting as a data transmitter or receiver. When a trans-
mitter (i.e., sending address/data, receiving an ACK), this interrupt is generated after the ACK cycle so that software may read the re-
ceived ACK value; when receiving data (i.e., receiving address/data, sending an ACK), this interrupt is generated before the ACK cycle
so that software may define the outgoing ACK value. If hardware acknowledgement is enabled, these interrupts are always generated
after the ACK cycle. Interrupts are also generated to indicate the beginning of a transfer when a master (START generated), or the end
of a transfer when a slave (STOP detected). Software should read the SMB0CN0 register to find the cause of the SMBus interrupt.
The SMBus Configuration register (SMB0CF) is used to enable the SMBus master and/or slave modes, select the SMBus clock source,
and select the SMBus timing and timeout options. When the ENSMB bit is set, the SMBus is enabled for all master and slave events.
Slave events may be disabled by setting the INH bit. With slave events inhibited, the SMBus interface will still monitor the SCL and SDA
pins; however, the interface will NACK all received addresses and will not generate any slave interrupts. When the INH bit is set, all
slave events will be inhibited following the next START (interrupts will continue for the duration of the current transfer).
The SMBCS bit field selects the SMBus clock source, which is used only when operating as a master or when the Free Timeout detec-
tion is enabled. When operating as a master, overflows from the selected source determine both the bit rate and the absolute minimum
SCL low and high times. The selected clock source may be shared by other peripherals so long as the timer is left running at all times.
The selected clock source should typically be configured to overflow at three times the desired bit rate. When the interface is operating
as a master (and SCL is not driven or extended by any other devices on the bus), the device will hold the SCL line low for one overflow
period, and release it for two overflow periods. THIGH is typically twice as large as TLOW. The actual SCL output may vary due to other
devices on the bus (SCL may be extended low by slower slave devices, driven low by contending master devices, or have long ramp
times). The SMBus hardware will ensure that once SCL does return high, it reads a logic high state for a minimum of one overflow
period.
Timer Source
Overflows
SCL
Setting the EXTHOLD bit extends the minimum setup and hold times for the SDA line. The minimum SDA setup time defines the abso-
lute minimum time that SDA is stable before SCL transitions from low-to-high. The minimum SDA hold time defines the absolute mini-
mum time that the current SDA value remains stable after SCL transitions from high-to-low. EXTHOLD should be set so that the mini-
mum setup and hold times meet the SMBus Specification requirements of 250 ns and 300 ns, respectively. Setup and hold time exten-
sions are typically necessary for SMBus compliance when SYSCLK is above 10 MHz.
Note: Setup Time for ACK bit transmissions and the MSB of all data transfers. When using software acknowl-
edgment, the s/w delay occurs between the time SMB0DAT or ACK is written and when SI is cleared. Note
that if SI is cleared in the same write that defines the outgoing ACK value, s/w delay is zero.
With the SMBTOE bit set, Timer 3 should be configured to overflow after 25 ms in order to detect SCL low timeouts. The SMBus inter-
face will force the associated timer to reload while SCL is high, and allow the timer to count when SCL is low. The timer interrupt serv-
ice routine should be used to reset SMBus communication by disabling and re-enabling the SMBus. SMBus Free Timeout detection can
be enabled by setting the SMBFTE bit. When this bit is set, the bus will be considered free if SDA and SCL remain high for more than
10 SMBus clock source periods.
The SMBus peripheral is assigned to pins using the priority crossbar decoder. By default, the SMBus signals are assigned to port pins
starting with SDA on the lower-numbered pin, and SCL on the next available pin. The SWAP bit in the SMBTC register can be set to 1
to reverse the order in which the SMBus signals are assigned.
The SDD field in the SMBTC register is used to restrict the detection of a START condition under certain circumstances. In some sys-
tems where there is significant mismatch between the impedance or the capacitance on the SDA and SCL lines, it may be possible for
SCL to fall after SDA during an address or data transfer. Such an event can cause a false START detection on the bus. These kind of
events are not expected in a standard SMBus or I2C-compliant system.
Note: In most systems this parameter should not be adjusted, and it is recommended that it be left at its default value.
By default, if the SCL falling edge is detected after the falling edge of SDA (i.e., one SYSCLK cycle or more), the device will detect this
as a START condition. The SDD field is used to increase the amount of hold time that is required between SDA and SCL falling before
a START is recognized. An additional 2, 4, or 8 SYSCLKs can be added to prevent false START detection in systems where the bus
conditions warrant this.
SMB0CN0 is used to control the interface and to provide status information. The higher four bits of SMB0CN0 (MASTER, TXMODE,
STA, and STO) form a status vector that can be used to jump to service routines. MASTER indicates whether a device is the master or
slave during the current transfer. TXMODE indicates whether the device is transmitting or receiving data for the current byte.
STA and STO indicate that a START and/or STOP has been detected or generated since the last SMBus interrupt. STA and STO are
also used to generate START and STOP conditions when operating as a master. Writing a 1 to STA will cause the SMBus interface to
enter Master Mode and generate a START when the bus becomes free (STA is not cleared by hardware after the START is generated).
Writing a 1 to STO while in Master Mode will cause the interface to generate a STOP and end the current transfer after the next ACK
cycle. If STO and STA are both set (while in Master Mode), a STOP followed by a START will be generated.
The ARBLOST bit indicates that the interface has lost an arbitration. This may occur anytime the interface is transmitting (master or
slave). A lost arbitration while operating as a slave indicates a bus error condition. ARBLOST is cleared by hardware each time SI is
cleared.
The SI bit (SMBus Interrupt Flag) is set at the beginning and end of each transfer, after each byte frame, or when an arbitration is lost.
Note: The SMBus interface is stalled while SI is set; if SCL is held low at this time, the bus is stalled until software clears SI.
When the EHACK bit in register SMB0ADM is set to 1, automatic slave address recognition and ACK generation is enabled. As a re-
ceiver, the value currently specified by the ACK bit will be automatically sent on the bus during the ACK cycle of an incoming data byte.
As a transmitter, reading the ACK bit indicates the value received on the last ACK cycle. The ACKRQ bit is not used when hardware
ACK generation is enabled. If a received slave address is NACKed by hardware, further slave events will be ignored until the next
START is detected, and no interrupt will be generated.
Arbitration is lost.
ACKRQ A byte has been received and an ACK re- After each ACK cycle.
sponse value is needed (only when hard-
ware ACK is not enabled).
ACK The incoming ACK value is low (AC- The incoming ACK value is high (NOT ACKNOWL-
KNOWLEDGE). EDGE).
Lost arbitration.
The SMBus hardware has the capability to automatically recognize incoming slave addresses and send an ACK without software inter-
vention. Automatic slave address recognition is enabled by setting the EHACK bit in register SMB0ADM to 1. This will enable both auto-
matic slave address recognition and automatic hardware ACK generation for received bytes (as a master or slave).
The registers used to define which address(es) are recognized by the hardware are the SMBus Slave Address register and the SMBus
Slave Address Mask register. A single address or range of addresses (including the General Call Address 0x00) can be specified using
these two registers. The most-significant seven bits of the two registers are used to define which addresses will be ACKed. A 1 in a bit
of the slave address mask SLVM enables a comparison between the received slave address and the hardware’s slave address SLV for
that bit. A 0 in a bit of the slave address mask means that bit will be treated as a “don’t care” for comparison purposes. In this case,
either a 1 or a 0 value are acceptable on the incoming slave address. Additionally, if the GC bit in register SMB0ADR is set to 1, hard-
ware will recognize the General Call Address (0x00).
Hardware Slave Address Slave Address Mask GC bit Slave Addresses Recognized by Hardware
SLV SLVM
Note: These addresses must be shifted to the left by one bit when writing to the SMB0ADR register.
In general, it is recommended for applications to use hardware ACK and address recognition. In some cases it may be desirable to
drive ACK generation and address recognition from firmware. When the EHACK bit in register SMB0ADM is cleared to 0, the firmware
on the device must detect incoming slave addresses and ACK or NACK the slave address and incoming data bytes. As a receiver,
writing the ACK bit defines the outgoing ACK value; as a transmitter, reading the ACK bit indicates the value received during the last
ACK cycle. ACKRQ is set each time a byte is received, indicating that an outgoing ACK value is needed. When ACKRQ is set, software
should write the desired outgoing value to the ACK bit before clearing SI. A NACK will be generated if software does not write the ACK
bit before clearing SI. SDA will reflect the defined ACK value immediately following a write to the ACK bit; however SCL will remain low
until SI is cleared. If a received slave address is not acknowledged, further slave events will be ignored until the next START is detec-
ted.
The SMBus Data register SMB0DAT holds a byte of serial data to be transmitted or one that has just been received. Software may
safely read or write to the data register when the SI flag is set. Software should not attempt to access the SMB0DAT register when the
SMBus is enabled and the SI flag is cleared to logic 0.
Note: Certain device families have a transmit and receive buffer interface which is accessed by reading and writing the SMB0DAT reg-
ister. To promote software portability between devices with and without this buffer interface it is recommended that SMB0DAT not be
used as a temporary storage location. On buffer-enabled devices, writing the register multiple times will push multiple bytes into the
transmit FIFO.
The SMBus interface may be configured to operate as master and/or slave. At any particular time, it will be operating in one of the
following four modes: Master Transmitter, Master Receiver, Slave Transmitter, or Slave Receiver. The SMBus interface enters Master
Mode any time a START is generated, and remains in Master Mode until it loses an arbitration or generates a STOP. An SMBus inter-
rupt is generated at the end of all SMBus byte frames. The position of the ACK interrupt when operating as a receiver depends on
whether hardware ACK generation is enabled. As a receiver, the interrupt for an ACK occurs before the ACK with hardware ACK gener-
ation disabled, and after the ACK when hardware ACK generation is enabled. As a transmitter, interrupts occur after the ACK, regard-
less of whether hardware ACK generation is enabled or not.
During a write sequence, an SMBus master writes data to a slave device. The master in this transfer will be a transmitter during the
address byte, and a transmitter during all data bytes. The SMBus interface generates the START condition and transmits the first byte
containing the address of the target slave and the data direction bit. In this case the data direction bit (R/W) will be logic 0 (WRITE). The
master then transmits one or more bytes of serial data. After each byte is transmitted, an acknowledge bit is generated by the slave.
The transfer is ended when the STO bit is set and a STOP is generated. The interface will switch to Master Receiver Mode if SMB0DAT
is not written following a Master Transmitter interrupt. Figure 17.5 Typical Master Write Sequence on page 178 shows a typical master
write sequence as it appears on the bus, and Figure 17.6 Master Write Sequence State Diagram (EHACK = 1) on page 179 shows the
corresponding firmware state machine. Two transmit data bytes are shown, though any number of bytes may be transmitted. Notice
that all of the “data byte transferred” interrupts occur after the ACK cycle in this mode, regardless of whether hardware ACK generation
is enabled.
a b c d
Interrupts with Hardware ACK Disabled (EHACK = 0)
Idle
Interrupt
No Send
ACK? Repeated
Start?
Yes
No Yes
More Data No
to Send?
Yes d
b c 1. Set the STO 1. Set the STA
flag. flag.
ACK received
2. Clear the 2. Clear the
1. Write next data to SMB0DAT.
interrupt flag (SI). interrupt flag (SI).
2. Clear the interrupt flag (SI).
Interrupt
Interrupt
Idle
During a read sequence, an SMBus master reads data from a slave device. The master in this transfer will be a transmitter during the
address byte, and a receiver during all data bytes. The SMBus interface generates the START condition and transmits the first byte
containing the address of the target slave and the data direction bit. In this case the data direction bit (R/W) will be logic 1 (READ).
Serial data is then received from the slave on SDA while the SMBus outputs the serial clock. The slave transmits one or more bytes of
serial data.
If hardware ACK generation is disabled, the ACKRQ is set to 1 and an interrupt is generated after each received byte. Software must
write the ACK bit at that time to ACK or NACK the received byte.
With hardware ACK generation enabled, the SMBus hardware will automatically generate the ACK/NACK, and then post the interrupt. It
is important to note that the appropriate ACK or NACK value should be set up by the software prior to receiving the byte when hardware
ACK generation is enabled.
Writing a 1 to the ACK bit generates an ACK; writing a 0 generates a NACK. Software should write a 0 to the ACK bit for the last data
transfer, to transmit a NACK. The interface exits Master Receiver Mode after the STO bit is set and a STOP is generated. The interface
will switch to Master Transmitter Mode if SMB0DAT is written while an active Master Receiver. Figure 17.7 Typical Master Read Se-
quence on page 180 shows a typical master read sequence as it appears on the bus, and Figure 17.8 Master Read Sequence State
Diagram (EHACK = 1) on page 181 shows the corresponding firmware state machine. Two received data bytes are shown, though any
number of bytes may be received. Notice that the "data byte transferred" interrupts occur at different places in the sequence, depending
on whether hardware ACK generation is enabled. The interrupt occurs before the ACK with hardware ACK generation disabled, and
after the ACK when hardware ACK generation is enabled.
a b c d
Interrupts with Hardware ACK Disabled (EHACK = 0)
Idle
Interrupt
No Send
ACK? Repeated
Start?
Yes
No Yes
Next Byte
Final?
No Yes
b c d
1. Set ACK. 1. Clear ACK. 1. Set the STO 1. Set the STA
2. Clear SI. 2. Clear SI. flag. flag.
2. Clear the 2. Clear the
interrupt flag (SI). interrupt flag (SI).
Interrupt
Interrupt
1. Read Data From SMB0DAT.
Idle
2. Clear the interrupt flag (SI).
Yes
Last Byte?
No
During a write sequence, an SMBus master writes data to a slave device. The slave in this transfer will be a receiver during the address
byte, and a receiver during all data bytes. When slave events are enabled (INH = 0), the interface enters Slave Receiver Mode when a
START followed by a slave address and direction bit (WRITE in this case) is received. If hardware ACK generation is disabled, upon
entering Slave Receiver Mode, an interrupt is generated and the ACKRQ bit is set. The software must respond to the received slave
address with an ACK, or ignore the received slave address with a NACK. If hardware ACK generation is enabled, the hardware will
apply the ACK for a slave address which matches the criteria set up by SMB0ADR and SMB0ADM. The interrupt will occur after the
ACK cycle.
If the received slave address is ignored (by software or hardware), slave interrupts will be inhibited until the next START is detected. If
the received slave address is acknowledged, zero or more data bytes are received.
If hardware ACK generation is disabled, the ACKRQ is set to 1 and an interrupt is generated after each received byte. Software must
write the ACK bit at that time to ACK or NACK the received byte.
With hardware ACK generation enabled, the SMBus hardware will automatically generate the ACK/NACK, and then post the interrupt. It
is important to note that the appropriate ACK or NACK value should be set up by the software prior to receiving the byte when hardware
ACK generation is enabled.
The interface exits Slave Receiver Mode after receiving a STOP. The interface will switch to Slave Transmitter Mode if SMB0DAT is
written while an active Slave Receiver. Figure 17.9 Typical Slave Write Sequence on page 182 shows a typical slave write sequence
as it appears on the bus. The corresponding firmware state diagram (combined with the slave read sequence) is shown in Figure
17.10 Slave State Diagram (EHACK = 1) on page 183. Two received data bytes are shown, though any number of bytes may be re-
ceived. Notice that the "data byte transferred" interrupts occur at different places in the sequence, depending on whether hardware
ACK generation is enabled. The interrupt occurs before the ACK with hardware ACK generation disabled, and after the ACK when
hardware ACK generation is enabled.
e f g h
Interrupts with Hardware ACK Disabled (EHACK = 0)
Idle
Interrupt
a e
1. Clear STA.
2. Read Address + R/W from SMB0DAT.
Interrupt Yes
STOP?
d h
Clear STO. No
Yes Repeated
Start?
d h No
Clear SI.
Idle
During a read sequence, an SMBus master reads data from a slave device. The slave in this transfer will be a receiver during the ad-
dress byte, and a transmitter during all data bytes. When slave events are enabled (INH = 0), the interface enters Slave Receiver Mode
(to receive the slave address) when a START followed by a slave address and direction bit (READ in this case) is received. If hardware
ACK generation is disabled, upon entering Slave Receiver Mode, an interrupt is generated and the ACKRQ bit is set. The software
must respond to the received slave address with an ACK, or ignore the received slave address with a NACK. If hardware ACK genera-
tion is enabled, the hardware will apply the ACK for a slave address which matches the criteria set up by SMB0ADR and SMB0ADM.
The interrupt will occur after the ACK cycle.
If the received slave address is ignored (by software or hardware), slave interrupts will be inhibited until the next START is detected. If
the received slave address is acknowledged, zero or more data bytes are transmitted. If the received slave address is acknowledged,
data should be written to SMB0DAT to be transmitted. The interface enters slave transmitter mode, and transmits one or more bytes of
data. After each byte is transmitted, the master sends an acknowledge bit; if the acknowledge bit is an ACK, SMB0DAT should be writ-
ten with the next data byte. If the acknowledge bit is a NACK, SMB0DAT should not be written to before SI is cleared (an error condition
may be generated if SMB0DAT is written following a received NACK while in slave transmitter mode). The interface exits slave trans-
mitter mode after receiving a STOP. The interface will switch to slave receiver mode if SMB0DAT is not written following a Slave Trans-
mitter interrupt. Figure 17.11 Typical Slave Read Sequence on page 184 shows a typical slave read sequence as it appears on the
bus. The corresponding firmware state diagram (combined with the slave read sequence) is shown in Figure 17.10 Slave State Dia-
gram (EHACK = 1) on page 183. Two transmitted data bytes are shown, though any number of bytes may be transmitted. Notice that
all of the “data byte transferred” interrupts occur after the ACK cycle in this mode, regardless of whether hardware ACK generation is
enabled.
a b c d
Interrupts with Hardware ACK Disabled (EHACK = 0)
Bit 7 6 5 4 3 2 1 0
Access RW RW R RW RW RW RW
Reset 0 0 0 0 0 0 0x0
This bit enables the SMBus interface when set to 1. When enabled, the interface constantly monitors the SDA and SCL
pins.
When this bit is set to logic 1, the SMBus does not generate an interrupt when slave events occur. This effectively removes
the SMBus slave from the bus. Master Mode interrupts are not affected.
This bit is set to logic 1 by hardware when a transfer is in progress. It is cleared to logic 0 when a STOP or free-timeout is
sensed.
This bit enables SCL low timeout detection. If set to logic 1, the SMBus forces Timer 3 to reload while SCL is high and
allows Timer 3 to count when SCL goes low. If Timer 3 is configured to Split Mode, only the High Byte of the timer is held in
reload while SCL is high. Timer 3 should be programmed to generate interrupts at 25 ms, and the Timer 3 interrupt service
routine should reset SMBus communication.
When this bit is set to logic 1, the bus will be considered free if SCL and SDA remain high for more than 10 SMBus clock
source periods.
This field selects the SMBus clock source, which is used to generate the SMBus bit rate. See the SMBus clock timing sec-
tion for additional details.
Bit 7 6 5 4 3 2 1 0
Access RW R RW
This bit swaps the order of the SMBus pins on the crossbar.
0 SDA_LOW_PIN SDA is mapped to the lower-numbered port pin, and SCL is mapped to the high-
er-numbered port pin.
1 SDA_HIGH_PIN SCL is mapped to the lower-numbered port pin, and SDA is mapped to the high-
er-numbered port pin.
These bits increase the hold time requirement between SDA falling and SCL falling for START detection.
Bit 7 6 5 4 3 2 1 0
Access R R RW RW R R RW RW
Reset 0 0 0 0 0 0 0 0
When reading STA, a '1' indicates that a start or repeated start condition was detected on the bus.
Writing a '1' to the STA bit initiates a start or repeated start on the bus.
When reading STO, a '1' indicates that a stop condition was detected on the bus (in slave mode) or is pending (in master
mode).
When acting as a master, writing a '1' to the STO bit initiates a stop condition on the bus. This bit is cleared by hardware.
When read as a master, the ACK bit indicates whether an ACK (1) or NACK (0) is received during the most recent byte
transfer.
As a slave, this bit should be written to send an ACK (1) or NACK (0) to a master request. Note that the logic level of the
ACK bit on the SMBus interface is inverted from the logic of the register ACK bit.
This bit is set by hardware to indicate that the current SMBus state machine operation (such as writing a data or address
byte) is complete, and the hardware needs additional control from the firmware to proceed. While SI is set, SCL is held low
and SMBus is stalled. SI must be cleared by firmware. Clearing SI initiates the next SMBus state machine operation.
Bit 7 6 5 4 3 2 1 0
Name SLV GC
Access RW RW
Reset 0x00 0
Defines the SMBus Slave Address(es) for automatic hardware acknowledgement. Only address bits which have a 1 in the
corresponding bit position in SLVM are checked against the incoming address. This allows multiple addresses to be recog-
nized.
When hardware address recognition is enabled (EHACK = 1), this bit will determine whether the General Call Address
(0x00) is also recognized by hardware.
Bit 7 6 5 4 3 2 1 0
Access RW RW
Reset 0x7F 0
Defines which bits of register SMB0ADR are compared with an incoming address byte, and which bits are ignored. Any bit
set to 1 in SLVM enables comparisons with the corresponding bit in SLV. Bits set to 0 are ignored (can be either 0 or 1 in
the incoming address).
0 ADR_ACK_MANUAL Firmware must manually acknowledge all incoming address and data bytes.
Bit 7 6 5 4 3 2 1 0
Name SMB0DAT
Access RW
Reset 0x00
The SMB0DAT register contains a byte of data to be transmitted on the SMBus serial interface or a byte that has just been
received on the SMBus serial interface. The CPU can safely read from or write to this register whenever the SI serial inter-
rupt flag is set to logic 1. The serial data in the register remains stable as long as the SI flag is set. When the SI flag is not
set, the system may be in the process of shifting data in/out and the CPU should not attempt to access this register.
18.1 Introduction
Four counter/timers ar included in the device: two are 16-bit counter/timers compatible with those found in the standard 8051, and two
are 16-bit auto-reload timers for timing peripherals or for general purpose use. These timers can be used to measure time intervals,
count external events and generate periodic interrupt requests. Timer 0 and Timer 1 are nearly identical and have four primary modes
of operation. Timer 2 and Timer 3 are also identical and offer both 16-bit and split 8-bit timer functionality with auto-reload capabilities.
Timer 2 and Timer 3 both offer a capture function, but are different in their system-level connections. Timer 2 is capable of performing a
capture function on an external signal input routed through the crossbar, while the Timer 3 capture is dedicated to the low-frequency
oscillator output.
Timers 0 and 1 may be clocked by one of five sources, determined by the Timer Mode Select bits (T1M–T0M) and the Clock Scale bits
(SCA1–SCA0). The Clock Scale bits define a pre-scaled clock from which Timer 0 and/or Timer 1 may be clocked.
Timer 0/1 may then be configured to use this pre-scaled clock signal or the system clock. Timer 2 and Timer 3 may be clocked by the
system clock, the system clock divided by 12, or the external clock divided by 8.
Timer 0 and Timer 1 may also be operated as counters. When functioning as a counter, a counter/timer register is incremented on each
high-to-low transition at the selected input pin (T0 or T1). Events with a frequency of up to one-fourth the system clock frequency can
be counted. The input signal need not be periodic, but it must be held at a given level for at least two full system clock cycles to ensure
the level is properly sampled.
13-bit counter/timer 16-bit timer with auto-reload 16-bit timer with auto-reload
16-bit counter/timer Two 8-bit timers with auto-reload Two 8-bit timers with auto-reload
8-bit counter/timer with auto-reload Input pin capture Low-frequency oscillator capture
18.2 Features
Timer 2 and Timer 3 are 16-bit timers including the following features:
• Clock sources include SYSCLK, SYSCLK divided by 12, or the External Clock divided by 8.
• 16-bit auto-reload timer mode
• Dual 8-bit auto-reload timer mode
• External pin capture (Timer 2)
• LFOSC0 capture (Timer 3)
All four timers are capable of clocking other peripherals and triggering events in the system. The individual peripherals select which
timer to use for their respective functions. Note that the Timer 2 and Timer 3 high overflows apply to the full timer when operating in 16-
bit mode or the high-byte timer when operating in 8-bit split mode.
Function T0 Overflow T1 Overflow T2 High Over- T2 Low Over- T3 High Over- T3 Low Over-
flow flow flow flow
Notes:
1. The high-side overflow is used when the timer is in 16-bit mode. The low-side overflow is used in 8-bit mode.
Timer 0 and Timer 1 are each implemented as a 16-bit register accessed as two separate bytes: a low byte (TL0 or TL1) and a high
byte (TH0 or TH1). The Counter/Timer Control register (TCON) is used to enable Timer 0 and Timer 1 as well as indicate status. Timer
0 interrupts can be enabled by setting the ET0 bit in the IE register. Timer 1 interrupts can be enabled by setting the ET1 bit in the IE
register. Both counter/timers operate in one of four primary modes selected by setting the Mode Select bits T1M1–T0M0 in the Counter/
Timer Mode register (TMOD). Each timer can be configured independently for the supported operating modes.
Timer 0 and Timer 1 operate as 13-bit counter/timers in Mode 0. The following describes the configuration and operation of Timer 0.
However, both timers operate identically, and Timer 1 is configured in the same manner as described for Timer 0.
The TH0 register holds the eight MSBs of the 13-bit counter/timer. TL0 holds the five LSBs in bit positions TL0.4–TL0.0. The three
upper bits of TL0 (TL0.7–TL0.5) are indeterminate and should be masked out or ignored when reading. As the 13-bit timer register
increments and overflows from 0x1FFF (all ones) to 0x0000, the timer overflow flag TF0 in TCON is set and an interrupt occurs if Timer
0 interrupts are enabled. The overflow rate for Timer 0 in 13-bit mode is:
The CT0 bit in the TMOD register selects the counter/timer's clock source. When CT0 is set to logic 1, high-to-low transitions at the
selected Timer 0 input pin (T0) increment the timer register. Events with a frequency of up to one-fourth the system clock frequency can
be counted. The input signal need not be periodic, but it must be held at a given level for at least two full system clock cycles to ensure
the level is properly sampled. Clearing CT selects the clock defined by the T0M bit in register CKCON0. When T0M is set, Timer 0 is
clocked by the system clock. When T0M is cleared, Timer 0 is clocked by the source selected by the Clock Scale bits in CKCON0.
Setting the TR0 bit enables the timer when either GATE0 in the TMOD register is logic 0 or based on the input signal INT0. The IN0PL
bit setting in IT01CF changes which state of INT0 input starts the timer counting. Setting GATE0 to 1 allows the timer to be controlled
by the external input signal INT0, facilitating pulse width measurements.
0 X X X Disabled
1 0 X X Enabled
1 1 0 0 Disabled
1 1 0 1 Enabled
1 1 1 0 Enabled
1 1 1 1 Disabled
Note:
1. X = Don't Care
Setting TR0 does not force the timer to reset. The timer registers should be loaded with the desired initial value before the timer is
enabled.
TL1 and TH1 form the 13-bit register for Timer 1 in the same manner as described above for TL0 and TH0. Timer 1 is configured and
controlled using the relevant TCON and TMOD bits just as with Timer 0. The input signal INT1 is used with Timer 1, and IN1PL in
register IT01CF determines the INT1 state that starts Timer 1 counting.
T0M CT0
Pre-scaled Clock 0
SYSCLK 1
T0
TCLK
TL0 TH0
TR0 (5 bits) (8 bits) TF0
(Interrupt Flag)
GATE0
IN0PL XOR
INT0
Mode 1 operation is the same as Mode 0, except that the counter/timer registers use all 16 bits. The counter/timers are enabled and
configured in Mode 1 in the same manner as for Mode 0. The overflow rate for Timer 0 in 16-bit mode is:
Mode 2 configures Timer 0 and Timer 1 to operate as 8-bit counter/timers with automatic reload of the start value. TL0 holds the count
and TH0 holds the reload value. When the counter in TL0 overflows from all ones to 0x00, the timer overflow flag TF0 in the TCON
register is set and the counter in TL0 is reloaded from TH0. If Timer 0 interrupts are enabled, an interrupt will occur when the TF0 flag is
set. The reload value in TH0 is not changed. TL0 must be initialized to the desired value before enabling the timer for the first count to
be correct. When in Mode 2, Timer 1 operates identically to Timer 0.
Both counter/timers are enabled and configured in Mode 2 in the same manner as Mode 0. Setting the TR0 bit enables the timer when
either GATE0 in the TMOD register is logic 0 or when the input signal INT0 is active as defined by bit IN0PL in register IT01CF.
T0M CT0
Pre-scaled Clock 0
SYSCLK 1
T0
TCLK TL0
TR0 (8 bits) TF0
(Interrupt Flag)
GATE0
IN0PL XOR
INT0 TH0
(8 bits) Reload
In Mode 3, Timer 0 is configured as two separate 8-bit counter/timers held in TL0 and TH0. The counter/timer in TL0 is controlled using
the Timer 0 control/status bits in TCON and TMOD: TR0, CT0, GATE0, and TF0. TL0 can use either the system clock or an external
input signal as its timebase. The TH0 register is restricted to a timer function sourced by the system clock or prescaled clock. TH0 is
enabled using the Timer 1 run control bit TR1. TH0 sets the Timer 1 overflow flag TF1 on overflow and thus controls the Timer 1 inter-
rupt.
Timer 1 is inactive in Mode 3. When Timer 0 is operating in Mode 3, Timer 1 can be operated in Modes 0, 1 or 2, but cannot be clocked
by external signals nor set the TF1 flag and generate an interrupt. However, the Timer 1 overflow can be used to generate baud rates
for the SMBus and/or UART, and/or initiate ADC conversions. While Timer 0 is operating in Mode 3, Timer 1 run control is handled
through its mode settings. To run Timer 1 while Timer 0 is in Mode 3, set the Timer 1 Mode as 0, 1, or 2. To disable Timer 1, configure
it for Mode 3.
T0M
CT0
Pre-scaled Clock 0
TR1 TH0
(8 bits) TF1
(Interrupt Flag)
SYSCLK 1
0
T0
TCLK
TL0
TR0 (8 bits) TF0
GATE0 (Interrupt Flag)
IN0PL XOR
INT0
Timer 2 and Timer 3 are functionally equivalent, with the only differences being the top-level connections to other parts of the system.
The timers are 16 bits wide, formed by two 8-bit SFRs: TMRnL (low byte) and TMRnH (high byte). Each timer may operate in 16-bit
auto-reload mode, dual 8-bit auto-reload (split) mode, or capture mode.
Clock Selection
Clocking for each timer is configured using the TnXCLK bit field and the TnML and TnMH bits. Both timers may be clocked by the sys-
tem clock, the system clock divided by 12, or the external clock source divided by 8 (synchronized with SYSCLK).
6
F SYSCLK > F EXTCLK ×
7
When operating in one of the 16-bit modes, the low-side timer clock is used to clock the entire 16-bit timer.
TnXCLK
TnML
SYSCLK / 12
External Clock / 8
To Timer Low
Clock Input
SYSCLK
TnMH
To Timer High
Clock Input
(for split mode)
Timer Clock Selection
Capture Sources
Capture mode allows an external input (Timer 2) or the low-frequency oscillator clock (Timer 3) to be measured against the selected
clock source. The timer 2 capture input (T2) is routed to an external pin using the crossbar.
To Timer 2
T2 Pin
Capture Input
To Timer 3
LFOSC0
Capture Input
Capture Sources
When TnSPLIT is zero, the timer operates as a 16-bit timer with auto-reload. In this mode, the selected clock source increments the
timer on every clock. As the 16-bit timer register increments and overflows from 0xFFFF to 0x0000, the 16-bit value in the timer reload
registers (TMRnRLH and TMRnRLL) is loaded into the main timer count register, and the High Byte Overflow Flag (TFnH) is set. If the
timer interrupts are enabled, an interrupt is generated on each timer overflow. Additionally, if the timer interrupts are enabled and the
TFnLEN bit is set, an interrupt is generated each time the lower 8 bits (TMRnL) overflow from 0xFF to 0x00.
The overflow rate of the timer in split 16-bit auto-reload mode is:
TFnL
Overflow TFnLEN
TFnH
TRn TMRnL TMRnH
Overflow Interrupt
Timer Low Clock
TMRnRLL TMRnRLH
Reload
When TnSPLIT is set, the timer operates as two 8-bit timers (TMRnH and TMRnL). Both 8-bit timers operate in auto-reload mode.
TMRnRLL holds the reload value for TMRnL; TMRnRLH holds the reload value for TMRnH. The TRn bit in TMRnCN handles the run
control for TMRnH. TMRnL is always running when configured for 8-bit auto-reload mode. As shown in the clock source selection tree,
the two halves of the timer may be clocked from SYSCLK or by the source selected by the TnXCLK bits.
The overflow rate of the low timer in split 8-bit auto-reload mode is:
The overflow rate of the high timer in split 8-bit auto-reload mode is:
The TFnH bit is set when TMRnH overflows from 0xFF to 0x00; the TFnL bit is set when TMRnL overflows from 0xFF to 0x00. When
timer interrupts are enabled, an interrupt is generated each time TMRnH overflows. If timer interrupts are enabled and TFnLEN is set,
an interrupt is generated each time either TMRnL or TMRnH overflows. When TFnLEN is enabled, software must check the TFnH and
TFnL flags to determine the source of the timer interrupt. The TFnH and TFnL interrupt flags are not cleared by hardware and must be
manually cleared by software.
Reload
TMRnRLH
TFnH
TRn Overflow
TMRnH
Timer High Clock Interrupt
TFnLEN
Reload
TMRnRLL
TCLK TFnL
Timer Low Clock TMRnL
Overflow
Capture mode allows a system event to be measured against the selected clock source. When used in capture mode, the timer clocks
normally from the selected clock source through the entire range of 16-bit values from 0x0000 to 0xFFFF.
Setting TFnCEN to 1 enables capture mode. In this mode, TnSPLIT should be set to 0, as the full 16-bit timer is used. Upon a falling
edge of the input capture signal, the contents of the timer register (TMRnH:TMRnL) are loaded into the reload registers
(TMRnRLH:TMRnRLL) and the TFnH flag is set. By recording the difference between two successive timer capture values, the period
of the captured signal can be determined with respect to the selected timer clock.
TFnCEN Capture
Capture Source
Bit 7 6 5 4 3 2 1 0
Access RW RW RW RW RW RW RW
Reset 0 0 0 0 0 0 0x0
Selects the clock supplied to the Timer 3 high byte (split 8-bit timer mode only).
0 EXTERNAL_CLOCK Timer 3 high byte uses the clock defined by T3XCLK in TMR3CN0.
Selects the clock supplied to Timer 3. Selects the clock supplied to the lower 8-bit timer in split 8-bit timer mode.
0 EXTERNAL_CLOCK Timer 3 low byte uses the clock defined by T3XCLK in TMR3CN0.
Selects the clock supplied to the Timer 2 high byte (split 8-bit timer mode only).
0 EXTERNAL_CLOCK Timer 2 high byte uses the clock defined by T2XCLK in TMR2CN0.
Selects the clock supplied to Timer 2. If Timer 2 is configured in split 8-bit timer mode, this bit selects the clock supplied to
the lower 8-bit timer.
0 EXTERNAL_CLOCK Timer 2 low byte uses the clock defined by T2XCLK in TMR2CN0.
Selects the clock source supplied to Timer 1. Ignored when C/T1 is set to 1.
0 PRESCALE Timer 1 uses the clock defined by the prescale field, SCA.
Selects the clock source supplied to Timer 0. Ignored when C/T0 is set to 1.
0 PRESCALE Counter/Timer 0 uses the clock defined by the prescale field, SCA.
0x3 EXTOSC_DIV_8 External oscillator divided by 8 (synchronized with the system clock).
Bit 7 6 5 4 3 2 1 0
Access RW RW RW RW RW RW RW RW
Reset 0 0 0 0 0 0 0 0
Set to 1 by hardware when Timer 1 overflows. This flag can be cleared by firmware but is automatically cleared when the
CPU vectors to the Timer 1 interrupt service routine.
Set to 1 by hardware when Timer 0 overflows. This flag can be cleared by firmware but is automatically cleared when the
CPU vectors to the Timer 0 interrupt service routine.
This flag is set by hardware when an edge/level of type defined by IT1 is detected. It can be cleared by firmware but is
automatically cleared when the CPU vectors to the External Interrupt 1 service routine in edge-triggered mode.
This bit selects whether the configured INT1 interrupt will be edge or level sensitive. INT1 is configured active low or high
by the IN1PL bit in register IT01CF.
This flag is set by hardware when an edge/level of type defined by IT0 is detected. It can be cleared by firmware but is
automatically cleared when the CPU vectors to the External Interrupt 0 service routine in edge-triggered mode.
This bit selects whether the configured INT0 interrupt will be edge or level sensitive. INT0 is configured active low or high
by the IN0PL bit in register IT01CF.
Bit 7 6 5 4 3 2 1 0
Access RW RW RW RW RW RW
1 ENABLED Timer 1 enabled only when TR1 = 1 and INT1 is active as defined by bit IN1PL in
register IT01CF.
0 TIMER Timer Mode. Timer 1 increments on the clock defined by T1M in the CKCON0
register.
1 ENABLED Timer 0 enabled only when TR0 = 1 and INT0 is active as defined by bit IN0PL in
register IT01CF.
0 TIMER Timer Mode. Timer 0 increments on the clock defined by T0M in the CKCON0
register.
Bit 7 6 5 4 3 2 1 0
Name TL0
Access RW
Reset 0x00
Bit 7 6 5 4 3 2 1 0
Name TL1
Access RW
Reset 0x00
Bit 7 6 5 4 3 2 1 0
Name TH0
Access RW
Reset 0x00
Bit 7 6 5 4 3 2 1 0
Name TH1
Access RW
Reset 0x00
Bit 7 6 5 4 3 2 1 0
Access RW RW RW RW RW RW R RW
Reset 0 0 0 0 0 0 0 0
Set by hardware when the Timer 2 high byte overflows from 0xFF to 0x00. In 16-bit mode, this will occur when Timer 2
overflows from 0xFFFF to 0x0000. When the Timer 2 interrupt is enabled, setting this bit causes the CPU to vector to the
Timer 2 interrupt service routine. This bit must be cleared by firmware.
Set by hardware when the Timer 2 low byte overflows from 0xFF to 0x00. TF2L will be set when the low byte overflows
regardless of the Timer 2 mode. This bit must be cleared by firmware.
When set to 1, this bit enables Timer 2 Low Byte interrupts. If Timer 2 interrupts are also enabled, an interrupt will be gen-
erated when the low byte of Timer 2 overflows.
When set to 1, this bit enables Timer 2 Capture Mode. If TF2CEN is set and Timer 2 interrupts are enabled, an interrupt will
be generated on a falling edge of the selected T2 input pin, and the current 16-bit timer value in TMR2H:TMR2L will be
copied to TMR2RLH:TMR2RLL.
When this bit is set, Timer 2 operates as two 8-bit timers with auto-reload.
Timer 2 is enabled by setting this bit to 1. In 8-bit mode, this bit enables/disables TMR2H only; TMR2L is always enabled in
split mode.
This bit selects the external clock source for Timer 2. If Timer 2 is in 8-bit mode, this bit selects the external oscillator clock
source for both timer bytes. However, the Timer 2 Clock Select bits (T2MH and T2ML) may still be used to select between
the external clock and the system clock for either timer.
1 EXTOSC_DIV_8 Timer 2 clock is the external oscillator divided by 8 (synchronized with SYSCLK).
Bit 7 6 5 4 3 2 1 0
Name TMR2RLL
Access RW
Reset 0x00
When operating in one of the auto-reload modes, TMR2RLL holds the reload value for the low byte of Timer 2 (TMR2L).
When operating in capture mode, TMR2RLL is the captured value of TMR2L.
Bit 7 6 5 4 3 2 1 0
Name TMR2RLH
Access RW
Reset 0x00
When operating in one of the auto-reload modes, TMR2RLH holds the reload value for the high byte of Timer 2 (TMR2H).
When operating in capture mode, TMR2RLH is the captured value of TMR2H.
Bit 7 6 5 4 3 2 1 0
Name TMR2L
Access RW
Reset 0x00
In 16-bit mode, the TMR2L register contains the low byte of the 16-bit Timer 2. In 8-bit mode, TMR2L contains the 8-bit low
byte timer value.
Bit 7 6 5 4 3 2 1 0
Name TMR2H
Access RW
Reset 0x00
In 16-bit mode, the TMR2H register contains the high byte of the 16-bit Timer 2. In 8-bit mode, TMR2H contains the 8-bit
high byte timer value.
Bit 7 6 5 4 3 2 1 0
Access RW RW RW RW RW RW RW RW
Reset 0 0 0 0 0 0 0 0
Set by hardware when the Timer 3 high byte overflows from 0xFF to 0x00. In 16-bit mode, this will occur when Timer 3
overflows from 0xFFFF to 0x0000. When the Timer 3 interrupt is enabled, setting this bit causes the CPU to vector to the
Timer 3 interrupt service routine. This bit must be cleared by firmware.
Set by hardware when the Timer 3 low byte overflows from 0xFF to 0x00. TF3L will be set when the low byte overflows
regardless of the Timer 3 mode. This bit must be cleared by firmware.
When set to 1, this bit enables Timer 3 Low Byte interrupts. If Timer 3 interrupts are also enabled, an interrupt will be gen-
erated when the low byte of Timer 3 overflows.
When set to 1, this bit enables Timer 3 Capture Mode. If TF3CEN is set and Timer 3 interrupts are enabled, an interrupt will
be generated on a falling edge of the low-frequency oscillator output, and the current 16-bit timer value in TMR3H:TMR3L
will be copied to TMR3RLH:TMR3RLL.
When this bit is set, Timer 3 operates as two 8-bit timers with auto-reload.
Timer 3 is enabled by setting this bit to 1. In 8-bit mode, this bit enables/disables TMR3H only; TMR3L is always enabled in
split mode.
This bit selects the external clock source for Timer 3. If Timer 3 is in 8-bit mode, this bit selects the external oscillator clock
source for both timer bytes. However, the Timer 3 Clock Select bits (T3MH and T3ML) may still be used to select between
the external clock and the system clock for either timer.
1 EXTOSC_DIV_8 Timer 3 clock is the external oscillator divided by 8 (synchronized with SYSCLK).
Bit 7 6 5 4 3 2 1 0
Name TMR3RLL
Access RW
Reset 0x00
When operating in one of the auto-reload modes, TMR3RLL holds the reload value for the low byte of Timer 3 (TMR3L).
When operating in capture mode, TMR3RLL is the captured value of TMR3L.
Bit 7 6 5 4 3 2 1 0
Name TMR3RLH
Access RW
Reset 0x00
When operating in one of the auto-reload modes, TMR3RLH holds the reload value for the high byte of Timer 3 (TMR3H).
When operating in capture mode, TMR3RLH is the captured value of TMR3H.
Bit 7 6 5 4 3 2 1 0
Name TMR3L
Access RW
Reset 0x00
In 16-bit mode, the TMR3L register contains the low byte of the 16-bit Timer 3. In 8-bit mode, TMR3L contains the 8-bit low
byte timer value.
Bit 7 6 5 4 3 2 1 0
Name TMR3H
Access RW
Reset 0x00
In 16-bit mode, the TMR3H register contains the high byte of the 16-bit Timer 3. In 8-bit mode, TMR3H contains the 8-bit
high byte timer value.
19.1 Introduction
UART0 is an asynchronous, full duplex serial port offering modes 1 and 3 of the standard 8051 UART. Enhanced baud rate support
allows a wide range of clock sources to generate standard baud rates. Received data buffering allows UART0 to start reception of a
second incoming data byte before software has finished reading the previous data byte.
UART0 has two associated SFRs: Serial Control Register 0 (SCON0) and Serial Data Buffer 0 (SBUF0). The single SBUF0 location
provides access to both transmit and receive registers.
Note: Writes to SBUF0 always access the transmit register. Reads of SBUF0 always access the buffered receive register; it is not pos-
sible to read data from the transmit register.
With UART0 interrupts enabled, an interrupt is generated each time a transmit is completed (TI is set in SCON0), or a data byte has
been received (RI is set in SCON0). The UART0 interrupt flags are not cleared by hardware when the CPU vectors to the interrupt
service routine. They must be cleared manually by software, allowing software to determine the cause of the UART0 interrupt (transmit
complete or receive complete).
UART0
TB8
TI, RI (9th bit)
Interrupts
Output Shift
Register
TX
Control /
Configuration
SBUF (8 LSBs)
RB8
(9th bit)
START
Detection
19.2 Features
The UART uses two signals (TX and RX) and a predetermined fixed baud rate to provide asynchronous communications with other
devices.
The UART0 baud rate is generated by Timer 1 in 8-bit auto-reload mode. The TX clock is generated by TL1; the RX clock is generated
by a copy of TL1, which is not user-accessible. Both TX and RX timer overflows are divided by two to generate the TX and RX baud
rates. The RX timer runs when Timer 1 is enabled and uses the same reload value (TH1). However, an RX timer reload is forced when
a START condition is detected on the RX pin. This allows a receive to begin any time a START is detected, independent of the TX timer
state.
TL1 2 TX Clock
TH1
START
Detection
RX Timer 2 RX Clock
Timer 1 should be configured for 8-bit auto-reload mode (mode 2). The Timer 1 reload value and prescaler should be set so that over-
flows occur at twice the desired UART0 baud rate. The UART0 baud rate is half of the Timer 1 overflow rate. Configuring the Timer 1
overflow rate is discussed in the timer sections.
UART0 has two options for data formatting. All data transfers begin with a start bit (logic low), followed by the data (sent LSB-first), and
end with a stop bit (logic high). The data length of the UART0 module is normally 8 bits. An extra 9th bit may be added to the MSB of
data field for use in multi-processor communications or for implementing parity checks on the data. The S0MODE bit in the SCON reg-
ister selects between 8 or 9-bit data transfers.
MARK START
BIT D0 D1 D2 D3 D4 D5 D6 D7 STOP
SPACE BIT
BIT TIMES
BIT SAMPLING
MARK START
BIT D0 D1 D2 D3 D4 D5 D6 D7 D8 STOP
SPACE BIT
BIT TIMES
BIT SAMPLING
UART0 provides standard asynchronous, full duplex communication. All data sent or received goes through the SBUF0 register and (in
9-bit mode) the RB8 bit in the SCON0 register.
Transmitting Data
Data transmission is initiated when software writes a data byte to the SBUF0 register. If 9-bit mode is used, software should set up the
desired 9th bit in TB8 prior to writing SBUF0. Data is transmitted LSB first from the TX pin. The TI flag in SCON0 is set at the end of the
transmission (at the beginning of the stop-bit time). If TI interrupts are enabled, TI will trigger an interrupt.
Receiving Data
To enable data reception, firmware should write the REN bit to 1. Data reception begins when a start condition is recognized on the RX
pin. Data will be received at the selected baud rate through the end of the data phase. Data will be transferred into the receive buffer
under the following conditions:
• There is room in the receive buffer for the data.
• MCE is set to 1 and the stop bit is also 1 (8-bit mode).
• MCE is set to 1 and the 9th bit is also 1 (9-bit mode).
• MCE is 0 (stop or 9th bit will be ignored).
In the event that there is not room in the receive buffer for the data, the most recently received data will be lost. The RI flag will be set
any time that valid data has been pushed into the receive buffer. If RI interrupts are enabled, RI will trigger an interrupt. Firmware may
read the 8 LSBs of received data by reading the SBUF0 register. The RB8 bit in SCON0 will represent the 9th received bit (in 9-bit
mode) or the stop bit (in 8-bit mode), and should be read prior to reading SBUF0.
9-Bit UART mode supports multiprocessor communication between a master processor and one or more slave processors by special
use of the ninth data bit. When a master processor wants to transmit to one or more slaves, it first sends an address byte to select the
target(s). An address byte differs from a data byte in that its ninth bit is logic 1; in a data byte, the ninth bit is always set to logic 0.
Setting the MCE bit of a slave processor configures its UART such that when a stop bit is received, the UART will generate an interrupt
only if the ninth bit is logic 1 (RB8 = 1) signifying an address byte has been received. In the UART interrupt handler, software will com-
pare the received address with the slave's own assigned 8-bit address. If the addresses match, the slave will clear its MCE bit to enable
interrupts on the reception of the following data byte(s). Slaves that weren't addressed leave their MCE bits set and do not generate
interrupts on the reception of the following data bytes, thereby ignoring the data. Once the entire message is received, the addressed
slave resets its MCE bit to ignore all transmissions until it receives the next address byte.
Multiple addresses can be assigned to a single slave and/or a single address can be assigned to multiple slaves, thereby enabling
"broadcast" transmissions to more than one slave simultaneously. The master processor can be configured to receive all transmissions
or a protocol can be implemented such that the master/slave role is temporarily reversed to enable half-duplex transmission between
the original master and slave(s).
Bit 7 6 5 4 3 2 1 0
Access RW R RW RW RW RW RW RW
Reset 0 1 0 0 0 0 0 0
This bit enables checking of the stop bit or the 9th bit in multi-drop communication buses. The function of this bit is depend-
ent on the UART0 operation mode selected by the SMODE bit. In Mode 0 (8-bits), the peripheral will check that the stop bit
is logic 1. In Mode 1 (9-bits) the peripheral will check for a logic 1 on the 9th bit.
1 MULTI_ENABLED RI is set and an interrupt is generated only when the stop bit is logic 1 (Mode 0)
or when the 9th bit is logic 1 (Mode 1).
The logic level of this bit will be sent as the ninth transmission bit in 9-bit UART Mode (Mode 1). Unused in 8-bit mode
(Mode 0).
RB8 is assigned the value of the STOP bit in Mode 0; it is assigned the value of the 9th data bit in Mode 1.
Set by hardware when a byte of data has been transmitted by UART0 (after the 8th bit in 8-bit UART Mode, or at the begin-
ning of the STOP bit in 9-bit UART Mode). When the UART0 interrupt is enabled, setting this bit causes the CPU to vector
to the UART0 interrupt service routine. This bit must be cleared manually by firmware.
Set to 1 by hardware when a byte of data has been received by UART0 (set at the STOP bit sampling time). When the
UART0 interrupt is enabled, setting this bit to 1 causes the CPU to vector to the UART0 interrupt service routine. This bit
must be cleared manually by firmware.
Bit 7 6 5 4 3 2 1 0
Name SBUF0
Access RW
Reset 0x00
This SFR accesses two registers: a transmit shift register and a receive latch register. When data is written to SBUF0, it
goes to the transmit shift register and is held for serial transmission. Writing a byte to SBUF0 initiates the transmission. A
read of SBUF0 returns the contents of the receive latch.
20.1 Introduction
The device includes a programmable watchdog timer (WDT) running off the low-frequency oscillator. A WDT overflow forces the MCU
into the reset state. To prevent the reset, the WDT must be restarted by application software before overflow. If the system experiences
a software or hardware malfunction preventing the software from restarting the WDT, the WDT overflows and causes a reset.
Following a reset, the WDT is automatically enabled and running with the default maximum time interval. If needed, the WDT can be
disabled by system software or locked on to prevent accidental disabling. Once locked, the WDT cannot be disabled until the next sys-
tem reset. The state of the RSTb pin is unaffected by this reset.
The WDT consists of an internal timer running from the low-frequency oscillator. The timer measures the period between specific writes
to its control register. If this period exceeds the programmed limit, a WDT reset is generated. The WDT can be enabled and disabled as
needed in software, or can be permanently enabled if desired. When the WDT is active, the low-frequency oscillator is forced on. All
watchdog features are controlled via the Watchdog Timer Control Register (WDTCN).
Watchdog Timer
LFOSC0
Watchdog
Reset
Timeout Interval
20.2 Features
The watchdog timer includes a 16-bit timer with a programmable reset period. The registers are protected from inadvertent access by
an independent lock and key interface.
The watchdog timer is both enabled and reset by writing 0xA5 to the WDTCN register. The user's application software should include
periodic writes of 0xA5 to WDTCN as needed to prevent a watchdog timer overflow. The WDT is enabled and reset as a result of any
system reset.
Writing 0xDE followed by 0xAD to the WDTCN register disables the WDT. The following code segment illustrates disabling the WDT:
The writes of 0xDE and 0xAD must occur within 4 clock cycles of each other, or the disable operation is ignored. Interrupts should be
disabled during this procedure to avoid delay between the two writes.
Writing 0xFF to WDTCN locks out the disable feature. Once locked out, the disable operation is ignored until the next system reset.
Writing 0xFF does not enable or reset the watchdog timer. Applications always intending to use the watchdog should write 0xFF to
WDTCN in the initialization code.
WDTCN.[2:0] controls the watchdog timeout interval. The interval is given by the following equation, where TLFOSC is the low-frequency
oscillator clock period:
This provides a nominal interval range of 0.8 ms to 13.1 s when LFOSC0 is configured to run at 80 kHz. WDTCN.7 must be logic 0
when setting this interval. Reading WDTCN returns the programmed interval. WDTCN.[2:0] reads 111b after a system reset.
Bit 7 6 5 4 3 2 1 0
Name WDTCN
Access RW
Reset 0x17
The WDT control field has different behavior for reads and writes.
Read:
When reading the WDTCN register, the lower three bits (WDTCN[2:0]) indicate the current timeout interval. Bit WDTCN.4
indicates whether the WDT is active (logic 1) or inactive (logic 0).
Write:
Writing the WDTCN register can set the timeout interval, enable the WDT, disable the WDT, reset the WDT, or lock the
WDT to prevent disabling.
Writing to WDTCN with the MSB (WDTCN.7) cleared to 0 will set the timeout interval to the value in bits WDTCN[2:0].
Writing 0xDE followed within 4 system clocks by 0xAD disables the WDT.
Writing 0xFF locks out the disable feature until the next device reset.
21.1 Introduction
The device includes an on-chip Silicon Labs 2-Wire (C2) debug interface that allows flash programming and in-system debugging with
the production part installed in the end application. The C2 interface uses a clock signal (C2CK) and a bi-directional C2 data signal
(C2D) to transfer information between the device and a host system. Details on the C2 protocol can be found in the C2 Interface Speci-
fication.
21.2 Features
The C2 protocol allows the C2 pins to be shared with user functions so that in-system debugging and flash programming may be per-
formed. C2CK is shared with the RSTb pin, while the C2D signal is shared with a port I/O pin. This is possible because C2 communica-
tion is typically performed when the device is in the halt state, where all on-chip peripherals and user software are stalled. In this halted
state, the C2 interface can safely "borrow" the C2CK and C2D pins. In most applications, external resistors are required to isolate C2
interface traffic from the user application.
MCU
Output (c)
C2 Interface Master
Bit 7 6 5 4 3 2 1 0
Name C2ADD
Access RW
Reset 0x00
The C2ADD register is accessed via the C2 interface. The value written to C2ADD selects the target data register for C2
Data Read and Data Write commands.
0x00: C2DEVID
0x01: C2REVID
0x02: C2FPCTL
0xB4: C2FPDAT
Bit 7 6 5 4 3 2 1 0
Name C2DEVID
Access R
Reset 0x30
C2 Address: 0x00
Bit 7 6 5 4 3 2 1 0
Name C2REVID
Access R
Reset Varies
C2 Address: 0x01
This read-only register returns the 8-bit revision ID. For example: 0x02 = Revision A.
Bit 7 6 5 4 3 2 1 0
Name C2FPCTL
Access RW
Reset 0x00
C2 Address: 0x02
This register is used to enable flash programming via the C2 interface. To enable C2 flash programming, the following co-
des must be written in order: 0x02, 0x01. Note that once C2 flash programming is enabled, a system reset must be issued
to resume normal operation.
Bit 7 6 5 4 3 2 1 0
Name C2FPDAT
Access RW
Reset 0x00
C2 Address: 0xB4
This register is used to pass flash commands, addresses, and data during C2 flash accesses. Valid commands are listed
below.
1. System Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Power . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.3 I/O. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.4 Clocking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.5 Counters/Timers and PWM . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.6 Communications and Other Digital Peripherals . . . . . . . . . . . . . . . . . . . 4
1.7 Analog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.8 Reset Sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.9 Debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.10 Bootloader . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2. Memory Organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.1 Memory Organization . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.2 Program Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.3 Data Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.4 Memory Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
4. Flash Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
4.1 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .19
4.2 Features. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .21
4.3 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . .22
4.3.1 Security Options . . . . . . . . . . . . . . . . . . . . . . . . . . . .22
4.3.2 Programming the Flash Memory . . . . . . . . . . . . . . . . . . . . . . .23
4.3.2.1 Flash Lock and Key Functions . . . . . . . . . . . . . . . . . . . . . . .23
4.3.2.2 Flash Page Erase Procedure . . . . . . . . . . . . . . . . . . . . . . .23
4.3.2.3 Flash Byte Write Procedure . . . . . . . . . . . . . . . . . . . . . . . .23
4.3.3 Flash Write and Erase Precautions . . . . . . . . . . . . . . . . . . . . . .24
4.4 Flash Control Registers . . . . . . . . . . . . . . . . . . . . . . . . . .25
4.4.1 PSCTL: Program Store Control . . . . . . . . . . . . . . . . . . . . . . .25
4.4.2 FLKEY: Flash Lock and Key . . . . . . . . . . . . . . . . . . . . . . . .26
5. Device Identification . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
5.1 Device Identification . . . . . . . . . . . . . . . . . . . . . . . . . . . .27
5.2 Unique Identifier . . . . . . . . . . . . . . . . . . . . . . . . . . . . .27
5.3 Device Identification Registers . . . . . . . . . . . . . . . . . . . . . . . .27
5.3.1 DEVICEID: Device Identification . . . . . . . . . . . . . . . . . . . . . . .27
5.3.2 DERIVID: Derivative Identification . . . . . . . . . . . . . . . . . . . . . .28
5.3.3 REVID: Revision Identifcation . . . . . . . . . . . . . . . . . . . . . . . .28
www.silabs.com/simplicity
Disclaimer
Silicon Laboratories intends to provide customers with the latest, accurate, and in-depth documentation of all peripherals and modules available for system and software implementers
using or intending to use the Silicon Laboratories products. Characterization data, available modules and peripherals, memory sizes and memory addresses refer to each specific
device, and "Typical" parameters provided can and do vary in different applications. Application examples described herein are for illustrative purposes only. Silicon Laboratories
reserves the right to make changes without further notice and limitation to product information, specifications, and descriptions herein, and does not give warranties as to the accuracy
or completeness of the included information. Silicon Laboratories shall have no liability for the consequences of use of the information supplied herein. This document does not imply
or express copyright licenses granted hereunder to design or fabricate any integrated circuits. The products must not be used within any Life Support System without the specific
written consent of Silicon Laboratories. A "Life Support System" is any product or system intended to support or sustain life and/or health, which, if it fails, can be reasonably expected
to result in significant personal injury or death. Silicon Laboratories products are generally not intended for military applications. Silicon Laboratories products shall under no
circumstances be used in weapons of mass destruction including (but not limited to) nuclear, biological or chemical weapons, or missiles capable of delivering such weapons.
Trademark Information
Silicon Laboratories Inc., Silicon Laboratories, Silicon Labs, SiLabs and the Silicon Labs logo, CMEMS®, EFM, EFM32, EFR, Energy Micro, Energy Micro logo and combinations
thereof, "the world’s most energy friendly microcontrollers", Ember®, EZLink®, EZMac®, EZRadio®, EZRadioPRO®, DSPLL®, ISOmodem ®, Precision32®, ProSLIC®, SiPHY®,
USBXpress® and others are trademarks or registered trademarks of Silicon Laboratories Inc. ARM, CORTEX, Cortex-M3 and THUMB are trademarks or registered trademarks of
ARM Holdings. Keil is a registered trademark of ARM Limited. All other products or brand names mentioned herein are trademarks of their respective holders.
http://www.silabs.com