Silicon Laboratories C8051F12 Series Manual

Silicon Laboratories C8051F12 Series Manual

8k isp flash mcu
Table of Contents

Advertisement

Quick Links

Analog Peripherals
-
10 or 12-bit SAR ADC
± 1 LSB INL
Programmable throughput up to 100 ksps
Up to 8 external inputs; programmable as single-
ended or differential
Programmable amplifier gain: 16, 8, 4, 2, 1, 0.5
Data-dependent windowed interrupt generator
Built-in temperature sensor
-
8-bit SAR ADC ('F12x Only)
Programmable throughput up to 500 ksps
8 external inputs (single-ended or differential)
Programmable amplifier gain: 4, 2, 1, 0.5
-
Two 12-bit DACs ('F12x Only)
Can synchronize outputs to timers for jitter-free wave-
form generation
-
Two Analog Comparators
-
Voltage Reference
V
-
Monitor/Brown-Out Detector
DD
On-Chip JTAG Debug & Boundary Scan
-
On-chip debug circuitry facilitates full-speed, non-
intrusive in-circuit/in-system debugging
-
Provides breakpoints, single-stepping, watchpoints,
stack monitor; inspect/modify memory and registers
-
Superior performance to emulation systems using
ICE-chips, target pods, and sockets
-
IEEE1149.1 compliant boundary scan
-
Complete development kit
100-Pin TQFP or 64-Pin TQFP Packaging
-
Temperature Range: –40 to +85 °C
-
RoHS Available
Rev. 1.4 12/03
ANALOG PERIPHERALS
VREF
PGA
+
+
-
-
VOLTAGE
COMPARATORS
8-bit
500ksps
PGA
ADC
C8051F12x Only
HIGH-SPEED CONTROLLER CORE
8051 CPU
128/64 kB
(50 or 100MIPS)
ISP FLASH
20
INTERRUPTS
CIRCUITRY
Copyright © 2003 by Silicon Laboratories
C8051F120/1/2/3/4/5/6/7
8K ISP FLASH MCU Family
High Speed 8051 µC Core
-
Pipelined instruction architecture; executes 70% of
instruction set in 1 or 2 system clocks
-
100 MIPS or 50 MIPS throughput with on-chip PLL
-
2-cycle 16 x 16 MAC engine (C8051F120/1/2/3 and
C8051F130/1/2/3 only)
Memory
-
8448 bytes internal data RAM (8 k + 256)
-
128 or 64 kB Banked Flash; in-system programma-
ble in 1024-byte sectors
-
External 64 kB data memory interface (programma-
ble multiplexed or non-multiplexed modes)
Digital Peripherals
-
8 byte-wide port I/O (100TQFP); 5 V tolerant
-
4 Byte-wide port I/O (64TQFP); 5 V tolerant
-
Hardware SMBus™ (I2C™ Compatible), SPI™, and
two UART serial ports available concurrently
-
Programmable 16-bit counter/timer array with
6 capture/compare modules
-
5 general purpose 16-bit counter/timers
-
Dedicated watchdog timer; bi-directional reset pin
Clock Sources
-
Internal precision oscillator: 24.5 MHz
-
Flexible PLL technology
-
External Oscillator: Crystal, RC, C, or clock
Voltage Supples
-
Range: 2.7–3.6 V (50 MIPS) 3.0–3.6 V (100 MIPS)
-
Power saving sleep and shutdown modes
DIGITAL I/O
UART0
10/12-bit
UART1
100ksps
SMBus
ADC
SPI Bus
PCA
TEMP
Timer 0
SENSOR
Timer 1
Timer 2
Timer 3
12-Bit
DAC
Timer 4
12-Bit
DAC
64 pin
8448 B
16 x 16 MAC
SRAM
('F120/1/2/3, 'F13x)
DEBUG
CLOCK / PLL
CIRCUIT
C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3
Port 0
Port 1
Port 2
Port 3
Port 4
Port 5
Port 6
Port 7
100 pin
JTAG

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the C8051F12 Series and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

Summary of Contents for Silicon Laboratories C8051F12 Series

  • Page 1 HIGH-SPEED CONTROLLER CORE 8051 CPU 128/64 kB 8448 B 16 x 16 MAC (50 or 100MIPS) ISP FLASH SRAM ('F120/1/2/3, 'F13x) DEBUG CLOCK / PLL JTAG INTERRUPTS CIRCUITRY CIRCUIT Rev. 1.4 12/03 Copyright © 2003 by Silicon Laboratories C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3...
  • Page 2 C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 OTES Rev. 1.4...
  • Page 3: Table Of Contents

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Table of Contents 1. System Overview....................19 1.1. CIP-51™ Microcontroller Core................27 1.1.1. Fully 8051 Compatible................27 1.1.2. Improved Throughput ................27 1.1.3. Additional Features .................. 28 1.2. On-Chip Memory....................29 1.3. JTAG Debug and Boundary Scan..............30 1.4.
  • Page 4 C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 8. DACs, 12-Bit Voltage Mode (C8051F12x Only) ..........105 8.1. DAC Output Scheduling.................. 105 8.1.1. Update Output On-Demand ..............106 8.1.2. Update Output Based on Timer Overflow ..........106 8.2. DAC Output Scaling/Justification ..............106 9. Voltage Reference ....................113 9.1.
  • Page 5 C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 13. Reset Sources....................... 177 13.1.Power-on Reset....................178 13.2.Power-fail Reset ..................... 178 13.3.External Reset ....................179 13.4.Missing Clock Detector Reset ................ 179 13.5.Comparator0 Reset ..................179 13.6.External CNVSTR0 Pin Reset ................ 179 13.7.Watchdog Timer Reset................... 179 13.7.1.Enable/Reset WDT ................180 13.7.2.Disable WDT ..................
  • Page 6 C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 17.5.3.Split Mode with Bank Select..............225 17.5.4.External Only..................225 17.6.EMIF Timing ....................225 17.6.1.Non-multiplexed Mode ................227 17.6.2.Multiplexed Mode ................... 230 18. Port Input/Output....................235 18.1.Ports 0 through 3 and the Priority Crossbar Decoder........238 18.1.1.Crossbar Pin Assignment and Allocation ..........238 18.1.2.Configuring the Output Modes of the Port Pins........
  • Page 7 C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 20.2.SPI0 Master Mode Operation ................. 275 20.3.SPI0 Slave Mode Operation ................277 20.4.SPI0 Interrupt Sources ................... 277 20.5.Serial Clock Timing..................278 20.6.SPI Special Function Registers ..............280 21. UART0........................287 21.1.UART0 Operational Modes ................288 21.1.1.Mode 0: Synchronous Mode ..............288 21.1.2.Mode 1: 8-Bit UART, Variable Baud Rate..........
  • Page 8 C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 25. JTAG (IEEE 1149.1) ....................341 25.1.Boundary Scan ....................342 25.1.1.EXTEST Instruction................343 25.1.2.SAMPLE Instruction ................343 25.1.3.BYPASS Instruction ................343 25.1.4.IDCODE Instruction................343 25.2.Flash Programming Commands..............344 25.3.Debug Support ....................347 Document Change List..................... 349 Contact Information....................350 Rev.
  • Page 9 C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 List of Figures 1. System Overview Figure 1.1. C8051F120/124 Block Diagram ............. 21 Figure 1.2. C8051F121/125 Block Diagram ............. 22 Figure 1.3. C8051F122/126 Block Diagram ............. 23 Figure 1.4. C8051F123/127 Block Diagram ............. 24 Figure 1.5. C8051F130/132 Block Diagram ............. 25 Figure 1.6.
  • Page 10 C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 6. ADC0 (10-Bit ADC, C8051F122/3/6/7 and C8051F13x Only) Figure 6.1. 10-Bit ADC0 Functional Block Diagram ..........73 Figure 6.2. Typical Temperature Sensor Transfer Function........74 Figure 6.3. ADC0 Track and Conversion Example Timing........76 Figure 6.4. ADC0 Equivalent Input Circuits.............. 77 Figure 6.5.
  • Page 11 C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 13. Reset Sources Figure 13.1. Reset Sources..................177 Figure 13.2. Reset Timing ..................178 14. Oscillators Figure 14.1. Oscillator Diagram................185 Figure 14.2. PLL Block Diagram................191 15. Flash Memory Figure 15.1. Flash Memory Map for MOVC Read and MOVX Write Operations ... 201 Figure 15.2.
  • Page 12 C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Figure 20.4. 4-Wire Single Master and Slave Mode Connection Diagram ..... 276 Figure 20.5. Master Mode Data/Clock Timing ............278 Figure 20.6. Slave Mode Data/Clock Timing (CKPHA = 0) ........279 Figure 20.7. Slave Mode Data/Clock Timing (CKPHA = 1) ........279 Figure 20.8.
  • Page 13 C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 List Of Tables 1. System Overview Table 1.1. Product Selection Guide ................. 20 2. Absolute Maximum Ratings Table 2.1. Absolute Maximum Ratings ..............38 3. Global DC Electrical Characteristics Table 3.1. Global DC Electrical Characteristics (C8051F120/1/2/3 and C8051F130/1/2/3) ..........39 Table 3.2.
  • Page 14 C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 18. Port Input/Output Table 18.1. Port I/O DC Electrical Characteristics ..........236 19. System Management Bus / I2C Bus (SMBus0) Table 19.1. SMB0STA Status Codes and States ..........270 20. Enhanced Serial Peripheral Interface (SPI0) Table 20.1. SPI Slave Timing Parameters ............285 21.
  • Page 15 C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 List of Registers SFR Definition 5.1. AMX0CF: AMUX0 Configuration ......60 SFR Definition 5.2. AMX0SL: AMUX0 Channel Select ......61 SFR Definition 5.3.
  • Page 16 C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 11.4. SFRNEXT: SFR Next Register ......143 SFR Definition 11.5. SFRLAST: SFR Last Register ......143 SFR Definition 11.6.
  • Page 17 C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 16.5. FLSTAT: Flash Status ....... 217 SFR Definition 17.1.
  • Page 18 C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 23.6. TH0: Timer 0 High Byte ....... 316 SFR Definition 23.7.
  • Page 19: System Overview

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 System Overview The C8051F12x and C8051F13x device families are fully integrated mixed-signal System-on-a-Chip MCUs with 64 digital I/O pins (100-pin TQFP) or 32 digital I/O pins (64-pin TQFP). Highlighted features are listed below. Refer to Table 1.1 for specific product feature selection. •...
  • Page 20: Table 1.1. Product Selection Guide

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Table 1.1. Product Selection Guide        C8051F120 100 128 k 8448 12 2 100TQFP         C8051F120-GQ 100 128 k 8448 12 2 100TQFP     ...
  • Page 21: Figure 1.1. C8051F120/124 Block Diagram

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Port I/O Config. Digital Power DGND UART0 P0.0 DGND DGND SFR Bus UART1 P0.7 SMBus Analog Power AGND P1.0/AIN2.0 AGND SPI Bus 256 byte P1.7/AIN2.7 Boundary Scan JTAG Logic Timers 0, Debug HW P2.0 1, 2, 4 8 kB Reset P2.7 XRAM...
  • Page 22: Figure 1.2. C8051F121/125 Block Diagram

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Port I/O Config. Digital Power DGND UART0 P0.0 DGND DGND SFR Bus UART1 P0.7 SMBus Analog Power AGND P1.0/AIN2.0 SPI Bus 256 byte P1.7/AIN2.7 Boundary Scan JTAG Logic Timers 0, Debug HW P2.0 1, 2, 4 8 kB Reset P2.7 XRAM...
  • Page 23: Figure 1.3. C8051F122/126 Block Diagram

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Port I/O Config. Digital Power DGND UART0 P0.0 DGND DGND SFR Bus UART1 P0.7 SMBus Analog Power AGND P1.0/AIN2.0 AGND SPI Bus 256 byte P1.7/AIN2.7 Boundary Scan JTAG Logic Timers 0, Debug HW P2.0 1, 2, 4 8 kB Reset P2.7 Timer 3/...
  • Page 24: Figure 1.4. C8051F123/127 Block Diagram

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Port I/O Config. Digital Power DGND P0.0 UART0 DGND DGND SFR Bus P0.7 UART1 SMBus Analog Power AGND P1.0/AIN2.0 SPI Bus 256 byte P1.7/AIN2.7 Boundary Scan JTAG Logic Timers 0, Debug HW P2.0 1, 2, 4 8 kb Reset P2.7 XRAM...
  • Page 25: Figure 1.5. C8051F130/132 Block Diagram

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Port I/O Config. Digital Power DGND P0.0 UART0 DGND DGND SFR Bus P0.7 UART1 SMBus Analog Power AGND P1.0/AIN2.0 AGND SPI Bus 256 byte P1.7/AIN2.7 Boundary Scan JTAG Logic Timers 0, Debug HW P2.0 1, 2, 4 8kbyte Reset P2.7 XRAM...
  • Page 26: Figure 1.6. C8051F131/133 Block Diagram

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Port I/O Config. Digital Power DGND UART0 P0.0 DGND DGND SFR Bus UART1 P0.7 SMBus Analog Power AGND P1.0/AIN2.0 SPI Bus 256 byte P1.7/AIN2.7 Boundary Scan JTAG Logic Timers 0, Debug HW P2.0 1, 2, 4 8kbyte Reset P2.7 Timer 3/ XRAM...
  • Page 27: Microcontroller Core

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 1.1. CIP-51™ Microcontroller Core 1.1.1. Fully 8051 Compatible The C8051F12x and C8051F13x utilize Silicon Labs’ proprietary CIP-51 microcontroller core. The CIP-51 is fully compatible with the MCS-51™ instruction set; standard 803x/805x assemblers and compilers can be used to develop software. The core has all the peripherals included with a standard 8052, including five 16-bit counter/timers, two full-duplex UARTs, 256 bytes of internal RAM, 128 byte Special Function Regis- ter (SFR) address space, and 8/4 byte-wide I/O Ports.
  • Page 28: Additional Features

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 1.1.3. Additional Features Several key enhancements are implemented in the CIP-51 core and peripherals to improve overall perfor- mance and ease of use in end applications. The extended interrupt handler provides 20 interrupt sources into the CIP-51 (as opposed to 7 for the stan- dard 8051), allowing the numerous analog and digital peripherals to interrupt the controller.
  • Page 29: On-Chip Memory

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 1.2. On-Chip Memory The CIP-51 has a standard 8051 program and data address configuration. It includes 256 bytes of data RAM, with the upper 128 bytes dual-mapped. Indirect addressing accesses the upper 128 bytes of general purpose RAM, and direct addressing accesses the 128 byte SFR address space. The lower 128 bytes of RAM are accessible via direct and indirect addressing.
  • Page 30: Jtag Debug And Boundary Scan

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 1.3. JTAG Debug and Boundary Scan JTAG boundary scan and debug circuitry is included which provides non-intrusive, full speed, in-circuit debugging using the production part installed in the end application, via the four-pin JTAG interface. The JTAG port is fully compliant to IEEE 1149.1, providing full boundary scan for test and manufacturing pur- poses.
  • Page 31: 16 X 16 Mac (Multiply And Accumulate) Engine

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 1.4. 16 x 16 MAC (Multiply and Accumulate) Engine The C8051F120/1/2/3 and C8051F130/1/2/3 devices include a multiply and accumulate engine which can be used to speed up many mathematical operations. MAC0 contains a 16-by-16 bit multiplier and a 40-bit adder, which can perform integer or fractional multiply-accumulate and multiply operations on signed input values in two SYSCLK cycles.
  • Page 32: Programmable Digital I/O And Crossbar

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 1.5. Programmable Digital I/O and Crossbar The standard 8051 8-bit Ports (0, 1, 2, and 3) are available on the MCUs. The devices in the larger (100- pin TQFP) packaging have 4 additional ports (4, 5, 6, and 7) for a total of 64 general-purpose port I/O. The Port I/O behave like the standard 8051 with a few enhancements.
  • Page 33: Programmable Counter Array

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 1.6. Programmable Counter Array An on-board Programmable Counter/Timer Array (PCA) is included in addition to the five 16-bit general purpose counter/timers. The PCA consists of a dedicated 16-bit counter/timer time base with 6 program- mable capture/compare modules. The timebase is clocked from one of six sources: the system clock divided by 12, the system clock divided by 4, Timer 0 overflow, an External Clock Input (ECI pin), the sys- tem clock, or the external oscillator source divided by 8.
  • Page 34: Or 10-Bit Analog To Digital Converter

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 1.8. 12 or 10-Bit Analog to Digital Converter All devices include either a 12 or 10-bit SAR ADC (ADC0) with a 9-channel input multiplexer and program- mable gain amplifier. With a maximum throughput of 100 ksps, the 12 and 10-bit ADCs offer true 12-bit lin- earity with an INL of ±1LSB.
  • Page 35: 8-Bit Analog To Digital Converter

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 1.9. 8-Bit Analog to Digital Converter The C8051F12x devices have an on-board 8-bit SAR ADC (ADC2) with an 8-channel input multiplexer and programmable gain amplifier. This ADC features a 500 ksps maximum throughput and true 8-bit linearity with an INL of ±1LSB. Eight input pins are available for measurement. The ADC is under full control of the CIP-51 microcontroller via the Special Function Registers.
  • Page 36: 12-Bit Digital To Analog Converters

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 1.10. 12-bit Digital to Analog Converters The C8051F12x devices have two integrated 12-bit Digital to Analog Converters (DACs). The MCU data and control interface to each DAC is via the Special Function Registers. The MCU can place either or both of the DACs in a low power shutdown mode.
  • Page 37: Analog Comparators

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 1.11. Analog Comparators Two analog comparators with dedicated input pins are included on-chip. The comparators have software programmable hysteresis and response time. Each comparator can generate an interrupt on a rising edge, falling edge, or both. The interrupts are capable of waking up the MCU from sleep mode, and Comparator 0 can be used as a reset source.
  • Page 38: Absolute Maximum Ratings

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Absolute Maximum Ratings Table 2.1. Absolute Maximum Ratings Parameter Conditions Units Ambient temperature under bias –55 — °C Storage Temperature –65 — °C Voltage on any Pin (except V and Port I/O) with –0.3 — Respect to DGND Voltage on any Port I/O Pin or RST with Respect to –0.3 —...
  • Page 39: Global Dc Electrical Characteristics

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Global DC Electrical Characteristics Table 3.1. Global DC Electrical Characteristics (C8051F120/1/2/3 and C8051F130/1/2/3) –40 to +85 °C, 100 MHz System Clock unless otherwise specified. Parameter Conditions Units SYSCLK = 0 to 50 MHz Analog Supply Voltage SYSCLK > 50 MHz Analog Supply Current Internal REF, ADCs, DACs, Com- —...
  • Page 40: Table 3.2. Global Dc Electrical Characteristics (C8051F124/5/6/7)

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Table 3.2. Global DC Electrical Characteristics (C8051F124/5/6/7) –40 to +85 °C, 50 MHz System Clock unless otherwise specified. Parameter Conditions Units Analog Supply Voltage Analog Supply Current Internal REF, ADC, DAC, Com- — — parators all active Analog Supply Current with Internal REF, ADC, DAC, Com- —...
  • Page 41: Pinout And Package Definitions

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Pinout and Package Definitions Table 4.1. Pin Definitions Pin Numbers ‘F120 ‘F121 ‘F130 ‘F131 Name Type Description ‘F122 ‘F123 ‘F132 ‘F133 ‘F124 ‘F125 ‘F126 ‘F127 Digital Supply Voltage. Must be tied to +2.7 to 64, 90 41, 57 64, 90 41, 57 +3.6 V.
  • Page 42 C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Table 4.1. Pin Definitions (Continued) Pin Numbers ‘F120 ‘F121 ‘F130 ‘F131 Name Type Description ‘F122 ‘F123 ‘F132 ‘F133 ‘F124 ‘F125 ‘F126 ‘F127 VREF A I/O Bandgap Voltage Reference Output (all devices). DAC Voltage Reference Input (C8051F121/3/5/7 only). VREFA A In ADC0 and ADC2 Voltage Reference Input.
  • Page 43 C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Table 4.1. Pin Definitions (Continued) Pin Numbers ‘F120 ‘F121 ‘F130 ‘F131 Name Type Description ‘F122 ‘F123 ‘F132 ‘F133 ‘F124 ‘F125 ‘F126 ‘F127 DAC1 A Out Digital to Analog Converter 1 Voltage Output. (See DAC Specification for complete descrip- tion).
  • Page 44 C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Table 4.1. Pin Definitions (Continued) Pin Numbers ‘F120 ‘F121 ‘F130 ‘F131 Name Type Description ‘F122 ‘F123 ‘F132 ‘F133 ‘F124 ‘F125 ‘F126 ‘F127 AIN2.2/A10/P1.2 A In Port 1.2. See Port Input/Output section for com- D I/O plete description. AIN2.3/A11/P1.3 A In Port 1.3.
  • Page 45 C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Table 4.1. Pin Definitions (Continued) Pin Numbers ‘F120 ‘F121 ‘F130 ‘F131 Name Type Description ‘F122 ‘F123 ‘F132 ‘F133 ‘F124 ‘F125 ‘F126 ‘F127 AD0/D0/P3.0 D I/O Bit 0 External Memory Address/Data bus (Multi- plexed mode) Bit 0 External Memory Data bus (Non-multi- plexed mode) Port 3.0 See Port Input/Output section for complete...
  • Page 46 C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Table 4.1. Pin Definitions (Continued) Pin Numbers ‘F120 ‘F121 ‘F130 ‘F131 Name Type Description ‘F122 ‘F123 ‘F132 ‘F133 ‘F124 ‘F125 ‘F126 ‘F127 ALE/P4.5 D I/O ALE Strobe for External Memory Address bus (multiplexed mode) Port 4.5 See Port Input/Output section for complete description.
  • Page 47 C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Table 4.1. Pin Definitions (Continued) Pin Numbers ‘F120 ‘F121 ‘F130 ‘F131 Name Type Description ‘F122 ‘F123 ‘F132 ‘F133 ‘F124 ‘F125 ‘F126 ‘F127 A8m/A0/P6.0 D I/O Bit 8 External Memory Address bus (Multiplexed mode) Bit 0 External Memory Address bus (Non-multi- plexed mode) Port 6.0 See Port Input/Output section for complete...
  • Page 48 C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Table 4.1. Pin Definitions (Continued) Pin Numbers ‘F120 ‘F121 ‘F130 ‘F131 Name Type Description ‘F122 ‘F123 ‘F132 ‘F133 ‘F124 ‘F125 ‘F126 ‘F127 AD5/D5/P7.5 D I/O Port 7.5. See Port Input/Output section for com- plete description. AD6/D6/P7.6 D I/O Port 7.6. See Port Input/Output section for com- plete description.
  • Page 49: Figure 4.1. C8051F120/2/4/6 Pinout Diagram (Tqfp-100)

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 A13m/A5/P6.5 A14m/A6/P6.6 A15m/A7/P6.7 AD0/D0/P7.0 /RST AD1/D1/P7.1 CP1- AD2/D2/P7.2 CP1+ AD3/D3/P7.3 CP0- AD4/D4/P7.4 CP0+ AD5/D5/P7.5 AGND AD6/D6/P7.6 C8051F120 AD7/D7/P7.7 C8051F122 VREF AGND DGND C8051F124 P0.0 VREFD P0.1 C8051F126 VREF0 P0.2 VREF2 P0.3 AIN0.0 P0.4 AIN0.1 ALE/P0.5 AIN0.2 /RD/P0.6 AIN0.3 /WR/P0.7 AIN0.4 AD0/D0/P3.0...
  • Page 50: Figure 4.2. C8051F130/2 Pinout Diagram (Tqfp-100)

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 A13m/A5/P6.5 A14m/A6/P6.6 A15m/A7/P6.7 AD0/D0/P7.0 /RST AD1/D1/P7.1 CP1- AD2/D2/P7.2 CP1+ AD3/D3/P7.3 CP0- AD4/D4/P7.4 CP0+ AD5/D5/P7.5 AGND AD6/D6/P7.6 AD7/D7/P7.7 C8051F130 VREF AGND DGND C8051F132 P0.0 P0.1 VREF0 P0.2 P0.3 AIN0.0 P0.4 AIN0.1 ALE/P0.5 AIN0.2 /RD/P0.6 AIN0.3 /WR/P0.7 AIN0.4 AD0/D0/P3.0 AIN0.5 AD1/D1/P3.1 AIN0.6 AD2/D2/P3.2...
  • Page 51: Figure 4.3. Tqfp-100 Package Drawing

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 (mm) (mm) (mm) 1.20 0.05 0.15 0.95 1.00 1.05 0.17 0.22 0.27 16.00 14.00 0.50 16.00 14.00 0.45 0.60 0.75 PIN 1 DESIGNATOR Figure 4.3. TQFP-100 Package Drawing Rev. 1.4...
  • Page 52: Figure 4.4. C8051F121/3/5/7 Pinout Diagram (Tqfp-64)

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 CP1- /WR/P0.7 CP1+ AD0/D0/P3.0 CP0- AD1/D1/P3.1 CP0+ AD2/D2/P3.2 AGND AD3/D3/P3.3 AD4/D4/P3.4 C8051F121 VREF AD5/D5/P3.5 C8051F123 VREFA C8051F125 AIN0.0 DGND AIN0.1 AD6/D6/P3.6 C8051F127 AIN0.2 AD7/D7/P3.7 AIN0.3 A8m/A0/P2.0 AIN0.4 A9m/A1/P2.1 AIN0.5 A10m/A2/P2.2 AIN0.6 A11m/A3/P2.3 AIN0.7 A12m/A4/P2.4 Figure 4.4. C8051F121/3/5/7 Pinout Diagram (TQFP-64) Rev.
  • Page 53: Figure 4.5. C8051F131/3 Pinout Diagram (Tqfp-64)

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 CP1- /WR/P0.7 CP1+ AD0/D0/P3.0 CP0- AD1/D1/P3.1 CP0+ AD2/D2/P3.2 AGND AD3/D3/P3.3 AD4/D4/P3.4 VREF AD5/D5/P3.5 C8051F131 VREF0 C8051F133 AIN0.0 DGND AIN0.1 AD6/D6/P3.6 AIN0.2 AD7/D7/P3.7 AIN0.3 A8m/A0/P2.0 AIN0.4 A9m/A1/P2.1 AIN0.5 A10m/A2/P2.2 AIN0.6 A11m/A3/P2.3 AIN0.7 A12m/A4/P2.4 Figure 4.5. C8051F131/3 Pinout Diagram (TQFP-64) Rev.
  • Page 54: Figure 4.6. Tqfp-64 Package Drawing

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 (mm) (mm) (mm) 1.20 0.05 0.15 0.95 1.00 1.05 0.17 0.22 0.27 12.00 10.00 0.50 PIN 1 DESIGNATOR 12.00 10.00 0.45 0.60 0.75 Figure 4.6. TQFP-64 Package Drawing Rev. 1.4...
  • Page 55: Adc0 (12-Bit Adc, C8051F120/1/4/5 Only)

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 ADC0 (12-Bit ADC, C8051F120/1/4/5 Only) The ADC0 subsystem for the C8051F120/1/4/5 consists of a 9-channel, configurable analog multiplexer (AMUX0), a programmable gain amplifier (PGA0), and a 100 ksps, 12-bit successive-approximation-regis- ter ADC with integrated track-and-hold and Programmable Window Detector (see block diagram in Figure 5.1).
  • Page 56: Figure 5.2. Typical Temperature Sensor Transfer Function

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 The Temperature Sensor transfer function is shown in Figure 5.2. The output voltage (V ) is the PGA TEMP input when the Temperature Sensor is selected by bits AMX0AD3-0 in register AMX0SL; this voltage will be amplified by the PGA according to the user-programmed PGA settings. Typical values for the Slope and Offset parameters can be found in Table 5.1.
  • Page 57: Adc Modes Of Operation

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 5.2. ADC Modes of Operation ADC0 has a maximum conversion speed of 100 ksps. The ADC0 conversion clock is derived from the sys- tem clock divided by the value held in the ADCSC bits of register ADC0CF. 5.2.1. Starting a Conversion A conversion can be initiated in one of four ways, depending on the programmed states of the ADC0 Start of Conversion Mode bits (AD0CM1, AD0CM0) in ADC0CN.
  • Page 58: Tracking Modes

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 5.2.2. Tracking Modes The AD0TM bit in register ADC0CN controls the ADC0 track-and-hold mode. In its default state, the ADC0 input is continuously tracked when a conversion is not in progress. When the AD0TM bit is logic 1, ADC0 operates in low-power track-and-hold mode.
  • Page 59: Settling Time Requirements

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 5.2.3. Settling Time Requirements A minimum tracking time is required before an accurate conversion can be performed. This tracking time is determined by the ADC0 MUX resistance, the ADC0 sampling capacitance, any external source resis- tance, and the accuracy required for the conversion. Figure 5.4 shows the equivalent ADC0 input circuits for both Differential and Single-ended modes.
  • Page 60: Sfr Definition 5.1. Amx0Cf: Amux0 Configuration

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 5.1. AMX0CF: AMUX0 Configuration SFR Page: 0xBA SFR Address: Reset Value AIN67IC AIN45IC AIN23IC AIN01IC 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 Bits7–4: UNUSED. Read = 0000b; Write = don’t care. Bit3: AIN67IC: AIN0.6, AIN0.7 Input Pair Configuration Bit. 0: AIN0.6 and AIN0.7 are independent single-ended inputs.
  • Page 61: Sfr Definition 5.2. Amx0Sl: Amux0 Channel Select

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 5.2. AMX0SL: AMUX0 Channel Select SFR Page: 0xBB SFR Address: Reset Value AMX0AD3 AMX0AD2 AMX0AD1 AMX0AD0 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 Bits7–4: UNUSED. Read = 0000b; Write = don’t care. Bits3–0: AMX0AD3–0: AMX0 Address Bits. 0000-1111b: ADC Inputs selected per chart below.
  • Page 62: Sfr Definition 5.3. Adc0Cf: Adc0 Configuration

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 5.3. ADC0CF: ADC0 Configuration SFR Page: 0xBC SFR Address: Reset Value AD0SC4 AD0SC3 AD0SC2 AD0SC1 AD0SC0 AMP0GN2 AMP0GN1 AMP0GN0 11111000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 Bits7–3: AD0SC4–0: ADC0 SAR Conversion Clock Period Bits. The SAR Conversion clock is derived from system clock by the following equation, where AD0SC refers to the 5-bit value held in AD0SC4-0, and CLK refers to the desired ADC0...
  • Page 63: Sfr Definition 5.4. Adc0Cn: Adc0 Control

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 5.4. ADC0CN: ADC0 Control SFR Page: 0xE8 (bit addressable) SFR Address: Reset Value AD0EN AD0TM AD0INT AD0BUSY AD0CM1 AD0CM0 AD0WINT AD0LJST 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 Bit7: AD0EN: ADC0 Enable Bit. 0: ADC0 Disabled. ADC0 is in low-power shutdown. 1: ADC0 Enabled.
  • Page 64: Sfr Definition 5.5. Adc0H: Adc0 Data Word Msb

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 5.5. ADC0H: ADC0 Data Word MSB SFR Page: 0xBF SFR Address: Reset Value 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 Bits7–0: ADC0 Data Word High-Order Bits. For AD0LJST = 0: Bits 7–4 are the sign extension of Bit3. Bits 3–0 are the upper 4 bits of the 12-bit ADC0 Data Word.
  • Page 65: Figure 5.5. Adc0 Data Word Example

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 12-bit ADC0 Data Word appears in the ADC0 Data Word Registers as follows: ADC0H[3:0]:ADC0L[7:0], if AD0LJST = 0 (ADC0H[7:4] will be sign-extension of ADC0H.3 for a differential reading, otherwise 0000b). ADC0H[7:0]:ADC0L[7:4], if AD0LJST = 1 (ADC0L[3:0] = 0000b). Example: ADC0 Data Word Conversion Map, AIN0.0 Input in Single-Ended Mode (AMX0CF = 0x00, AMX0SL = 0x00) AIN0.0–AGND...
  • Page 66: Adc0 Programmable Window Detector

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 5.3. ADC0 Programmable Window Detector The ADC0 Programmable Window Detector continuously compares the ADC0 output to user-programmed limits, and notifies the system when an out-of-bound condition is detected. This is especially effective in an interrupt-driven system, saving code space and CPU bandwidth while delivering faster system response times.
  • Page 67: Sfr Definition 5.9. Adc0Lth: Adc0 Less-Than Data High Byte

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 5.9. ADC0LTH: ADC0 Less-Than Data High Byte SFR Page: 0xC7 SFR Address: Reset Value 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 Bits7–0: High byte of ADC0 Less-Than Data Word. SFR Definition 5.10. ADC0LTL: ADC0 Less-Than Data Low Byte SFR Page: 0xC6 SFR Address:...
  • Page 68: Figure 5.6. 12-Bit Adc0 Window Interrupt Example: Right Justified Single-Ended Data

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Input Voltage Input Voltage ADC Data ADC Data (AD0.0 - AGND) (AD0.0 - AGND) Word Word REF x (4095/4096) 0x0FFF REF x (4095/4096) 0x0FFF AD0WINT AD0WINT=1 not affected 0x0201 0x0201 REF x (512/4096) 0x0200 ADC0LTH:ADC0LTL REF x (512/4096) 0x0200 ADC0GTH:ADC0GTL 0x01FF...
  • Page 69: Figure 5.7. 12-Bit Adc0 Window Interrupt Example: Right Justified Differential Data

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Input Voltage ADC Data Input Voltage ADC Data (AD0.0 - AD0.1) (AD0.0 - AD0.1) Word Word REF x (2047/2048) 0x07FF REF x (2047/2048) 0x07FF AD0WINT AD0WINT=1 not affected 0x0101 0x0101 REF x (256/2048) 0x0100 ADC0LTH:ADC0LTL REF x (256/2048) 0x0100 ADC0GTH:ADC0GTL 0x00FF...
  • Page 70: Figure 5.8. 12-Bit Adc0 Window Interrupt Example: Left Justified Single-Ended Data

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Input Voltage ADC Data Input Voltage ADC Data (AD0.0 - AGND) (AD0.0 - AGND) Word Word REF x (4095/4096) 0xFFF0 REF x (4095/4096) 0xFFF0 AD0WINT AD0WINT=1 not affected 0x2010 0x2010 REF x (512/4096) 0x2000 ADC0LTH:ADC0LTL REF x (512/4096) 0x2000 ADC0GTH:ADC0GTL 0x1FF0...
  • Page 71: Figure 5.9. 12-Bit Adc0 Window Interrupt Example: Left Justified Differential Data

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Input Voltage ADC Data Input Voltage ADC Data (AD0.0 - AD0.1) (AD0.0 - AD0.1) Word Word REF x (2047/2048) 0x7FF0 REF x (2047/2048) 0x7FF0 AD0WINT AD0WINT=1 not affected 0x1010 0x1010 REF x (256/2048) 0x1000 ADC0LTH:ADC0LTL REF x (256/2048) 0x1000 ADC0GTH:ADC0GTL 0x0FF0...
  • Page 72: Table 5.1. 12-Bit Adc0 Electrical Characteristics (C8051F120/1/4/5)

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Table 5.1. 12-Bit ADC0 Electrical Characteristics (C8051F120/1/4/5) = 3.0 V, AV+ = 3.0 V, VREF = 2.40 V (REFBE = 0), PGA Gain = 1, –40 to +85 °C unless otherwise specified. Parameter Conditions Units DC Accuracy Resolution bits Integral Nonlinearity —...
  • Page 73: Adc0 (10-Bit Adc, C8051F122/3/6/7 And C8051F13X Only)

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 ADC0 (10-Bit ADC, C8051F122/3/6/7 and C8051F13x Only) The ADC0 subsystem for the C8051F122/3/6/7 and C8051F13x consists of a 9-channel, configurable ana- log multiplexer (AMUX0), a programmable gain amplifier (PGA0), and a 100 ksps, 10-bit successive- approximation-register ADC with integrated track-and-hold and Programmable Window Detector (see block diagram in Figure 6.1).
  • Page 74: Figure 6.2. Typical Temperature Sensor Transfer Function

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 The Temperature Sensor transfer function is shown in Figure 6.2. The output voltage (V ) is the PGA TEMP input when the Temperature Sensor is selected by bits AMX0AD3-0 in register AMX0SL; this voltage will be amplified by the PGA according to the user-programmed PGA settings. Typical values for the Slope and Offset parameters can be found in Table 6.1.
  • Page 75: Adc Modes Of Operation

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 6.2. ADC Modes of Operation ADC0 has a maximum conversion speed of 100 ksps. The ADC0 conversion clock is derived from the sys- tem clock divided by the value held in the ADCSC bits of register ADC0CF. 6.2.1. Starting a Conversion A conversion can be initiated in one of four ways, depending on the programmed states of the ADC0 Start of Conversion Mode bits (AD0CM1, AD0CM0) in ADC0CN.
  • Page 76: Tracking Modes

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 6.2.2. Tracking Modes The AD0TM bit in register ADC0CN controls the ADC0 track-and-hold mode. In its default state, the ADC0 input is continuously tracked when a conversion is not in progress. When the AD0TM bit is logic 1, ADC0 operates in low-power track-and-hold mode.
  • Page 77: Settling Time Requirements

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 6.2.3. Settling Time Requirements A minimum tracking time is required before an accurate conversion can be performed. This tracking time is determined by the ADC0 MUX resistance, the ADC0 sampling capacitance, any external source resis- tance, and the accuracy required for the conversion. Figure 6.4 shows the equivalent ADC0 input circuits for both Differential and Single-ended modes.
  • Page 78: Sfr Definition 6.1. Amx0Cf: Amux0 Configuration

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 6.1. AMX0CF: AMUX0 Configuration SFR Page: 0xBA SFR Address: Reset Value AIN67IC AIN45IC AIN23IC AIN01IC 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 Bits7–4: UNUSED. Read = 0000b; Write = don’t care. Bit3: AIN67IC: AIN0.6, AIN0.7 Input Pair Configuration Bit. 0: AIN0.6 and AIN0.7 are independent single-ended inputs.
  • Page 79: Sfr Definition 6.2. Amx0Sl: Amux0 Channel Select

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 6.2. AMX0SL: AMUX0 Channel Select SFR Page: 0xBB SFR Address: Reset Value AMX0AD3 AMX0AD2 AMX0AD1 AMX0AD0 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 Bits7–4: UNUSED. Read = 0000b; Write = don’t care. Bits3–0: AMX0AD3–0: AMX0 Address Bits. 0000-1111b: ADC Inputs selected per chart below.
  • Page 80: Sfr Definition 6.3. Adc0Cf: Adc0 Configuration

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 6.3. ADC0CF: ADC0 Configuration SFR Page: 0xBC SFR Address: Reset Value AD0SC4 AD0SC3 AD0SC2 AD0SC1 AD0SC0 AMP0GN2 AMP0GN1 AMP0GN0 11111000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 Bits7–3: AD0SC4–0: ADC0 SAR Conversion Clock Period Bits. SAR Conversion clock is derived from system clock by the following equation, where AD0SC refers to the 5-bit value held in AD0SC4-0, and CLK refers to the desired ADC0...
  • Page 81: Sfr Definition 6.4. Adc0Cn: Adc0 Control

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 6.4. ADC0CN: ADC0 Control SFR Page: 0xE8 (bit addressable) SFR Address: Reset Value AD0EN AD0TM AD0INT AD0BUSY AD0CM1 AD0CM0 AD0WINT AD0LJST 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 Bit7: AD0EN: ADC0 Enable Bit. 0: ADC0 Disabled. ADC0 is in low-power shutdown. 1: ADC0 Enabled.
  • Page 82: Sfr Definition 6.5. Adc0H: Adc0 Data Word Msb

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 6.5. ADC0H: ADC0 Data Word MSB SFR Page: 0xBF SFR Address: Reset Value 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 Bits7–0: ADC0 Data Word High-Order Bits. For AD0LJST = 0: Bits 7–4 are the sign extension of Bit3. Bits 3–0 are the upper 4 bits of the 10-bit ADC0 Data Word.
  • Page 83: Figure 6.5. Adc0 Data Word Example

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 10-bit ADC0 Data Word appears in the ADC0 Data Word Registers as follows: ADC0H[1:0]:ADC0L[7:0], if AD0LJST = 0 (ADC0H[7:2] will be sign-extension of ADC0H.1 for a differential reading, otherwise 000000b). ADC0H[7:0]:ADC0L[7:6], if AD0LJST = 1 (ADC0L[5:0] = 00b). Example: ADC0 Data Word Conversion Map, AIN0.0 Input in Single-Ended Mode (AMX0CF = 0x00, AMX0SL = 0x00) AIN0.0–AGND...
  • Page 84: Adc0 Programmable Window Detector

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 6.3. ADC0 Programmable Window Detector The ADC0 Programmable Window Detector continuously compares the ADC0 output to user-programmed limits, and notifies the system when an out-of-bound condition is detected. This is especially effective in an interrupt-driven system, saving code space and CPU bandwidth while delivering faster system response times.
  • Page 85: Sfr Definition 6.9. Adc0Lth: Adc0 Less-Than Data High Byte

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 6.9. ADC0LTH: ADC0 Less-Than Data High Byte SFR Page: 0xC7 SFR Address: Reset Value 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 Bits7–0: High byte of ADC0 Less-Than Data Word. SFR Definition 6.10. ADC0LTL: ADC0 Less-Than Data Low Byte SFR Page: 0xC6 SFR Address:...
  • Page 86: Figure 6.6. 10-Bit Adc0 Window Interrupt Example: Right Justified Single-Ended Data

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Input Voltage Input Voltage ADC Data ADC Data (AD0.0 - AGND) (AD0.0 - AGND) Word Word REF x (1023/1024) 0x03FF REF x (1023/1024) 0x03FF ADWINT ADWINT=1 not affected 0x0201 0x0201 REF x (512/1024) 0x0200 ADC0LTH:ADC0LTL REF x (512/1024) 0x0200 ADC0GTH:ADC0GTL 0x01FF...
  • Page 87: Figure 6.7. 10-Bit Adc0 Window Interrupt Example: Right Justified Differential Data

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Input Voltage ADC Data Input Voltage ADC Data (AD0.0 - AD0.1) (AD0.0 - AD0.1) Word Word REF x (511/512) 0x01FF REF x (511/512) 0x01FF ADWINT ADWINT=1 not affected 0x0101 0x0101 REF x (256/512) 0x0100 ADC0LTH:ADC0LTL REF x (256/512) 0x0100 ADC0GTH:ADC0GTL 0x00FF...
  • Page 88: Figure 6.8. 10-Bit Adc0 Window Interrupt Example: Left Justified Single-Ended Data

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Input Voltage Input Voltage ADC Data ADC Data (AD0.0 - AGND) (AD0.0 - AGND) Word Word REF x (1023/1024) 0xFFC0 REF x (1023/1024) 0xFFC0 ADWINT ADWINT=1 not affected 0x8040 0x8040 REF x (512/1024) 0x8000 ADC0LTH:ADC0LTL REF x (512/1024) 0x8000 ADC0GTH:ADC0GTL 0x7FC0...
  • Page 89: Figure 6.9. 10-Bit Adc0 Window Interrupt Example: Left Justified Differential Data

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Input Voltage ADC Data Input Voltage ADC Data (AD0.0 - AD0.1) (AD0.0 - AD0.1) Word Word REF x (511/512) 0x7FC0 REF x (511/512) 0x7FC0 ADWINT ADWINT=1 not affected 0x2040 0x2040 REF x (128/512) 0x2000 ADC0LTH:ADC0LTL REF x (128/512) 0x2000 ADC0GTH:ADC0GTL 0x1FC0...
  • Page 90: Table 6.1. 10-Bit Adc0 Electrical Characteristics (C8051F122/3/6/7 And C8051F13X)

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Table 6.1. 10-Bit ADC0 Electrical Characteristics (C8051F122/3/6/7 and C8051F13x) = 3.0 V, AV+ = 3.0 V, VREF = 2.40 V (REFBE = 0), PGA Gain = 1, –40 to +85 °C unless otherwise specified. Parameter Conditions Units DC Accuracy Resolution bits Integral Nonlinearity...
  • Page 91: Adc2 (8-Bit Adc, C8051F12X Only)

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 ADC2 (8-Bit ADC, C8051F12x Only) The C8051F12x devices include a second ADC peripheral (ADC2), which consists of an 8-channel, config- urable analog multiplexer, a programmable gain amplifier, and a 500 ksps, 8-bit successive-approximation- register ADC with integrated track-and-hold (see block diagram in Figure 7.1). ADC2 is fully configurable under software control via the Special Function Registers shown in Figure 7.1.
  • Page 92: Adc2 Modes Of Operation

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 7.2. ADC2 Modes of Operation ADC2 has a maximum conversion speed of 500 ksps. The ADC2 conversion clock (SAR2 clock) is a divided version of the system clock, determined by the AD2SC bits in the ADC2CF register. The maximum ADC2 conversion clock is 6 MHz.
  • Page 93: Figure 7.2. Adc2 Track And Conversion Example Timing

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 A. ADC Timing for External Trigger Source CNVSTR2 (AD2CM[2:0]=010) SAR Clocks Low Power AD2TM=1 Track Convert Low Power Mode or Convert AD2TM=0 Track or Convert Convert Track B. ADC Timing for Internal Trigger Source Write '1' to AD2BUSY, Timer 3 Overflow, Timer 2 Overflow, Write '1' to AD0BUSY...
  • Page 94: Settling Time Requirements

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 7.2.3. Settling Time Requirements A minimum tracking time is required before an accurate conversion can be performed. This tracking time is determined by the ADC2 MUX resistance, the ADC2 sampling capacitance, any external source resis- tance, and the accuracy required for the conversion. Figure 7.3 shows the equivalent ADC2 input circuit. The required ADC2 settling time for a given settling accuracy (SA) may be approximated by Equation 7.1.
  • Page 95: Sfr Definition 7.1. Amx2Cf: Amux2 Configuration

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 7.1. AMX2CF: AMUX2 Configuration SFR Page: 0xBA SFR Address: Reset Value PIN67IC PIN45IC PIN23IC PIN01IC 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 Bits7–4: UNUSED. Read = 0000b; Write = don’t care. Bit3: PIN67IC: AIN2.6, AIN2.7 Input Pair Configuration Bit. 0: AIN2.6 and AIN2.7 are independent single-ended inputs.
  • Page 96: Sfr Definition 7.2. Amx2Sl: Amux2 Channel Select

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 7.2. AMX2SL: AMUX2 Channel Select SFR Page: 0xBB SFR Address: Reset Value AMX2AD2 AMX2AD1 AMX2AD0 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 Bits7–3: UNUSED. Read = 00000b; Write = don’t care. Bits2–0: AMX2AD2–0: AMX2 Address Bits. 000-111b: ADC Inputs selected per chart below.
  • Page 97: Sfr Definition 7.3. Adc2Cf: Adc2 Configuration

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 7.3. ADC2CF: ADC2 Configuration SFR Page: 0xBC SFR Address: Reset Value AD2SC4 AD2SC3 AD2SC2 AD2SC1 AD2SC0 AMP2GN1 AMP2GN0 11111000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 Bits7–3: AD2SC4–0: ADC2 SAR Conversion Clock Period Bits. SAR Conversion clock is derived from system clock by the following equation, where AD2SC refers to the 5-bit value held in AD2SC4–0, and CLK refers to the desired SAR2...
  • Page 98: Sfr Definition 7.4. Adc2Cn: Adc2 Control

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 7.4. ADC2CN: ADC2 Control SFR Page: 0xE8 (bit addressable) SFR Address: Reset Value AD2EN AD2TM AD2INT AD2BUSY AD2CM2 AD2CM1 AD2CM0 AD2WINT 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 Bit7: AD2EN: ADC2 Enable Bit. 0: ADC2 Disabled. ADC2 is in low-power shutdown. 1: ADC2 Enabled.
  • Page 99: Figure 7.4. Adc2 Data Word Example

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 7.5. ADC2: ADC2 Data Word SFR Page: 0xBE SFR Address: Reset Value 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 Bits7–0: ADC2 Data Word. Single-Ended Example: 8-bit ADC Data Word appears in the ADC2 Data Word Register as follows: Example: ADC2 Data Word Conversion Map, Single-Ended AIN2.0 Input (AMX2CF = 0x00;...
  • Page 100: Adc2 Programmable Window Detector

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 7.3. ADC2 Programmable Window Detector The ADC2 Programmable Window Detector continuously compares the ADC2 output to user-programmed limits, and notifies the system when a desired condition is detected. This is especially effective in an inter- rupt-driven system, saving code space and CPU bandwidth while delivering faster system response times. The window detector interrupt flag (AD2WINT in register ADC2CN) can also be used in polled mode.
  • Page 101: Window Detector In Differential Mode

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 7.3.2. Window Detector In Differential Mode Figure 7.6 shows two example window comparisons for differential mode, with ADC2LT = 0x10 (+16d) and ADC2GT = 0xFF (-1d). Notice that in Differential mode, the codes vary from -VREF to VREF*(127/128) and are represented as 8-bit 2’s complement signed integers.
  • Page 102: Sfr Definition 7.6. Adc2Gt: Adc2 Greater-Than Data Byte

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 7.6. ADC2GT: ADC2 Greater-Than Data Byte SFR Page: 0xC4 SFR Address: Reset Value 11111111 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 Bits7–0: ADC2 Greater-Than Data Word. SFR Definition 7.7. ADC2LT: ADC2 Less-Than Data Byte SFR Page: 0xC6 SFR Address: Reset Value...
  • Page 103: Table 7.1. Adc2 Electrical Characteristics

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Table 7.1. ADC2 Electrical Characteristics = 3.0 V, AV+ = 3.0 V, VREF2 = 2.40 V (REFBE = 0), PGA gain = 1, –40 to +85 °C unless otherwise specified. Parameter Conditions Units DC Accuracy Resolution bits Integral Nonlinearity —...
  • Page 104 C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 OTES Rev. 1.4...
  • Page 105: Dacs, 12-Bit Voltage Mode (C8051F12X Only)

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 DACs, 12-Bit Voltage Mode (C8051F12x Only) The C8051F12x devices include two on-chip 12-bit voltage-mode Digital-to-Analog Converters (DACs). Each DAC has an output swing of 0 V to (VREF-1LSB) for a corresponding input code range of 0x000 to 0xFFF. The DACs may be enabled/disabled via their corresponding control registers, DAC0CN and DAC1CN.
  • Page 106: Update Output On-Demand

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 8.1.1. Update Output On-Demand In its default mode (DAC0CN.[4:3] = ‘00’) the DAC0 output is updated “on-demand” on a write to the high- byte of the DAC0 data register (DAC0H). It is important to note that writes to DAC0L are held, and have no effect on the DAC0 output until a write to DAC0H takes place.
  • Page 107: Sfr Definition 8.1. Dac0H: Dac0 High Byte

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 8.1. DAC0H: DAC0 High Byte Reset Value 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 SFR Address: 0xD3 SFR Page: Bits7–0: DAC0 Data Word Most Significant Byte. SFR Definition 8.2. DAC0L: DAC0 Low Byte Reset Value 00000000 Bit7 Bit6...
  • Page 108: Sfr Definition 8.3. Dac0Cn: Dac0 Control

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 8.3. DAC0CN: DAC0 Control Reset Value DAC0EN DAC0MD1 DAC0MD0 DAC0DF2 DAC0DF1 DAC0DF0 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 SFR Address: 0xD4 SFR Page: Bit7: DAC0EN: DAC0 Enable Bit. 0: DAC0 Disabled. DAC0 Output pin is disabled; DAC0 is in low-power shutdown mode. 1: DAC0 Enabled.
  • Page 109: Sfr Definition 8.4. Dac1H: Dac1 High Byte

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 8.4. DAC1H: DAC1 High Byte Reset Value 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 SFR Address: 0xD3 SFR Page: Bits7–0: DAC1 Data Word Most Significant Byte. SFR Definition 8.5. DAC1L: DAC1 Low Byte Reset Value 00000000 Bit7 Bit6...
  • Page 110: Sfr Definition 8.6. Dac1Cn: Dac1 Control

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 8.6. DAC1CN: DAC1 Control Reset Value DAC1EN DAC1MD1 DAC1MD0 DAC1DF2 DAC1DF1 DAC1DF0 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 SFR Address: 0xD4 SFR Page: Bit7: DAC1EN: DAC1 Enable Bit. 0: DAC1 Disabled. DAC1 Output pin is disabled; DAC1 is in low-power shutdown mode. 1: DAC1 Enabled.
  • Page 111: Table 8.1. Dac Electrical Characteristics

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Table 8.1. DAC Electrical Characteristics = 3.0 V, AV+ = 3.0 V, VREF = 2.40 V (REFBE = 0), No Output Load unless otherwise specified Parameter Conditions Units Static Performance Resolution bits Integral Nonlinearity — ±1.5 — Differential Nonlinearity —...
  • Page 112 C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 OTES Rev. 1.4...
  • Page 113: Voltage Reference

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Voltage Reference The voltage reference options available on the C8051F12x and C8051F13x device families vary according to the device capabilities. All devices include an internal voltage reference circuit, consisting of a 1.2 V, 15 ppm/°C (typical) bandgap voltage reference generator and a gain-of-two output buffer amplifier. The internal reference may be routed via the VREF pin to external system components or to the voltage reference input pins.
  • Page 114: Figure 9.1. Voltage Reference Functional Block Diagram (C8051F120/2/4/6)

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 REF0CN ADC2 VREF2 External Voltage Reference Circuit ADC0 DGND VREF0 DAC0 VREFD DAC1 BIASE Bias to ADCs, VREF DACs 1.2V Band-Gap 4.7μF 0.1μF REFBE Recommended Bypass Capacitors Figure 9.1. Voltage Reference Functional Block Diagram (C8051F120/2/4/6) SFR Definition 9.1. REF0CN: Reference Control (C8051F120/2/4/6) SFR Page: 0xD1 SFR Address:...
  • Page 115: Reference Configuration On The C8051F121/3/5/7

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 9.2. Reference Configuration on the C8051F121/3/5/7 On the C8051F121/3/5/7 devices, the REF0CN register also allows selection of the voltage reference source for ADC0 and ADC2, as shown in SFR Definition 9.2. Bits AD0VRS and AD2VRS in the REF0CN register select the ADC0 and ADC2 voltage reference sources, respectively.
  • Page 116: Sfr Definition 9.2. Ref0Cn: Reference Control (C8051F121/3/5/7)

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 9.2. REF0CN: Reference Control (C8051F121/3/5/7) SFR Page: 0xD1 SFR Address: Reset Value AD0VRS AD2VRS TEMPE BIASE REFBE 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 Bits7–5: UNUSED. Read = 000b; Write = don’t care. Bit4: AD0VRS: ADC0 Voltage Reference Select.
  • Page 117: Reference Configuration On The C8051F130/1/2/3

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 9.3. Reference Configuration on the C8051F130/1/2/3 On the C8051F130/1/2/3 devices, the VREF0 pin provides a voltage reference input for ADC0, which can be connected to an external precision reference or the internal voltage reference, as shown in Figure 9.3. The REF0CN register for the C8051F130/1/2/3 is described in SFR Definition 9.3.
  • Page 118: Table 9.1. Voltage Reference Electrical Characteristics

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Table 9.1. Voltage Reference Electrical Characteristics = 3.0 V, AV+ = 3.0 V, –40 to +85 °C unless otherwise specified. Parameter Conditions Units Analog Bias Generator Power — — µA BIASE = 1 Supply Current Internal Reference (REFBE = 1) Output Voltage 25 °C ambient 2.36...
  • Page 119: Comparators

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 10. Comparators Two on-chip programmable voltage comparators are included, as shown in Figure 10.1. The inputs of each comparator are available at dedicated pins. The output of each comparator is optionally available at the package pins via the I/O crossbar. When assigned to package pins, each comparator output can be pro- grammed to operate in open drain or push-pull modes.
  • Page 120 C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Comparator interrupts can be generated on rising-edge and/or falling-edge output transitions. (For inter- rupt enable and priority control, see Section “11.3. Interrupt Handler” on page 154 ). The CP0FIF flag is set upon a Comparator0 falling-edge interrupt, and the CP0RIF flag is set upon the Comparator0 rising- edge interrupt.
  • Page 121: Figure 10.2. Comparator Hysteresis Plot

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 CP0+ VIN+ CP0- VIN- CIRCUIT CONFIGURATION Positive Hysteresis Voltage (Programmed with CP0HYP Bits) VIN- INPUTS Negative Hysteresis Voltage (Programmed by CP0HYN Bits) VIN+ OUTPUT Negative Hysteresis Maximum Disabled Negative Hysteresis Positive Hysteresis Maximum Disabled Positive Hysteresis Figure 10.2. Comparator Hysteresis Plot Rev.
  • Page 122: Sfr Definition 10.1. Cpt0Cn: Comparator0 Control

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 10.1. CPT0CN: Comparator0 Control SFR Page: 0x88 SFR Address: Reset Value CP0EN CP0OUT CP0RIF CP0FIF CP0HYP1 CP0HYP0 CP0HYN1 CP0HYN0 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 Bit7: CP0EN: Comparator0 Enable Bit. 0: Comparator0 Disabled. 1: Comparator0 Enabled.
  • Page 123: Sfr Definition 10.2. Cpt0Md: Comparator0 Mode Selection

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 10.2. CPT0MD: Comparator0 Mode Selection SFR Page: 0x89 SFR Address: Reset Value CP0RIE CP0FIE CP0MD1 CP0MD0 00000010 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 Bits7–6: UNUSED. Read = 00b, Write = don’t care. Bit 5: CP0RIE: Comparator 0 Rising-Edge Interrupt Enable Bit.
  • Page 124: Sfr Definition 10.3. Cpt1Cn: Comparator1 Control

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 10.3. CPT1CN: Comparator1 Control SFR Page: 0x88 SFR Address: Reset Value CP1EN CP1OUT CP1RIF CP1FIF CP1HYP1 CP1HYP0 CP1HYN1 CP1HYN0 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 Bit7: CP1EN: Comparator1 Enable Bit. 0: Comparator1 Disabled. 1: Comparator1 Enabled.
  • Page 125: Sfr Definition 10.4. Cpt1Md: Comparator1 Mode Selection

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 10.4. CPT1MD: Comparator1 Mode Selection SFR Page: 0x89 SFR Address: Reset Value CP1RIE CP1FIE CP1MD1 CP1MD0 00000010 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 Bits7–6: UNUSED. Read = 00b, Write = don’t care. Bit 5: CP1RIE: Comparator 1 Rising-Edge Interrupt Enable Bit.
  • Page 126: Table 10.1. Comparator Electrical Characteristics

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Table 10.1. Comparator Electrical Characteristics = 3.0 V, AV+ = 3.0 V, –40 to +85 °C unless otherwise specified. Parameter Conditions Units CPn+ – CPn- = 100 mV — — Response Time: Mode 0, V = 1.5 V CPn+ –...
  • Page 127: Microcontroller

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 11. CIP-51 Microcontroller The MCU system controller core is the CIP-51 microcontroller. The CIP-51 is fully compatible with the MCS-51™ instruction set; standard 803x/805x assemblers and compilers can be used to develop soft- ware. The MCU family has a superset of all the peripherals included with a standard 8051. Included are five 16-bit counter/timers (see description in Section 23 ), two full-duplex UARTs (see description in...
  • Page 128: Figure 11.1. Cip-51 Block Diagram

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 DATA BUS ACCUMULATOR B REGISTER STACK POINTER TMP1 TMP2 SRAM SRAM ADDRESS (256 X 8) REGISTER DATA BUS SFR_ADDRESS BUFFER SFR_CONTROL SFR_WRITE_DATA DATA POINTER INTERFACE SFR_READ_DATA PC INCREMENTER MEM_ADDRESS PROGRAM COUNTER (PC) MEM_CONTROL MEMORY PRGM. ADDRESS REG. MEM_WRITE_DATA INTERFACE MEM_READ_DATA PIPELINE...
  • Page 129: Instruction Set

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 11.1. Instruction Set The instruction set of the CIP-51 System Controller is fully compatible with the standard MCS-51™ instruc- tion set; standard 8051 development 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.
  • Page 130 C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Table 11.1. CIP-51 Instruction Set Summary (Continued) Clock Mnemonic Description Bytes Cycles DEC A Decrement A DEC Rn Decrement register DEC direct Decrement direct byte DEC @Ri Decrement indirect RAM INC DPTR Increment Data Pointer MUL AB Multiply A and B DIV AB Divide A by B DA A...
  • Page 131 C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Table 11.1. CIP-51 Instruction Set Summary (Continued) Clock Mnemonic Description Bytes Cycles MOV direct, @Ri Move indirect RAM to direct byte MOV direct, #data Move immediate to direct byte MOV @Ri, A Move A to indirect RAM MOV @Ri, direct Move direct byte to indirect RAM MOV @Ri, #data Move immediate to indirect RAM...
  • Page 132 C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Table 11.1. CIP-51 Instruction Set Summary (Continued) Clock Mnemonic Description Bytes Cycles JZ rel Jump if A equals zero 2/3* JNZ rel Jump if A does not equal zero 2/3* CJNE A, direct, rel Compare direct byte to A and jump if not equal 3/4* CJNE A, #data, rel Compare immediate to A and jump if not equal...
  • Page 133: Memory Organization

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 11.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. There are 256 bytes of internal data memory and 128k bytes (C8051F12x and C8051F130/1) or 64k bytes (C8051F132/3) of internal program memory address space implemented within the CIP-51.
  • Page 134: Figure 11.3. Address Memory Map For Instruction Fetches (128 Kb Flash Only)

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 11.1. PSBANK: Program Space Bank Select Reset Value COBANK IFBANK 00010001 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 SFR Address: 0xB1 SFR Page: All Pages – Bits 7 6: Reserved. – Bits 5 4: COBANK: Constant Operations Bank Select. These bits select which Flash bank is targeted during constant operations (MOVC and Flash MOVX) involving addresses 0x8000 to 0xFFFF.
  • Page 135: Data Memory

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 11.2.2. Data Memory The CIP-51 implements 256 bytes of internal RAM mapped into the data memory space from 0x00 through 0xFF. The lower 128 bytes of data memory are used for general purpose registers and 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 consisting of eight byte-wide registers.
  • Page 136: Special Function Registers

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 and a RET pops two record bits, also.) The stack record circuitry can also detect an overflow or underflow on the 32-bit shift register, and can notify the debug software even with the MCU running at speed. 11.2.6. Special Function Registers The direct-access data memory locations from 0x80 to 0xFF constitute the special function registers (SFR’s).
  • Page 137: Figure 11.4. Sfr Page Stack

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFRPGCN Bit Interrupt Logic SFRPAGE CIP-51 SFRNEXT SFRLAST Figure 11.4. SFR Page Stack Automatic hardware switching of the SFR Page on interrupts may be enabled or disabled as desired using the SFR Automatic Page Control Enable Bit located in the SFR Page Control Register (SFRPGCN). This function defaults to ‘enabled’...
  • Page 138: Figure 11.5. Sfr Page Stack While Using Sfr Page 0X0F To Access Port 5

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 11.2.6.3.SFR Page Stack Example The following is an example that shows the operation of the SFR Page Stack during interrupts. In this example, the SFR Page Control is left in the default enabled state (i.e., SFRPGEN = 1), and the CIP-51 is executing in-line code that is writing values to Port 5 (SFR “P5”, located at address 0xD8 on SFR Page 0x0F).
  • Page 139: Figure 11.6. Sfr Page Stack After Adc2 Window Comparator Interrupt Occurs

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Page 0x02 Automatically pushed on stack in SFRPAGE on ADC2 interrupt 0x02 SFRPAGE (ADC2) SFRPAGE pushed to 0x0F SFRNEXT SFRNEXT (Port 5) SFRLAST Figure 11.6. SFR Page Stack After ADC2 Window Comparator Interrupt Occurs While in the ADC2 ISR, a PCA interrupt occurs. Recall the PCA interrupt is configured as a high priority interrupt, while the ADC2 interrupt is configured as a low priority interrupt.
  • Page 140: Figure 11.7. Sfr Page Stack Upon Pca Interrupt Occurring During An Adc2 Isr

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Page 0x00 Automatically pushed on stack in SFRPAGE on PCA interrupt 0x00 SFRPAGE (PCA) SFRPAGE pushed to 0x02 SFRNEXT SFRNEXT (ADC2) SFRNEXT pushed to 0x0F SFRLAST SFRLAST (Port 5) Figure 11.7. SFR Page Stack Upon PCA Interrupt Occurring During an ADC2 ISR On exit from the PCA interrupt service routine, the CIP-51 will return to the ADC2 Window Comparator ISR.
  • Page 141: Figure 11.9. Sfr Page Stack Upon Return From Adc2 Window Interrupt

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 On the execution of the RETI instruction in the ADC2 Window Comparator ISR, the value in SFRPAGE register is overwritten with the contents of SFRNEXT. The CIP-51 may now access the Port 5 SFR bits as it did prior to the interrupts occurring. See Figure 11.9 below. SFR Page 0x02 Automatically popped off of the...
  • Page 142: Sfr Definition 11.2. Sfrpgcn: Sfr Page Control

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 11.2. SFRPGCN: SFR Page Control Reset Value SFRPGEN 00000001 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 SFR Address: 0x96 SFR Page: Bits7–1: Reserved. Bit0: SFRPGEN: SFR Automatic Page Control Enable. Upon interrupt, the C8051 Core will vector to the specified interrupt service routine and auto- matically switch the SFR page to the corresponding peripheral or function’s SFR page.
  • Page 143: Sfr Definition 11.4. Sfrnext: Sfr Next Register

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 11.4. SFRNEXT: SFR Next Register Reset Value 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 SFR Address: 0x85 SFR Page: All Pages Bits7–0: SFR Page Stack Bits: SFR page context is retained upon interrupts/return from interrupts in a 3 byte SFR Page Stack: SFRPAGE is the first entry, SFRNEXT is the second, and SFR- LAST is the third entry.
  • Page 144: Table 11.2. Special Function Register (Sfr) Memory Map

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Table 11.2. Special Function Register (SFR) Memory Map 0(8) 1(9) 2(A) 3(B) 4(C) 5(D) 6(E) 7(F) SPI0CN PCA0L PCA0H PCA0CPL0 PCA0CPH0 PCA0CPL1 PCA0CPH1 WDTCN (ALL PAGES) EIP1 EIP2 (ALL (ALL (ALL PAGES) PAGES) PAGES) ADC0CN PCA0CPL2 PCA0CPH2 PCA0CPL3 PCA0CPH3 PCA0CPL4 PCA0CPH4 RSTSRC ADC2CN PCA0CPL5...
  • Page 145 C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Table 11.2. Special Function Register (SFR) Memory Map (Continued) SADEN0 AMX0CF AMX0SL ADC0CF ADC0L ADC0H (ALL AMX2CF AMX2SL ADC2CF ADC2 PAGES) FLSCL PSBANK (ALL (ALL PAGES) PAGES) FLACL SADDR0 (ALL PAGES) P1MDIN EMI0TC EMI0CN EMI0CF (ALL PAGES) CCH0CN CCH0TN CCH0LC P0MDOUT...
  • Page 146: Table 11.3. Special Function Registers

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Table 11.3. Special Function Registers SFRs are listed in alphabetical order. All undefined SFR locations are reserved. Register Address Description Page No. Page 0xE0 All Pages Accumulator page 153 ADC0CF 0xBC ADC0 Configuration page 62 , page 80 ADC0CN 0xE8 ADC0 Control...
  • Page 147 C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Table 11.3. Special Function Registers (Continued) SFRs are listed in alphabetical order. All undefined SFR locations are reserved. Register Address Description Page No. Page EIE1 0xE6 All Pages Extended Interrupt Enable 1 page 159 EIE2 0xE7 All Pages Extended Interrupt Enable 2 page 160 EIP1 0xF6...
  • Page 148 C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Table 11.3. Special Function Registers (Continued) SFRs are listed in alphabetical order. All undefined SFR locations are reserved. Register Address Description Page No. Page 0xE8 Port 6 Latch page 256 P6MDOUT 0x9E Port 6 Output Mode Configuration page 256 0xF8 Port 7 Latch page 257...
  • Page 149 C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Table 11.3. Special Function Registers (Continued) SFRs are listed in alphabetical order. All undefined SFR locations are reserved. Register Address Description Page No. Page page 114 REF0CN 0xD1 Voltage Reference Control page 116 page 117 RSTSRC 0xEF Reset Source page 182 SADDR0 0xA9...
  • Page 150 C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Table 11.3. Special Function Registers (Continued) SFRs are listed in alphabetical order. All undefined SFR locations are reserved. Register Address Description Page No. Page TMR4L 0xCC Timer/Counter 4 Low Byte page 323 WDTCN 0xFF All Pages Watchdog Timer Control page 181 XBR0 0xE1...
  • Page 151: Register Descriptions

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 11.2.7. Register Descriptions Following are descriptions of SFRs related to the operation of the CIP-51 System Controller. Reserved bits should not be set to logic l. Future product versions may use these bits to implement new features in which case the reset value of the bit will be logic 0, selecting the feature's default state.
  • Page 152: Sfr Definition 11.9. Psw: Program Status Word

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 11.9. PSW: Program Status Word Reset Value PARITY 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 Addressable SFR Address: 0xD0 SFR Page: All Pages Bit7: CY: Carry Flag. This bit is set when the last arithmetic operation resulted in a carry (addition) or a borrow (subtraction).
  • Page 153: Sfr Definition 11.10. Acc: Accumulator

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 11.10. ACC: Accumulator Reset Value ACC.7 ACC.6 ACC.5 ACC.4 ACC.3 ACC.2 ACC.1 ACC.0 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 Addressable SFR Address: 0xE0 SFR Page: All Pages Bits7–0: ACC: Accumulator. This register is the accumulator for arithmetic operations. SFR Definition 11.11.
  • Page 154: Interrupt Handler

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 11.3. Interrupt Handler The CIP-51 includes an extended interrupt system supporting a total of 20 interrupt sources with two prior- ity levels. The allocation of interrupt sources between on-chip peripherals and external input pins varies according to the specific version of the device. Each interrupt source has one or more associated interrupt- pending flag(s) located in an SFR.
  • Page 155: External Interrupts

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 11.3.2. External Interrupts Two of the external interrupt sources (/INT0 and /INT1) are configurable as active-low level-sensitive or active-low edge-sensitive inputs depending on the setting of bits IT0 (TCON.0) and IT1 (TCON.2). IE0 (TCON.1) and IE1 (TCON.3) serve as the interrupt-pending flag for the /INT0 and /INT1 external interrupts, respectively.
  • Page 156: Interrupt Priorities

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Table 11.4. Interrupt Summary (Continued) Interru Priority Enable Priority Interrupt Source Pending Flags Order Flag Control Vector ECP1R PCP1F Comparator 1 Rising Edge 0x006B CP1RIF (CPT1CN.5) (EIE1.7) (EIP1.7) TF3 (TMR3CN.7) Timer 3 0x0073 EXF3 (TMR3CN.6) (EIE2.0) (EIP2.0) EADC0 PADC0 ADC0 End of Conversion 0x007B...
  • Page 157: Interrupt Register Descriptions

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 11.3.5. Interrupt Register Descriptions The SFRs used to enable the interrupt sources and set their priority level are described below. Refer to the datasheet 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). SFR Definition 11.12.
  • Page 158: Sfr Definition 11.13. Ip: Interrupt Priority

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 11.13. IP: Interrupt Priority Reset Value 11000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 Addressable SFR Address: 0xB8 SFR Page: All Pages Bits7–6: UNUSED. Read = 11b, Write = don't care. Bit5: PT2: Timer 2 Interrupt Priority Control. This bit sets the priority of the Timer 2 interrupt.
  • Page 159: Sfr Definition 11.14. Eie1: Extended Interrupt Enable 1

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 11.14. EIE1: Extended Interrupt Enable 1 Reset Value ECP1R ECP1F ECP0R ECP0F EPCA0 EWADC0 ESMB0 ESPI0 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 SFR Address: 0xE6 SFR Page: All Pages Bit7: ECP1R: Enable Comparator1 (CP1) Rising Edge Interrupt. This bit sets the masking of the CP1 rising edge interrupt.
  • Page 160: Sfr Definition 11.15. Eie2: Extended Interrupt Enable 2

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 11.15. EIE2: Extended Interrupt Enable 2 Reset Value EADC2 EWADC2 EADC0 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 SFR Address: 0xE7 SFR Page: All Pages Bit7: UNUSED. Read = 0b, Write = don't care. Bit6: ES1: Enable UART1 Interrupt.
  • Page 161: Sfr Definition 11.16. Eip1: Extended Interrupt Priority 1

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 11.16. EIP1: Extended Interrupt Priority 1 Reset Value PCP1R PCP1F PCP0R PCP0F PPCA0 PWADC0 PSMB0 PSPI0 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 SFR Address: 0xF6 SFR Page: All Pages Bit7: PCP1R: Comparator1 (CP1) Rising Interrupt Priority Control. This bit sets the priority of the CP1 interrupt.
  • Page 162: Sfr Definition 11.17. Eip2: Extended Interrupt Priority 2

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 11.17. EIP2: Extended Interrupt Priority 2 Reset Value PADC2 PWADC2 PADC0 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 SFR Address: 0xF7 SFR Page: All Pages Bit7: UNUSED. Read = 0b, Write = don't care. Bit6: ES1: UART1 Interrupt Priority Control.
  • Page 163: Power Management Modes

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 11.4. Power Management Modes The CIP-51 core has two software programmable power management modes: Idle and Stop. Idle mode halts the CPU while leaving the external peripherals and internal clocks active. In Stop mode, the CPU is halted, all interrupts and timers (except the Missing Clock Detector) are inactive, and the system clock is stopped.
  • Page 164: Stop Mode

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 11.4.2. Stop Mode Setting the Stop Mode Select bit (PCON.1) causes the CIP-51 to enter Stop mode as soon as the instruc- tion that sets the bit completes. In Stop mode, the CPU and oscillators are stopped, effectively shutting down all digital peripherals.
  • Page 165: Multiply And Accumulate (Mac0)

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 12. Multiply And Accumulate (MAC0) The C8051F120/1/2/3 and C8051F130/1/2/3 devices include a multiply and accumulate engine which can be used to speed up many mathematical operations. MAC0 contains a 16-by-16 bit multiplier and a 40-bit adder, which can perform integer or fractional multiply-accumulate and multiply operations on signed input values in two SYSCLK cycles.
  • Page 166: Integer And Fractional Math

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 12.2. Integer and Fractional Math MAC0 is capable of interpreting the 16-bit inputs stored in MAC0A and MAC0B as signed integers or as signed fractional numbers. When the MAC0FM bit (MAC0CF.1) is cleared to ‘0’, the inputs are treated as 16-bit, 2’s complement, integer values.
  • Page 167: Operating In Multiply And Accumulate Mode

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 12.3. Operating in Multiply and Accumulate Mode MAC0 operates in Multiply and Accumulate (MAC) mode when the MAC0MS bit (MAC0CF.0) is cleared to ‘0’. When operating in MAC mode, MAC0 performs a 16-by-16 bit multiply on the contents of the MAC0A and MAC0B registers, and adds the result to the contents of the 40-bit MAC0 accumulator.
  • Page 168: Rounding And Saturation

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 12.6. Rounding and Saturation A Rounding Engine is included, which can be used to provide a rounded result when operating on frac- tional numbers. MAC0 uses an unbiased rounding algorithm to round the data stored in bits 31 – 16 of the accumulator, as shown in Table 12.1.
  • Page 169: Multiply Only Example

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 12.7.2. Multiply Only Example The example below implements the equation: × 4660 – – 1360720 MAC0CF, #01h ; Use integer numbers, and multiply only mode (add to zero) MAC0AH, #12h ; Load MAC0A register with 1234 hex = 4660 decimal MAC0AL, #34h MAC0BH, #FEh ;...
  • Page 170: Sfr Definition 12.1. Mac0Cf: Mac0 Configuration

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 12.1. MAC0CF: MAC0 Configuration Reset Value MAC0SC MAC0SD MAC0CA MAC0SAT MAC0FM MAC0MS 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 SFR Address: 0xC3 SFR Page: 3 Bits 7 – 6: UNUSED: Read = 00b, Write = don’t care. Bit 5: MAC0SC: Accumulator Shift Control.
  • Page 171: Sfr Definition 12.2. Mac0Sta: Mac0 Status

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 12.2. MAC0STA: MAC0 Status Reset Value MAC0HO MAC0Z MAC0SO MAC0N 00000100 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 Addressable SFR Address: 0xC0 SFR Page: 3 Bits 7 – 4: UNUSED: Read = 0000b, Write = don’t care. Bit 3: MAC0HO: Hard Overflow Flag.
  • Page 172: Sfr Definition 12.4. Mac0Al: Mac0 A Low Byte

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 12.4. MAC0AL: MAC0 A Low Byte Reset Value 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 SFR Address: 0xC1 SFR Page: 3 Bits 7 – 0: Low Byte (bits 7 – 0) of MAC0 A Register. SFR Definition 12.5.
  • Page 173: Sfr Definition 12.7. Mac0Acc3: Mac0 Accumulator Byte 3

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 12.7. MAC0ACC3: MAC0 Accumulator Byte 3 Reset Value 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 SFR Address: 0x96 SFR Page: 3 Bits 7 – 0: Byte 3 (bits 31 – 24) of MAC0 Accumulator. *Note: The contents of this register should not be changed by software during the first two MAC0 pipeline stages.
  • Page 174: Sfr Definition 12.10. Mac0Acc0: Mac0 Accumulator Byte 0

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 12.10. MAC0ACC0: MAC0 Accumulator Byte 0 Reset Value 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 SFR Address: 0x93 SFR Page: 3 Bits 7 – 0: Byte 0 (bits 7 – 0) of MAC0 Accumulator. *Note: The contents of this register should not be changed by software during the first two MAC0 pipeline stages.
  • Page 175: Sfr Definition 12.13. Mac0Rndl: Mac0 Rounding Register Low Byte

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 12.13. MAC0RNDL: MAC0 Rounding Register Low Byte Reset Value 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 SFR Address: 0xCE SFR Page: 3 Bits 7 – 0: Low Byte (bits 7 – 0) of MAC0 Rounding Register. Rev.
  • Page 176 C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Rev. 1.4...
  • Page 177: Reset Sources

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 13. Reset Sources Reset circuitry allows the controller to be easily placed in a predefined default condition. On entry to this reset state, the following occur: • CIP-51 halts program execution. • Special Function Registers (SFRs) are initialized to their defined reset values. •...
  • Page 178: Power-On Reset

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 13.1. Power-on Reset The C8051F120/1/2/3/4/5/6/7 family incorporates a power supply monitor that holds the MCU in the reset state until V rises above the V level during power-up. See Figure 13.2 for timing diagram, and refer to Table 13.1 for the Electrical Characteristics of the power supply monitor circuit. The RST pin is asserted low until the end of the 100 ms V Monitor timeout in order to allow the V supply to stabilize.
  • Page 179: External Reset

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 13.3. External Reset The external RST pin provides a means for external circuitry to force the MCU into a reset state. Asserting the RST pin low will cause the MCU to enter the reset state. It may be desirable to provide an external pul- lup and/or decoupling of the RST pin to avoid erroneous noise-induced resets.
  • Page 180: Enable/Reset Wdt

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 reset is generated. The WDT can be enabled and disabled as needed in software, or can be permanently enabled if desired. Watchdog features are controlled via the Watchdog Timer Control Register (WDTCN) shown in SFR Definition 13.1. 13.7.1. Enable/Reset WDT The watchdog timer is both enabled and reset by writing 0xA5 to the WDTCN register.
  • Page 181: Sfr Definition 13.1. Wdtcn: Watchdog Timer Control

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 13.1. WDTCN: Watchdog Timer Control Reset Value xxxxx111 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 SFR Address: 0xFF SFR Page: All Pages Bits7 – 0: WDT Control Writing 0xA5 both enables and reloads the WDT. Writing 0xDE followed within 4 system clocks by 0xAD disables the WDT.
  • Page 182: Sfr Definition 13.2. Rstsrc: Reset Source

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 13.2. RSTSRC: Reset Source Reset Value CNVRSEF C0RSEF SWRSEF WDTRSF MCDRSF PORSF PINRSF 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 SFR Address: 0xEF SFR Page: Bit7: Reserved. Bit6: CNVRSEF: Convert Start 0 Reset Source Enable and Flag Write: 0: CNVSTR0 is not a reset source.
  • Page 183: Table 13.1. Reset Electrical Characteristics

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Table 13.1. Reset Electrical Characteristics –40 to +85 °C unless otherwise specified. Parameter Conditions Units = 8.5 mA, V = 2.7 to 3.6 V RST Output Low Voltage — — 0.7 x V RST Input High Voltage — —...
  • Page 184 C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 OTES Rev. 1.4...
  • Page 185: Oscillators

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 14. Oscillators The devices include a programmable internal oscillator and an external oscillator drive circuit. The internal oscillator can be enabled, disabled, and calibrated using the OSCICN and OSCICL registers, as shown in Figure 14.1. The system clock can be sourced by the external oscillator circuit, the internal oscillator, or the on-chip phase-locked loop (PLL).
  • Page 186: Sfr Definition 14.1. Oscicl: Internal Oscillator Calibration

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Electrical specifications for the precision internal oscillator are given in Table 14.1. Note that the system clock may be derived from the programmed internal oscillator divided by 1, 2, 4, or 8, as defined by the IFCN bits in register OSCICN. SFR Definition 14.1.
  • Page 187: External Oscillator Drive Circuit

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 14.2. External Oscillator Drive Circuit The external oscillator circuit may drive an external crystal, ceramic resonator, capacitor, or RC network. A CMOS clock may also provide a clock input. For a crystal or ceramic resonator configuration, the crystal/ resonator must be wired across the XTAL1 and XTAL2 pins as shown in Option 1 of Figure 14.1.
  • Page 188: Sfr Definition 14.3. Clksel: System Clock Selection

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 14.3. CLKSEL: System Clock Selection Reset Value CLKDIV1 CLKDIV0 CLKSL1 CLKSL0 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 SFR Address: 0x97 SFR Page: Bits 7–6: Reserved. Bits 5–4: CLKDIV1–0: Output SYSCLK Divide Factor. These bits can be used to pre-divide SYSCLK before it is output to a port pin through the crossbar.
  • Page 189: Sfr Definition 14.4. Oscxcn: External Oscillator Control

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 14.4. OSCXCN: External Oscillator Control Reset Value XTLVLD XOSCMD2 XOSCMD1 XOSCMD0 XFCN2 XFCN1 XFCN0 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 SFR Address: 0x8C SFR Page: Bit7: XTLVLD: Crystal Oscillator Valid Flag. ( Valid only when XOSCMD = 11x. ) 0: Crystal Oscillator is unused or not yet stable.
  • Page 190: External Crystal Example

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 14.4. External Crystal Example If a crystal or ceramic resonator is used as an external oscillator source for the MCU, the circuit should be configured as shown in Figure 14.1, Option 1. The External Oscillator Frequency Control value (XFCN) should be chosen from the Crystal column of the table in SFR Definition 14.4 (OSCXCN register).
  • Page 191: Phase-Locked Loop (Pll)

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 14.7. Phase-Locked Loop (PLL) A Phase-Locked-Loop (PLL) is included, which is used to multiply the internal oscillator or an external clock source to achieve higher CPU operating frequencies. The PLL circuitry is designed to produce an output frequency between 25 MHz and 100 MHz, from a divided reference frequency between 5 MHz and 30 MHz.
  • Page 192: Powering On And Initializing The Pll

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 PLLN × -------------- - PLL Frequency Reference Frequency PLLM 14.7.3. Powering on and Initializing the PLL To set up and use the PLL as the system clock after power-up of the device, the following procedure should be implemented: Step 1.
  • Page 193: Sfr Definition 14.5. Pll0Cn: Pll Control

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 page 199 ). Important Note: Cache reads, cache writes, and the prefetch engine should be disabled whenever the FLRT bits are changed to a lower setting. To shut down the PLL, the system clock should be switched to the internal oscillator or a stable external clock source, using the CLKSEL register.
  • Page 194: Sfr Definition 14.6. Pll0Div: Pll Pre-Divider

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 14.6. PLL0DIV: PLL Pre-divider Reset Value PLLM4 PLLM3 PLLM2 PLLM1 PLLM0 00000001 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 SFR Address: 0x8D SFR Page: Bits 7–5: UNUSED: Read = 000b; Write = don’t care. Bits 4–0: PLLM4–0: PLL Reference Clock Pre-divider. These bits select the pre-divide value of the PLL reference clock.
  • Page 195: Table 14.2. Pll Frequency Characteristics

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 14.8. PLL0FLT: PLL Filter Reset Value PLLICO1 PLLICO0 PLLLP3 PLLLP2 PLLLP1 PLLLP0 00110001 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 SFR Address: 0x8F SFR Page: Bits 7–6: UNUSED: Read = 00b; Write = don’t care. Bits 5–4: PLLICO1-0: PLL Current-Controlled Oscillator Control Bits.
  • Page 196: Table 14.3. Pll Lock Timing Characteristics

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Table 14.3. PLL Lock Timing Characteristics –40 to +85 °C unless otherwise specified Input Multiplier Pll0flt Output Units Frequency (Pll0mul) Setting Frequency 0x0F 100 MHz µs 0x0F 65 MHz µs 0x1F 80 MHz µs 0x1F 45 MHz µs 5 MHz 0x2F 60 MHz...
  • Page 197 C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 OTES Rev. 1.4...
  • Page 198 C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Rev. 1.4...
  • Page 199: Flash Memory

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 15. Flash Memory All devices include either 128 kB (C8051F12x and C8051F130/1) or 64 kB (C8051F132/3) of on-chip, reprogrammable Flash memory for program code or non-volatile data storage. An additional 256-byte page of Flash is also included for non-volatile data storage. The Flash memory can be programmed in-sys- tem through the JTAG interface, or by software using the MOVX write instructions.
  • Page 200: Non-Volatile Data Storage

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Table 15.1. Flash Electrical Characteristics = 2.7 to 3.6 V; –40 to +85 °C Parameter Conditions Units C8051F12x and C8051F130/1 Bytes Flash Size 131328 C8051F132/3 65792 Bytes Flash Size 100k Erase/Write Endurance Erase Cycle Time µs Write Cycle Time Notes: 1.
  • Page 201: Erasing Flash Pages From Software

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFLE = 0 SFLE = 1 Internal COBANK = 0 COBANK = 1 COBANK = 2 COBANK = 3 Address 0xFFFF Bank 0 Bank 1 Bank 2 Bank 3 Undefined 0x8000 0x7FFF Bank 0 Bank 0 Bank 0 Bank 0 0x00FF Scratchpad...
  • Page 202: Writing Flash Memory From Software

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 15.1.3. Writing Flash Memory From Software Bytes in Flash memory can be written one byte at a time, or in small blocks. The CHBLKW bit in register CCH0CN (SFR Definition 16.1) controls whether a single byte or a block of bytes is written to Flash during a write operation.
  • Page 203: Security Options

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 15.2. Security Options The CIP-51 provides security options to protect the Flash memory from inadvertent modification by soft- ware as well as prevent the viewing of proprietary program code and constants. The Program Store Write Enable (PSCTL.0), Program Store Erase Enable (PSCTL.1), and Flash Write/Erase Enable (FLACL.0) bits protect the Flash memory from accidental modification by software.
  • Page 204: Figure 15.2. 128 Kb Flash Memory Map And Security Bytes

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Read and Write/Erase Security Bits. SFLE = 0 (Bit 7 is MSB.) 0x1FFFF Memory Block Reserved 0x1C000 - 0x1FBFD 0x1FC00 0x18000 - 0x1BFFF Read Lock Byte 0x1FBFF 0x14000 - 0x17FFF Write/Erase Lock Byte 0x1FBFE 0x10000 - 0x13FFF 0x0C000 - 0x0FFFF 0x1FBFD 0x08000 - 0x0BFFF 0x04000 - 0x07FFF...
  • Page 205: Figure 15.3. 64 Kb Flash Memory Map And Security Bytes

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Read and Write/Erase Security Bits. SFLE = 0 (Bit 7 is MSB.) Memory Block Read Lock Byte 0x0FFFF Write/Erase Lock Byte 0x0FFFE 0x0FFFD 0x0C000 - 0x0FFFF 0x08000 - 0x0BFFF 0x04000 - 0x07FFF Flash Access Limit 0x00000 - 0x03FFF SFLE = 1 0x00FF Scratchpad Memory...
  • Page 206: Sfr Definition 15.1. Flacl: Flash Access Limit

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 The Flash Access Limit security feature (see SFR Definition 15.1) protects proprietary program code and data from being read by software running on the device. This feature provides support for OEMs that wish to program the MCU with proprietary value-added firmware before distribution. The value-added firmware can be protected while allowing additional code to be programmed in remaining program memory space later.
  • Page 207: Summary Of Flash Security Options

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 15.2.1. Summary of Flash Security Options There are three Flash access methods supported on the C8051F12x and C8051F13x devices; 1) Access- ing Flash through the JTAG debug interface, 2) Accessing Flash from firmware residing below the Flash Access Limit, and 3) Accessing Flash from firmware residing at or above the Flash Access Limit. Accessing Flash through the JTAG debug interface: 1.
  • Page 208: Sfr Definition 15.2. Flscl: Flash Memory Control

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 15.2. FLSCL: Flash Memory Control Reset Value FLRT Reserved Reserved Reserved FLWE 10000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 SFR Address: SFR Address: 0xB7 SFR Page: Bits 7–6: Unused. Bits 5–4: FLRT: Flash Read Time. These bits should be programmed to the smallest allowed value, according to the system clock speed.
  • Page 209: Sfr Definition 15.3. Psctl: Program Store Read/Write Control

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 15.3. PSCTL: Program Store Read/Write Control Reset Value SFLE PSEE PSWE 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 Address: SFR Address: 0x8F SFR Page: Bits 7–3: UNUSED. Read = 00000b, Write = don't care. Bit 2: SFLE: Scratchpad Flash Memory Access Enable When this bit is set, Flash MOVC reads and writes from user software are directed to the...
  • Page 210 C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 OTES Rev. 1.4...
  • Page 211: Branch Target Cache

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 16. Branch Target Cache The C8051F12x and C8051F13x device families incorporate a 63x4 byte branch target cache with a 4-byte prefetch engine. Because the access time of the Flash memory is 40 Flashns, and the minimum instruction time is 10ns (C8051F120/1/2/3 and C8051F130/1/2/3) or 20 ns (C8051F124/5/6/7), the branch target cache and prefetch engine are necessary for full-speed code execution.
  • Page 212: Cache And Prefetch Optimization

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 The replacement algorithm is selected with the Cache Algorithm bit, CHALGM (CCH0TN.3). When CHALGM is cleared to ‘0’, the cache will use the rebound algorithm to replace cache locations. The rebound algorithm replaces locations in order from the beginning of cache memory to the end, and then from the end of cache memory to the beginning.
  • Page 213 C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Certain types of instruction data or certain blocks of code can also be excluded from caching. The destina- tions of RETI instructions are, by default, excluded from caching. To enable caching of RETI destinations, the CHRETI bit (CCH0CN.3) can be set to ‘1’. It is generally not beneficial to cache RETI destinations unless the same instruction is likely to be interrupted repeatedly (such as a code loop that is waiting for an interrupt to happen).
  • Page 214: Figure 16.3. Cache Lock Operation

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Lock Status TAG 0 SLOT 0 UNLOCKED TAG 1 SLOT 1 UNLOCKED Cache Push TAG 2 SLOT 2 UNLOCKED Operations UNLOCKED Decrement CHSLOT TAG 57 SLOT 57 UNLOCKED CHSLOT = 58 TAG 58 SLOT 58 UNLOCKED TAG 59 SLOT 59 LOCKED TAG 60...
  • Page 215: Sfr Definition 16.1. Cch0Cn: Cache Control

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 16.1. CCH0CN: Cache Control Reset Value CHWREN CHRDEN CHPFEN CHFLSH CHRETI CHISR CHMOVC CHBLKW 11100110 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 SFR Address: 0xA1 SFR Page: Bit 7: CHWREN: Cache Write Enable. This bit enables the processor to write to the cache memory. 0: Cache contents are not allowed to change, except during Flash writes/erasures or cache locks.
  • Page 216: Sfr Definition 16.2. Cch0Tn: Cache Tuning

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 16.2. CCH0TN: Cache Tuning Reset Value CHMSCTL CHALGM CHFIXM CHMSTH 00000100 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 SFR Address: 0xA2 SFR Page: Bits 7–4: CHMSCTL: Cache Miss Penalty Accumulator (Bits 4–1). These are bits 4-1 of the Cache Miss Penalty Accumulator. To read these bits, they must first be latched by reading the CHMSCTH bits in the CCH0MA Register (See SFR Definition 16.4).
  • Page 217: Sfr Definition 16.4. Cch0Ma: Cache Miss Accumulator

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 16.4. CCH0MA: Cache Miss Accumulator Reset Value CHMSOV CHMSCTH 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 SFR Address: 0x9A SFR Page: Bit 7: CHMSOV: Cache Miss Penalty Overflow. This bit indicates when the Cache Miss Penalty Accumulator has overflowed since it was last written.
  • Page 218 C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 OTES Rev. 1.4...
  • Page 219: External Data Memory Interface And On-Chip Xram

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 17. External Data Memory Interface and On-Chip XRAM There are 8 kB of on-chip RAM mapped into the external data memory space (XRAM), as well as an Exter- nal Data Memory Interface which can be used to access off-chip memories and memory-mapped devices connected to the GPIO ports.
  • Page 220: Port Selection And Configuration

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 5. Select the memory mode (on-chip only, split mode without bank select, split mode with bank select, or off-chip only). 6. Set up timing to interface with off-chip memory or peripherals. Each of these five steps is explained in detail in the following sections. The Port selection, Multiplexed mode selection, and Mode bits are located in the EMI0CF register shown in SFR Definition 17.2.
  • Page 221: Sfr Definition 17.2. Emi0Cf: External Memory Configuration

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 17.2. EMI0CF: External Memory Configuration Reset Value PRTSEL EMD2 EMD1 EMD0 EALE1 EALE0 00000011 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 SFR Address: 0xA3 SFR Page: Bits7–6: Unused. Read = 00b. Write = don’t care. Bit5: PRTSEL: EMIF Port Select.
  • Page 222: Multiplexed And Non-Multiplexed Selection

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 17.4. Multiplexed and Non-multiplexed Selection The External Memory Interface is capable of acting in a Multiplexed mode or a Non-multiplexed mode, depending on the state of the EMD2 (EMI0CF.4) bit. 17.4.1. Multiplexed Configuration In Multiplexed mode, the Data Bus and the lower 8-bits of the Address Bus share the same Port pins: AD[7:0].
  • Page 223: Non-Multiplexed Configuration

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 17.4.2. Non-multiplexed Configuration In Non-multiplexed mode, the Data Bus and the Address Bus pins are not shared. An example of a Non- multiplexed Configuration is shown in Figure 17.2. See Section “17.6.1. Non-multiplexed Mode” on page 227 for more information about Non-multiplexed operation. A[15:0] ADDRESS BUS A[15:0]...
  • Page 224: Memory Mode Selection

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 17.5. Memory Mode Selection The external data memory space can be configured in one of four modes, shown in Figure 17.3, based on the EMIF Mode bits in the EMI0CF register (SFR Definition 17.2). These modes are summarized below. More information about the different modes can be found in Section “SFR Definition 17.3.
  • Page 225: Split Mode With Bank Select

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 17.5.3. Split Mode with Bank Select When EMI0CF.[3:2] are set to ‘10’, the XRAM memory map is split into two areas, on-chip space and off- chip space. • Effective addresses below the 8k boundary will access on-chip XRAM space. •...
  • Page 226: Sfr Definition 17.3. Emi0Tc: External Memory Timing Control

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 17.3. EMI0TC: External Memory Timing Control Reset Value EAS1 EAS0 ERW3 EWR2 EWR1 EWR0 EAH1 EAH0 11111111 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 SFR Address: 0xA1 SFR Page: Bits7–6: EAS1–0: EMIF Address Setup Time Bits. 00: Address setup time = 0 SYSCLK cycles.
  • Page 227: Non-Multiplexed Mode

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 17.6.1. Non-multiplexed Mode 17.6.1.1.16-bit MOVX: EMI0CF[4:2] = ‘101’, ‘110’, or ‘111’ Nonmuxed 16-bit WRITE ADDR[15:8] P1/P5 EMIF ADDRESS (8 MSBs) from DPH P1/P5 ADDR[7:0] P2/P6 EMIF ADDRESS (8 LSBs) from DPL P2/P6 DATA[7:0] P3/P7 EMIF WRITE DATA P3/P7 P0.7/P4.7 P0.7/P4.7 P0.6/P4.6...
  • Page 228: Figure 17.5. Non-Multiplexed 8-Bit Movx Without Bank Select Timing

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 17.6.1.2.8-bit MOVX without Bank Select: EMI0CF[4:2] = ‘101’ or ‘111’. Nonmuxed 8-bit WRITE without Bank Select ADDR[15:8] P1/P5 ADDR[7:0] P2/P6 EMIF ADDRESS (8 LSBs) from R0 or R1 P2/P6 DATA[7:0] P3/P7 EMIF WRITE DATA P3/P7 P0.7/P4.7 P0.7/P4.7 P0.6/P4.6 P0.6/P4.6 Nonmuxed 8-bit READ without Bank Select ADDR[15:8]...
  • Page 229: Figure 17.6. Non-Multiplexed 8-Bit Movx With Bank Select Timing

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 17.6.1.3.8-bit MOVX with Bank Select: EMI0CF[4:2] = ‘110’. Nonmuxed 8-bit WRITE with Bank Select ADDR[15:8] P1/P5 EMIF ADDRESS (8 MSBs) from EMI0CN P1/P5 ADDR[7:0] P2/P6 EMIF ADDRESS (8 LSBs) from R0 or R1 P2/P6 DATA[7:0] P3/P7 EMIF WRITE DATA P3/P7 P0.7/P4.7 P0.7/P4.7...
  • Page 230: Multiplexed Mode

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 17.6.2. Multiplexed Mode 17.6.2.1.16-bit MOVX: EMI0CF[4:2] = ‘001’, ‘010’, or ‘011’ Muxed 16-bit WRITE ADDR[15:8] P2/P6 EMIF ADDRESS (8 MSBs) from DPH P2/P6 EMIF ADDRESS (8 LSBs) from AD[7:0] P3/P7 EMIF WRITE DATA P3/P7 ALEH ALEL P0.5/P4.5 P0.5/P4.5 P0.7/P4.7 P0.7/P4.7 P0.6/P4.6...
  • Page 231: Figure 17.8. Multiplexed 8-Bit Movx Without Bank Select Timing

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 17.6.2.2.8-bit MOVX without Bank Select: EMI0CF[4:2] = ‘001’ or ‘011’. Muxed 8-bit WRITE Without Bank Select ADDR[15:8] P2/P6 EMIF ADDRESS (8 LSBs) from AD[7:0] P3/P7 EMIF WRITE DATA P3/P7 R0 or R1 ALEH ALEL P0.5/P4.5 P0.5/P4.5 P0.7/P4.7 P0.7/P4.7 P0.6/P4.6 P0.6/P4.6 Muxed 8-bit READ Without Bank Select...
  • Page 232: Figure 17.9. Multiplexed 8-Bit Movx With Bank Select Timing

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 17.6.2.3.8-bit MOVX with Bank Select: EMI0CF[4:2] = ‘010’. Muxed 8-bit WRITE with Bank Select ADDR[15:8] P2/P6 EMIF ADDRESS (8 MSBs) from EMI0CN P2/P6 EMIF ADDRESS (8 LSBs) from AD[7:0] P3/P7 EMIF WRITE DATA P3/P7 R0 or R1 ALEH ALEL P0.5/P4.5 P0.5/P4.5...
  • Page 233: Table 17.1. Ac Parameters For External Memory Interface

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Table 17.1. AC Parameters for External Memory Interface Parameter Description Units Address/Control Setup Time 3 x T SYSCLK Address/Control Pulse Width 1 x T 16 x T SYSCLK SYSCLK Address/Control Hold Time 3 x T SYSCLK Address Latch Enable High Time 1 x T 4 x T ALEH...
  • Page 234 C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 OTES Rev. 1.4...
  • Page 235: Port Input/Output

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 18. Port Input/Output The devices are fully integrated mixed-signal System on a Chip MCUs with 64 digital I/O pins (100-pin TQFP packaging) or 32 digital I/O pins (64-pin TQFP packaging), organized as 8-bit Ports. All ports are both bit- and byte-addressable through their corresponding Port Data registers. All Port pins are 5 V-toler- ant, and all support configurable Open-Drain or Push-Pull output modes and weak pullups.
  • Page 236: Table 18.1. Port I/O Dc Electrical Characteristics

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Table 18.1. Port I/O DC Electrical Characteristics = 2.7 to 3.6 V, –40 to +85 °C unless otherwise specified. Parameter Conditions Units = -3 mA, Port I/O Push-Pull – 0.7 Output High Voltage = -10 µA, Port I/O Push-Pull –...
  • Page 237: Figure 18.2. Port I/O Functional Block Diagram

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 A wide array of digital resources is available through the four lower I/O Ports: P0, P1, P2, and P3. Each of the pins on P0, P1, P2, and P3, can be defined as a General-Purpose I/O (GPIO) pin or can be controlled by a digital peripheral or function (like UART0 or /INT1 for example), as shown in Figure 18.2.
  • Page 238: Ports 0 Through 3 And The Priority Crossbar Decoder

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 18.1. Ports 0 through 3 and the Priority Crossbar Decoder The Priority Crossbar Decoder, or “Crossbar”, allocates and assigns Port pins on Port 0 through Port 3 to the digital peripherals (UARTs, SMBus, PCA, Timers, etc.) on the device using a priority order. The Port pins are allocated in order starting with P0.0 and continue through P3.7 if necessary.
  • Page 239: Configuring The Output Modes Of The Port Pins

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 ple, to assign TX0 to a Port pin without assigning RX0 as well. Each combination of enabled peripherals results in a unique device pinout. All Port pins on Ports 0 through 3 that are not allocated by the Crossbar can be accessed as General-Pur- pose I/O (GPIO) pins by reading and writing the associated Port Data registers (See SFR Definition 18.4, SFR Definition 18.6, SFR Definition 18.9, and SFR Definition 18.11), a set of SFR’s which are both byte- and bit-addressable.
  • Page 240: Configuring Port Pins As Digital Inputs

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 The PnMDOUT registers control the output modes of the port pins regardless of whether the Crossbar has allocated the Port pin for a digital peripheral or not. The exceptions to this rule are: the Port pins connected to SDA, SCL, RX0 (if UART0 is in Mode 0), and RX1 (if UART1 is in Mode 0) are always configured as Open-Drain outputs, regardless of the settings of the associated bits in the PnMDOUT registers.
  • Page 241: External Memory Interface Pin Assignments

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 18.1.6. External Memory Interface Pin Assignments If the External Memory Interface (EMIF) is enabled on the Low ports (Ports 0 through 3), EMIFLE (XBR2.5) should be set to a logic 1 so that the Crossbar will not assign peripherals to P0.7 (/WR), P0.6 (/RD), and if the External Memory Interface is in Multiplexed mode, P0.5 (ALE).
  • Page 242: Figure 18.5. Priority Crossbar Decode Table (Emifle = 1; Emif In Non-Multiplexed Mode; P1Mdin = 0Xff)

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Crossbar Register Bits PIN I/O 0 ● UART0EN: XBR0.2 ● ● ● ● ● MISO SPI0EN: XBR0.1 ● ● MOSI ● ● NSS is not assigned to a port pin when the SPI is placed in 3-wire mode ●...
  • Page 243: Crossbar Pin Assignment Example

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 18.1.7. Crossbar Pin Assignment Example In this example (Figure 18.6), we configure the Crossbar to allocate Port pins for UART0, the SMBus, UART1, /INT0, and /INT1 (8 pins total). Additionally, we configure the External Memory Interface to oper- ate in Multiplexed mode and to appear on the Low ports.
  • Page 244: Figure 18.6. Crossbar Example

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Crossbar Register Bits PIN I/O 0 ● UART0EN: XBR0.2 ● ● ● ● ● MISO SPI0EN: XBR0.1 ● ● MOSI ● ● ● ● ● ● ● ● SMB0EN: XBR0.0 ● ● ● ● ● ● ● ● ● ●...
  • Page 245: Sfr Definition 18.1. Xbr0: Port I/O Crossbar Register 0

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 18.1. XBR0: Port I/O Crossbar Register 0 Reset Value CP0E ECI0E PCA0ME UART0EN SPI0EN SMB0EN 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 SFR Address: 0xE1 SFR Page: Bit7: CP0E: Comparator 0 Output Enable Bit. 0: CP0 unavailable at Port pin.
  • Page 246: Sfr Definition 18.2. Xbr1: Port I/O Crossbar Register 1

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 18.2. XBR1: Port I/O Crossbar Register 1 Reset Value SYSCKE T2EXE INT1E INT0E CP1E 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 SFR Address: 0xE2 SFR Page: Bit7: SYSCKE: /SYSCLK Output Enable Bit. 0: /SYSCLK unavailable at Port pin. 1: /SYSCLK (divided by 1, 2, 4, or 8) routed to Port pin.
  • Page 247: Sfr Definition 18.3. Xbr2: Port I/O Crossbar Register 2

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 18.3. XBR2: Port I/O Crossbar Register 2 Reset Value WEAKPUD XBARE CNVST2E T4EXE UART1E EMIFLE CNVST0E 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 SFR Address: 0xE3 SFR Page: Bit7: WEAKPUD: Weak Pullup Disable Bit. 0: Weak pullups globally enabled.
  • Page 248: Sfr Definition 18.4. P0: Port0 Data

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 18.4. P0: Port0 Data Reset Value P0.7 P0.6 P0.5 P0.4 P0.3 P0.2 P0.1 P0.0 11111111 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 Addressable SFR Address: 0x80 SFR Page: All Pages Bits7–0: P0.[7:0]: Port0 Output Latch Bits. (Write - Output appears on I/O pins per XBR0, XBR1, and XBR2 Registers) 0: Logic Low Output.
  • Page 249: Sfr Definition 18.6. P1: Port1 Data

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 18.6. P1: Port1 Data Reset Value P1.7 P1.6 P1.5 P1.4 P1.3 P1.2 P1.1 P1.0 11111111 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 Addressable SFR Address: 0x90 SFR Page: All Pages Bits7–0: P1.[7:0]: Port1 Output Latch Bits. (Write - Output appears on I/O pins per XBR0, XBR1, and XBR2 Registers) 0: Logic Low Output.
  • Page 250: Sfr Definition 18.8. P1Mdout: Port1 Output Mode

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 18.8. P1MDOUT: Port1 Output Mode Reset Value 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 SFR Address: 0xA5 SFR Page: Bits7–0: P1MDOUT.[7:0]: Port1 Output Mode Bits. 0: Port Pin output mode is configured as Open-Drain. 1: Port Pin output mode is configured as Push-Pull.
  • Page 251: Sfr Definition 18.10. P2Mdout: Port2 Output Mode

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 18.10. P2MDOUT: Port2 Output Mode Reset Value 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 SFR Address: 0xA6 SFR Page: Bits7–0: P2MDOUT.[7:0]: Port2 Output Mode Bits. 0: Port Pin output mode is configured as Open-Drain. 1: Port Pin output mode is configured as Push-Pull.
  • Page 252: Ports 4 Through 7 (100-Pin Tqfp Devices Only)

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 18.12. P3MDOUT: Port3 Output Mode Reset Value 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 SFR Address: 0xA7 SFR Page: Bits7–0: P3MDOUT.[7:0]: Port3 Output Mode Bits. 0: Port Pin output mode is configured as Open-Drain. 1: Port Pin output mode is configured as Push-Pull.
  • Page 253: Configuring Port Pins As Digital Inputs

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 The output modes of the Port pins on Ports 4 through 7 are determined by the bits in their respective PnMDOUT Output Mode Registers. Each bit in PnMDOUT controls the output mode of its corresponding port pin (see SFR Definition 18.14, SFR Definition 18.16, SFR Definition 18.18, and SFR Definition 18.20). For example, to place Port pin 4.3 in push-pull mode (digital output), set P4MDOUT.3 to logic 1.
  • Page 254: Sfr Definition 18.13. P4: Port4 Data

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 18.13. P4: Port4 Data Reset Value P4.7 P4.6 P4.5 P4.4 P4.3 P4.2 P4.1 P4.0 11111111 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 Addressable SFR Address: 0xC8 SFR Page: Bits7–0: P4.[7:0]: Port4 Output Latch Bits. Write - Output appears on I/O pins. 0: Logic Low Output.
  • Page 255: Sfr Definition 18.15. P5: Port5 Data

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 18.15. P5: Port5 Data Reset Value P5.7 P5.6 P5.5 P5.4 P5.3 P5.2 P5.1 P5.0 11111111 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 Addressable SFR Address: 0xD8 SFR Page: Bits7–0: P5.[7:0]: Port5 Output Latch Bits. Write - Output appears on I/O pins. 0: Logic Low Output.
  • Page 256: Sfr Definition 18.17. P6: Port6 Data

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 18.17. P6: Port6 Data Reset Value P6.7 P6.6 P6.5 P6.4 P6.3 P6.2 P6.1 P6.0 11111111 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 Addressable SFR Address: 0xE8 SFR Page: Bits7–0: P6.[7:0]: Port6 Output Latch Bits. Write - Output appears on I/O pins. 0: Logic Low Output.
  • Page 257: Sfr Definition 18.19. P7: Port7 Data

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 18.19. P7: Port7 Data Reset Value P7.7 P7.6 P7.5 P7.4 P7.3 P7.2 P7.1 P7.0 11111111 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 Addressable SFR Address: 0xF8 SFR Page: Bits7–0: P7.[7:0]: Port7 Output Latch Bits. Write - Output appears on I/O pins. 0: Logic Low Output.
  • Page 258 C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 OTES Rev. 1.4...
  • Page 259: System Management Bus / I2C Bus (Smbus0)

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 19. System Management Bus / I2C Bus (SMBus0) The SMBus0 I/O interface is a two-wire, bi-directional serial bus. SMBus0 is compliant with the System Management Bus Specification, version 1.1, and compatible with the I2C serial bus. Reads and writes to the interface by the system controller are byte oriented with the SMBus0 interface autonomously con- trolling the serial transfer of the data.
  • Page 260: Supporting Documents

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Figure 19.2 shows a typical SMBus configuration. The SMBus0 interface will work at any voltage between 3.0 and 5.0 V and different devices on the bus may operate at different voltage levels. The bi-directional SCL (serial clock) and SDA (serial data) lines must be connected to a positive power supply voltage through a pullup resistor or similar circuit.
  • Page 261: Arbitration

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 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 trans- action 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.
  • Page 262: Smbus Transfer Modes

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 19.3. SMBus Transfer Modes The SMBus0 interface may be configured to operate as a master and/or a slave. At any particular time, the interface will be operating in one of the following modes: Master Transmitter, Master Receiver, Slave Transmitter, or Slave Receiver.
  • Page 263: Slave Transmitter Mode

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 19.3.3. Slave Transmitter Mode Serial data is transmitted on SDA while the serial clock is received on SCL. The SMBus0 interface receives a START followed by data byte containing the slave address and direction bit. If the received slave address matches the address held in register SMB0ADR, the SMBus0 interface generates an ACK.
  • Page 264: Smbus Special Function Registers

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 19.4. SMBus Special Function Registers The SMBus0 serial interface is accessed and controlled through five SFR’s: SMB0CN Control Register, SMB0CR Clock Rate Register, SMB0ADR Address Register, SMB0DAT Data Register and SMB0STA Sta- tus Register. The five special function registers related to the operation of the SMBus0 interface are described in the following sections.
  • Page 265 C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Setting the SMBus0 Free Timer Enable bit (FTE, SMB0CN.1) to logic 1 enables the timer in SMB0CR. When SCL goes high, the timer in SMB0CR counts up. A timer overflow indicates a free bus timeout: if SMBus0 is waiting to generate a START, it will do so after this timeout. The bus free period should be less than 50 µs (see SFR Definition 19.2, SMBus0 Clock Rate Register).
  • Page 266: Sfr Definition 19.1. Smb0Cn: Smbus0 Control

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 19.1. SMB0CN: SMBus0 Control Reset Value BUSY ENSMB 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 Addressable SFR Address: 0xC0 SFR Page: Bit7: BUSY: Busy Status Flag. 0: SMBus0 is free 1: SMBus0 is busy Bit6: ENSMB: SMBus Enable.
  • Page 267: Clock Rate Register

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 19.4.2. Clock Rate Register SFR Definition 19.2. SMB0CR: SMBus0 Clock Rate Reset Value 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 SFR Address: 0xCF SFR Page: Bits7–0: SMB0CR.[7:0]: SMBus0 Clock Rate Preset The SMB0CR Clock Rate register controls the frequency of the serial clock SCL in master mode.
  • Page 268: Data Register

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 19.4.3. Data Register The SMBus0 Data register SMB0DAT holds a byte of serial data to be transmitted or one that has just been received. Software can read or write to this register while the SI flag is set to logic 1; software should not attempt to access the SMB0DAT register when the SMBus is enabled and the SI flag reads logic 0 since the hardware may be in the process of shifting a byte of data in or out of the register.
  • Page 269: Status Register

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 19.4. SMB0ADR: SMBus0 Address Reset Value SLV6 SLV5 SLV4 SLV3 SLV2 SLV1 SLV0 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 SFR Address: 0xC3 SFR Page: Bits7–1: SLV6–SLV0: SMBus0 Slave Address. These bits are loaded with the 7-bit slave address to which SMBus0 will respond when oper- ating as a slave transmitter or slave receiver.
  • Page 270: Table 19.1. Smb0Sta Status Codes And States

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Table 19.1. SMB0STA Status Codes and States Status Mode SMBus State Typical Action Code 0x08 START condition transmitted. Load SMB0DAT with Slave Address + R/W. Clear STA. 0x10 Repeated START condition transmitted. Load SMB0DAT with Slave Address + R/W.
  • Page 271 C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Table 19.1. SMB0STA Status Codes and States (Continued) Status Mode SMBus State Typical Action Code 0x60 Own slave address + W received. ACK trans- Wait for data. mitted. 0x68 Arbitration lost in sending SLA + R/W as mas- Save current data for retry when bus is ter.
  • Page 272 C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 OTES Rev. 1.4...
  • Page 273: Enhanced Serial Peripheral Interface (Spi0)

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 20. Enhanced Serial Peripheral Interface (SPI0) The Enhanced Serial Peripheral Interface (SPI0) provides access to a flexible, full-duplex synchronous serial bus. SPI0 can operate as a master or slave device in both 3-wire or 4-wire modes, and supports mul- tiple masters and slaves on a single SPI bus.
  • Page 274: Signal Descriptions

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 20.1. Signal Descriptions The four signals used by SPI0 (MOSI, MISO, SCK, NSS) are described below. 20.1.1. Master Out, Slave In (MOSI) The master-out, slave-in (MOSI) signal is an output from a master device and an input to slave devices. It is used to serially transfer data from the master to the slave.
  • Page 275: Spi0 Master Mode Operation

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 20.2. SPI0 Master Mode Operation A SPI master device initiates all data transfers on a SPI bus. SPI0 is placed in master mode by setting the Master Enable flag (MSTEN, SPI0CN.6). Writing a byte of data to the SPI0 data register (SPI0DAT) when in master mode writes to the transmit buffer.
  • Page 276: Figure 20.2. Multiple-Master Mode Connection Diagram

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 GPIO MISO MISO Master Master MOSI MOSI Device 1 Device 2 GPIO Figure 20.2. Multiple-Master Mode Connection Diagram Master Slave Device Device MISO MISO MOSI MOSI Figure 20.3. 3-Wire Single Master and Slave Mode Connection Diagram Master Slave MISO MISO Device...
  • Page 277: Spi0 Slave Mode Operation

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 20.3. SPI0 Slave Mode Operation When SPI0 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 a master device controlling the SCK sig- nal.
  • Page 278: Serial Clock Timing

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 20.5. Serial Clock Timing Four combinations of serial clock phase and polarity can be selected using the clock control bits in the SPI0 Configuration Register (SPI0CFG). The CKPHA bit (SPI0CFG.5) selects one of two clock phases (edge used to latch the data). The CKPOL bit (SPI0CFG.4) selects between an active-high or active-low clock.
  • Page 279: Figure 20.6. Slave Mode Data/Clock Timing (Ckpha = 0)

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 (CKPOL=0, CKPHA=0) (CKPOL=1, CKPHA=0) MOSI Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 MISO Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 NSS (4-Wire Mode) Figure 20.6. Slave Mode Data/Clock Timing (CKPHA = 0) (CKPOL=0, CKPHA=1) (CKPOL=1, CKPHA=1) MOSI...
  • Page 280: Spi Special Function Registers

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 20.6. SPI Special Function Registers SPI0 is accessed and controlled through four special function registers in the system controller: SPI0CN Control Register, SPI0DAT Data Register, SPI0CFG Configuration Register, and SPI0CKR Clock Rate Register. The four special function registers related to the operation of the SPI0 Bus are described in the following figures.
  • Page 281: Sfr Definition 20.2. Spi0Cn: Spi0 Control

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 20.2. SPI0CN: SPI0 Control Reset Value SPIF WCOL MODF RXOVRN NSSMD1 NSSMD0 TXBMT SPIEN 00000110 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 Addressable SFR Address: 0xF8 SFR Page: Bit 7: SPIF: SPI0 Interrupt Flag. This bit is set to logic 1 by hardware at the end of a data transfer. If interrupts are enabled, setting this bit causes the CPU to vector to the SPI0 interrupt service routine.
  • Page 282: Sfr Definition 20.3. Spi0Ckr: Spi0 Clock Rate

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 20.3. SPI0CKR: SPI0 Clock Rate Reset Value SCR7 SCR6 SCR5 SCR4 SCR3 SCR2 SCR1 SCR0 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 SFR Address: 0x9D SFR Page: Bits 7–0: SCR7–SCR0: SPI0 Clock Rate. These bits determine the frequency of the SCK output when the SPI0 module is configured for master mode operation.
  • Page 283: Figure 20.8. Spi Master Timing (Ckpha = 0)

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SCK* MCKH MCKL MISO MOSI * SCK is shown for CKPOL = 0. SCK is the opposite polarity for CKPOL = 1. Figure 20.8. SPI Master Timing (CKPHA = 0) SCK* MCKH MCKL MISO MOSI * SCK is shown for CKPOL = 0. SCK is the opposite polarity for CKPOL = 1. Figure 20.9.
  • Page 284: Figure 20.10. Spi Slave Timing (Ckpha = 0)

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SCK* MOSI MISO * SCK is shown for CKPOL = 0. SCK is the opposite polarity for CKPOL = 1. Figure 20.10. SPI Slave Timing (CKPHA = 0) SCK* MOSI MISO * SCK is shown for CKPOL = 0. SCK is the opposite polarity for CKPOL = 1. Figure 20.11.
  • Page 285: Table 20.1. Spi Slave Timing Parameters

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Table 20.1. SPI Slave Timing Parameters Parameter Description Units Master Mode Timing* (See Figure 20.8 and Figure 20.9) 1 x T SCK High Time MCKH SYSCLK 1 x T SCK Low Time MCKL SYSCLK 1 x T + 20 MISO Valid to SCK Shift Edge SYSCLK SCK Shift Edge to MISO Change...
  • Page 286 C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 OTES Rev. 1.4...
  • Page 287: Uart0

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 21. UART0 UART0 is an enhanced serial port with frame error detection and address recognition hardware. UART0 may operate in full-duplex asynchronous or half-duplex synchronous modes, and mutiproccessor commu- nication is fully supported. Receive data is buffered in a holding register, allowing UART0 to start reception of a second incoming data byte before software has finished reading the previous data byte.
  • Page 288: Uart0 Operational Modes

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 21.1. UART0 Operational Modes UART0 provides four operating modes (one synchronous and three asynchronous) selected by setting configuration bits in the SCON0 register. These four modes offer different baud rates and communication protocols. The four modes are summarized in Table 21.1. Table 21.1.
  • Page 289: Mode 1: 8-Bit Uart, Variable Baud Rate

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 21.1.2. Mode 1: 8-Bit UART, Variable Baud Rate Mode 1 provides standard asynchronous, full duplex communication using a total of 10 bits per data byte: one start bit, eight data bits (LSB first), and one stop bit. Data are transmitted from the TX0 pin and received at the RX0 pin.
  • Page 290 C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 The Timer 1 overflow rate is determined by the Timer 1 clock source (T1CLK) and reload value (TH1). The frequency of T1CLK is selected as described in Section “23.1. Timer 0 and Timer 1” on page 309 . The Timer 1 overflow rate is calculated as shown in Equation 21.2.
  • Page 291: Mode 2: 9-Bit Uart, Fixed Baud Rate

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 21.1.3. Mode 2: 9-Bit UART, Fixed Baud Rate Mode 2 provides asynchronous, full-duplex communication using a total of eleven bits per data byte: a start bit, 8 data bits (LSB first), a programmable ninth data bit, and a stop bit. Mode 2 supports multiprocessor communications and hardware address recognition (see Section 21.2 ).
  • Page 292: Mode 3: 9-Bit Uart, Variable Baud Rate

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 RS-232 RS-232 C8051Fxxx LEVEL XLTR C8051Fxxx Figure 21.6. UART0 Modes 1, 2, and 3 Interconnect Diagram 21.1.4. Mode 3: 9-Bit UART, Variable Baud Rate Mode 3 uses the Mode 2 transmission protocol with the Mode 1 baud rate generation. Mode 3 operation transmits 11 bits: a start bit, 8 data bits (LSB first), a programmable ninth data bit, and a stop bit.
  • Page 293: Multiprocessor Communications

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 21.2. Multiprocessor Communications Modes 2 and 3 support multiprocessor communication between a master processor and one or more slave processors by special use of the ninth data bit and the built-in UART0 address recognition hardware. When a master processor wants to transmit to one or more slaves, it first sends an address byte to select the tar- get(s).
  • Page 294: Frame And Transmission Error Detection

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Master Slave Slave Slave Device Device Device Device Figure 21.7. UART Multi-Processor Mode Interconnect Diagram 21.3. Frame and Transmission Error Detection All Modes: The Transmit Collision bit (TXCOL0 bit in register SSTA0) reads ‘1’ if user software writes data to the SBUF0 register while a transmit is in progress.
  • Page 295: Table 21.2. Oscillator Frequencies For Standard Baud Rates

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Table 21.2. Oscillator Frequencies for Standard Baud Rates Timer 2, 3, or Timer 1 Reload System Clock Divide Factor 4 Reload Resulting Baud Rate (Hz) Frequency (MHz) Value Value 100.0 0xCA 0xFFCA 115200 (115741) 99.5328 0xCA 0xFFCA 115200 50.0 0xE5 0xFFE5...
  • Page 296: Sfr Definition 21.1. Scon0: Uart0 Control

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 21.1. SCON0: UART0 Control Reset Value SM00 SM10 SM20 REN0 TB80 RB80 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 Addressable SFR Address: 0x98 SFR Page: Bits7–6: SM00–SM10: Serial Port Operation Mode: Write: When written, these bits select the Serial Port Operation Mode as follows: SM00 SM10 Mode...
  • Page 297: Sfr Definition 21.2. Ssta0: Uart0 Status And Clock Selection

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 21.2. SSTA0: UART0 Status and Clock Selection Reset Value RXOV0 TXCOL0 SMOD0 S0TCLK1 S0TCLK0 S0RCLK1 S0RCLK0 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 SFR Address: 0x91 SFR Page: Bit7: FE0: Frame Error Flag.* This flag indicates if an invalid (low) STOP bit is detected. 0: Frame Error has not been detected 1: Frame Error has been detected.
  • Page 298: Sfr Definition 21.3. Sbuf0: Uart0 Data Buffer

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 21.3. SBUF0: UART0 Data Buffer Reset Value 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 SFR Address: 0x99 SFR Page: Bits7–0: SBUF0.[7:0]: UART0 Buffer Bits 7–0 (MSB–LSB) This is actually two registers; a transmit and a receive buffer register. When data is moved to SBUF0, it goes to the transmit buffer and is held for serial transmission.
  • Page 299: Uart1

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 22. UART1 UART1 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 (details Section “22.1. Enhanced Baud Rate Generation” on page 300 ).
  • Page 300: Enhanced Baud Rate Generation

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 22.1. Enhanced Baud Rate Generation The UART1 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 (shown as RX Timer in Figure 22.2), which is not user- accessible.
  • Page 301: Operational Modes

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 22.2. Operational Modes UART1 provides standard asynchronous, full duplex communication. The UART mode (8-bit or 9-bit) is selected by the S1MODE bit (SCON1.7). Typical UART connection options are shown below. RS-232 RS-232 C8051Fxxx LEVEL XLTR C8051Fxxx Figure 22.3. UART Interconnect Diagram 22.2.1.
  • Page 302: 9-Bit Uart

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 22.2.2. 9-Bit UART 9-bit UART mode uses a total of eleven bits per data byte: a start bit, 8 data bits (LSB first), a programma- ble ninth data bit, and a stop bit. The state of the ninth transmit data bit is determined by the value in TB81 (SCON1.3), which is assigned by user software.
  • Page 303: Multiprocessor Communications

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 22.3. Multiprocessor Communications 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;...
  • Page 304: Sfr Definition 22.1. Scon1: Serial Port 1 Control

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 22.1. SCON1: Serial Port 1 Control Reset Value S1MODE MCE1 REN1 TB81 RB81 01000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 Addressable SFR Address: 0x98 SFR Page: Bit7: S1MODE: Serial Port 1 Operation Mode. This bit selects the UART1 Operation Mode. 0: Mode 0: 8-bit UART with Variable Baud Rate 1: Mode 1: 9-bit UART with Variable Baud Rate Bit6:...
  • Page 305: Table 22.1. Timer Settings For Standard Baud Rates

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 22.2. SBUF1: Serial (UART1) Port Data Buffer Reset Value 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 SFR Address: 0x99 SFR Page: Bits7–0: SBUF1[7:0]: Serial Data Buffer Bits 7-0 (MSB-LSB) This SFR accesses two registers; a transmit shift register and a receive latch register. When data is written to SBUF1, it goes to the transmit shift register and is held for serial transmis- sion.
  • Page 306: Table 22.2. Timer Settings For Standard Baud Rates

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Table 22.2. Timer Settings for Standard Baud Rates Using an External 25.0 MHz Oscillator Frequency: 25.0 MHz Target Baud Rate Oscilla- Timer Clock SCA1-SCA0 T1M* Timer 1 Baud Rate % Error tor Divide Source (pre-scale Reload (bps) Factor select)* Value (hex) 230400...
  • Page 307: Table 22.4. Timer Settings For Standard Baud Rates Using The Pll

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Table 22.4. Timer Settings for Standard Baud Rates Using the PLL Frequency: 50.0 MHz Target Baud Rate Oscilla- Timer Clock SCA1-SCA0 T1M* Timer 1 Baud Rate % Error tor Divide Source (pre-scale Reload (bps) Factor select)* Value (hex) 230400 0.45% SYSCLK...
  • Page 308 C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 OTES Rev. 1.4...
  • Page 309: Timers

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 23. Timers Each MCU includes 5 counter/timers: Timer 0 and Timer 1 are 16-bit counter/timers compatible with those found in the standard 8051. Timer 2, Timer 3, and Timer 4 are 16-bit auto-reload and capture counter/tim- ers for use with the ADCs, DACs, square-wave generation, or for general-purpose use. These timers can be used to measure time intervals, count external events and generate periodic interrupt requests.
  • Page 310: Figure 23.1. T0 Mode 0 Block Diagram

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 The C/T0 bit (TMOD.2) selects the counter/timer's clock source. When C/T0 is set to logic 1, high-to-low transitions at the selected Timer 0 input pin (T0) increment the timer register (Refer to Section “18.1. Ports 0 through 3 and the Priority Crossbar Decoder” on page 238 for information on selecting and configuring external I/O pins).
  • Page 311: Mode 1: 16-Bit Counter/Timer

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 23.1.2. Mode 1: 16-bit Counter/Timer 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. 23.1.3.
  • Page 312: Mode 3: Two 8-Bit Counter/Timers (Timer 0 Only)

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 23.1.4. Mode 3: Two 8-bit Counter/Timers (Timer 0 Only) 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, C/T0, GATE0 and TF0.
  • Page 313: Sfr Definition 23.1. Tcon: Timer Control

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 23.1. TCON: Timer Control Reset Value 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 Addressable 0x88 SFR Address: SFR Page: Bit7: TF1: Timer 1 Overflow Flag. Set by hardware when Timer 1 overflows. This flag can be cleared by software but is auto- matically cleared when the CPU vectors to the Timer 1 interrupt service routine.
  • Page 314: Sfr Definition 23.2. Tmod: Timer Mode

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 23.2. TMOD: Timer Mode Reset Value GATE1 C/T1 T1M1 T1M0 GATE0 C/T0 T0M1 T0M0 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 0x89 SFR Address: SFR Page: Bit7: GATE1: Timer 1 Gate Control. 0: Timer 1 enabled when TR1 = 1 irrespective of /INT1 logic level. 1: Timer 1 enabled only when TR1 = 1 AND /INT1 = logic 1.
  • Page 315: Sfr Definition 23.3. Ckcon: Clock Control

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 23.3. CKCON: Clock Control Reset Value SCA1 SCA0 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 0x8E SFR Address: SFR Page: Bits7–5: UNUSED. Read = 000b, Write = don’t care. Bit4: T1M: Timer 1 Clock Select. This select the clock source supplied to Timer 1.
  • Page 316: Sfr Definition 23.5. Tl1: Timer 1 Low Byte

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 23.5. TL1: Timer 1 Low Byte Reset Value 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 0x8B SFR Address: SFR Page: Bits 7–0: TL1: Timer 1 Low Byte. The TL1 register is the low byte of the 16-bit Timer 1. SFR Definition 23.6.
  • Page 317: Timer 2, Timer 3, And Timer 4

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 23.2. Timer 2, Timer 3, and Timer 4 Timers 2, 3, and 4 are 16-bit counter/timers, each formed by two 8-bit SFR’s: TMRnL (low byte) and TMRnH (high byte) where n = 2, 3, and 4 for timers 2, 3, and 4 respectively. Timers 2 and 4 feature auto- reload, capture, and toggle output modes with the ability to count up or down.
  • Page 318: Capture Mode

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 23.2.2. Capture Mode In Capture Mode, Timer 2, 3, and 4 will operate as a 16-bit counter/timer with capture facility. When the Timer External Enable bit (found in the TMRnCN register) is set to ‘1’, a high-to-low transition on the TnEX input pin (Timer 3 shares the T2EX pin with Timer 2) causes the 16-bit value in the associated timer (THn, TLn) to be loaded into the capture registers (RCAPnH, RCAPnL).
  • Page 319: Auto-Reload Mode

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 23.2.3. Auto-Reload Mode In Auto-Reload Mode, the counter/timer can be configured to count up or down and cause an interrupt/flag to occur upon an overflow/underflow event. When counting up, the counter/timer will set its overflow/under- flow flag (TFn) and cause an interrupt (if enabled) upon overflow/underflow, and the values in the Reload/ Capture Registers (RCAPnH and RCAPnL) are loaded into the timer and the timer is restarted.
  • Page 320: Toggle Output Mode (Timer 2 And Timer 4 Only)

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 23.2.4. Toggle Output Mode (Timer 2 and Timer 4 Only) Timers 2 and 4 have the capability to toggle the state of their respective output port pins (T2 or T4) to pro- duce a 50% duty cycle waveform output. The port pin state will change upon the overflow or underflow of the respective timer (depending on whether the timer is counting up or down ).
  • Page 321: Sfr Definition 23.8. Tmrncn: Timer 2, 3, And 4 Control

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 23.8. TMRnCN: Timer 2, 3, and 4 Control Reset Value EXFn EXENn C/Tn CP/RLn 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 Addressable SFR Address: TMR2CN:0xC8;TMR3CN:0xC8;TMR4CN:0xC8 SFR Page: TMR2CN: page 0;TMR3CN: page 1;TMR4CN: page 2 Bit7: TFn: Timer 2, 3, and 4 Overflow/Underflow Flag.
  • Page 322: Sfr Definition 23.9. Tmrncf: Timer 2, 3, And 4 Configuration

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 23.9. TMRnCF: Timer 2, 3, and 4 Configuration Reset Value TnM1 TnM0 TOGn TnOE DCENn 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 SFR Address: TMR2CF:0xC9;TMR3CF:0xC9;TMR4CF:0xC9 SFR Page TMR2CF: page 0;TMR3CF: page 1;TMR4CF: Page 2 Bit7–5: Reserved.
  • Page 323: Sfr Definition 23.10. Rcapnl: Timer 2, 3, And 4 Capture Register Low Byte

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 23.10. RCAPnL: Timer 2, 3, and 4 Capture Register Low Byte Reset Value 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 SFR Address: RCAP2L: 0xCA; RCAP3L: 0xCA; RCAP4L: 0xCA SFR Page: RCAP2L: page 0; RCAP3L: page 1; RCAP4L: page 2 Bits 7–0: RCAP2, 3, and 4L: Timer 2, 3, and 4 Capture Register Low Byte.
  • Page 324: Sfr Definition 23.13. Tmrnh Timer 2, 3, And 4 High Byte

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 23.13. TMRnH Timer 2, 3, and 4 High Byte Reset Value 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 SFR Address: TMR2H: 0xCD; TMR3H: 0xCD; TMR4H: 0xCD SFR Page: TMR2H: page 0; TMR3H: page 1; TMR4H: page 2 Bits 7–0: TH2, 3, and 4: Timer 2, 3, and 4 High Byte.
  • Page 325: Programmable Counter Array

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 24. Programmable Counter Array The Programmable Counter Array (PCA0) provides enhanced timer functionality while requiring less CPU intervention than the standard 8051 counter/timers. PCA0 consists of a dedicated 16-bit counter/timer and six 16-bit capture/compare modules. Each capture/compare module has its own associated I/O line (CEXn) which is routed through the Crossbar to Port I/O when enabled (See Section “18.1.
  • Page 326: Pca Counter/Timer

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 24.1. PCA Counter/Timer The 16-bit PCA counter/timer consists of two 8-bit SFRs: PCA0L and PCA0H. PCA0H is the high byte (MSB) of the 16-bit counter/timer and PCA0L is the low byte (LSB). Reading PCA0L automatically latches the value of PCA0H into a “snapshot” register; the following PCA0H read accesses this “snapshot” register. Reading the PCA0L Register first guarantees an accurate reading of the entire 16-bit PCA0 counter.
  • Page 327 C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Important Note About the PCA0CN Register: If the main PCA counter (PCA0H : PCA0L) overflows during the execution phase of a read-modify-write instruction (bit-wise SETB or CLR, ANL, ORL, XRL) that targets the PCA0CN register, the CF (Counter Overflow) bit will not be set. If the CF flag is used by soft- ware to keep track of counter overflows, the following steps should be taken when performing a bit-wise operation on the PCA0CN register: Step 1.
  • Page 328: Capture/Compare Modules

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 24.2. Capture/Compare Modules 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-Bit Pulse Width Modulator, or 16-Bit Pulse Width Modulator. Each module has Special Function Registers (SFRs) associated with it in the CIP- 51 system controller.
  • Page 329: Edge-Triggered Capture Mode

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Table 24.2. PCA0CPM Register Settings for PCA Capture/Compare Modules PWM16 ECOM CAPP CAPN PWM ECCF Operation Mode Capture triggered by positive edge on CEXn Capture triggered by negative edge on CEXn Capture triggered by transition on CEXn Software Timer High Speed Output Frequency Output 8-Bit Pulse Width Modulator...
  • Page 330: Software Timer (Compare) Mode

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 24.2.2. Software Timer (Compare) Mode In Software Timer mode, the PCA0 counter/timer is compared to the module's 16-bit capture/compare reg- ister (PCA0CPHn and PCA0CPLn). When a match occurs, the Capture/Compare Flag (CCFn) in PCA0CN is set to logic 1 and an interrupt request is generated if CCF interrupts are enabled. The CCFn bit is not automatically cleared by hardware when the CPU vectors to the interrupt service routine, and must be cleared by software.
  • Page 331: High Speed Output Mode

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 24.2.3. High Speed Output Mode 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) Setting the TOGn, MATn, and ECOMn bits in the PCA0CPMn register enables the High- Speed Output mode.
  • Page 332: Frequency Output Mode

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 24.2.4. Frequency Output Mode 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 out- put is toggled. The frequency of the square wave is then defined by Equation 24.1. Equation 24.1.
  • Page 333: 8-Bit Pulse Width Modulator Mode

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 24.2.5. 8-Bit Pulse Width Modulator Mode Each module can be used independently to generate pulse width modulated (PWM) outputs on its associ- ated CEXn pin. The frequency of the output is dependent on the timebase for the PCA0 counter/timer. The duty cycle of the PWM output signal is varied using the module's PCA0CPLn capture/compare register.
  • Page 334: 16-Bit Pulse Width Modulator Mode

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 24.2.6. 16-Bit Pulse Width Modulator Mode Each PCA0 module may also be operated in 16-Bit PWM mode. In this mode, the 16-bit capture/compare module defines the number of PCA0 clocks for the low time of the PWM signal. When the PCA0 counter matches the module contents, the output on CEXn is asserted high;...
  • Page 335: Register Descriptions For Pca0

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 24.3. Register Descriptions for PCA0 Following are detailed descriptions of the special function registers related to the operation of PCA0. SFR Definition 24.1. PCA0CN: PCA Control Reset Value CCF5 CCF4 CCF3 CCF2 CCF1 CCF0 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2...
  • Page 336: Sfr Definition 24.2. Pca0Md: Pca0 Mode

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 24.2. PCA0MD: PCA0 Mode Reset Value CIDL CPS2 CPS1 CPS0 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 SFR Address: 0xD9 SFR Page: Bit7: CIDL: PCA0 Counter/Timer Idle Control. Specifies PCA0 behavior when CPU is in Idle Mode. 0: PCA0 continues to function normally while the system controller is in Idle Mode.
  • Page 337: Sfr Definition 24.3. Pca0Cpmn: Pca0 Capture/Compare Mode

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 24.3. PCA0CPMn: PCA0 Capture/Compare Mode Reset Value PWM16n ECOMn CAPPn CAPNn MATn TOGn PWMn ECCFn 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 PCA0CPM0: 0xDA, PCA0CPM1: 0xDB, PCA0CPM2: 0xDC, PCA0CPM3: 0xDD, PCA0CPM4: 0xDE, Address: PCA0CPM5: 0xDF PCA0CPM0: page 0, PCA0CPM1: page 0, PCA0CPM2: page 0, PCA0CPM3: 0, PCA0CPM4: page 0, SFR Page: PCA0CPM5: page 0...
  • Page 338: Sfr Definition 24.4. Pca0L: Pca0 Counter/Timer Low Byte

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 24.4. PCA0L: PCA0 Counter/Timer Low Byte Reset Value 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 SFR Address: 0xF9 SFR Page: Bits 7–0: PCA0L: PCA0 Counter/Timer Low Byte. The PCA0L register holds the low byte (LSB) of the 16-bit PCA0 Counter/Timer. SFR Definition 24.5.
  • Page 339: Sfr Definition 24.7. Pca0Cphn: Pca0 Capture Module High Byte

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 SFR Definition 24.7. PCA0CPHn: PCA0 Capture Module High Byte Reset Value 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 PCA0CPH0: 0xFC, PCA0CPH1: 0xFD, PCA0CPH2: 0xEA, PCA0CPH3: 0xEC, PCA0CPH4: 0xEE, PCA0CPH5: SFR Address: 0xE2 PCA0CPH0: page 0, PCA0CPH1: page 0, PCA0CPH2: page 0, PCA0CPH3: page 0, PCA0CPH4: page 0, SFR Page: PCA0CPH5: page 0 Bits7–0: PCA0CPHn: PCA0 Capture Module High Byte.
  • Page 340 C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 OTES Rev. 1.4...
  • Page 341: Jtag (Ieee 1149.1)

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 25. JTAG (IEEE 1149.1) Each MCU has an on-chip JTAG interface and logic to support boundary scan for production and in-sys- tem testing, Flash read/write operations, and non-intrusive in-circuit debug. The JTAG interface is fully compliant with the IEEE 1149.1 specification. Refer to this specification for detailed descriptions of the Test Interface and Boundary-Scan Architecture.
  • Page 342: Boundary Scan

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 25.1. Boundary Scan The DR in the Boundary Scan path is an 134-bit shift register. The Boundary DR provides control and observability of all the device pins as well as the SFR bus and Weak Pullup feature via the EXTEST and SAMPLE commands.
  • Page 343: Extest Instruction

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 Table 25.1. Boundary Data Register Bit Definitions (Continued) Action Target 103, 105, 107, Capture P6.n input from pin 109, 111, 113, 115, Update P6.n output to pin 118, 120, 122, Capture P7.n output enable from MCU 124, 126, 128, Update P7.n output enable to pin 130, 132...
  • Page 344: Flash Programming Commands

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 25.2. Flash Programming Commands The Flash memory can be programmed directly over the JTAG interface using the Flash Control, Flash Data, Flash Address, and Flash Scale registers. These Indirect Data Registers are accessed via the JTAG Instruction Register. Read and write operations on indirect data registers are performed by first setting the appropriate DR address in the IR register.
  • Page 345: Jtag Register Definition 25.3. Flashcon: Jtag Flash Control

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 JTAG Register Definition 25.3. FLASHCON: JTAG Flash Control Reset Value SFLE WRMD2 WRMD1 WRMD0 RDMD3 RDMD2 RDMD1 RDMD0 00000000 Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 This register determines how the Flash interface logic will respond to reads and writes to the FLASH- DAT Register.
  • Page 346: Jtag Register Definition 25.4. Flashdat: Jtag Flash Data

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 JTAG Register Definition 25.4. FLASHDAT: JTAG Flash Data Reset Value 0000000000 Bit9 Bit0 This register is used to read or write data to the Flash memory across the JTAG interface. Bits9–2: DATA7–0: Flash Data Byte. Bit1: FAIL: Flash Fail Bit. 0: Previous Flash memory operation was successful.
  • Page 347: Debug Support

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 25.3. Debug Support Each MCU has on-chip JTAG and debug logic that provides non-intrusive, full speed, in-circuit debug sup- port using the production part installed in the end application, via the four pin JTAG I/F. Silicon Labs' debug system supports inspection and modification of memory and registers, breakpoints, and single stepping.
  • Page 348 C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 OTES Rev. 1.4...
  • Page 349: Document Change List

    C8051F120/1/2/3/4/5/6/7 C8051F130/1/2/3 OCUMENT HANGE Revision 1.3 to Revision 1.4 • Added new paragraph tags: SFR Definition and JTAG Register Definition. • Product Selection Guide Table 1.1: Added RoHS-compliant ordering information. • Overview Chapter, Figure 1.8, “On-Chip Memory Map”: Corrected on-chip XRAM size to “8192 Bytes”. •...
  • Page 350: Contact Information

    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.

Table of Contents