- No category
advertisement
C8051F060/1/2/3/4/5/6/7
24.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. TL0 can use either the system clock or an external input signal as its timebase. The TH0 register is restricted to a timer function sourced by the system clock or prescaled clock. TH0 is enabled using the
Timer 1 run control bit TR1. TH0 sets the Timer 1 overflow flag TF1 on overflow and thus controls the
Timer 1 interrupt.
Timer 1 is inactive in Mode 3. When Timer 0 is operating in Mode 3, Timer 1 can be operated in Modes 0,
1 or 2, but cannot be clocked by external signals nor set the TF1 flag and generate an interrupt. However, the Timer 1 overflow can be used to generate baud rates for the SMBus and/or UART, and/or initiate ADC conversions. While Timer 0 is operating in Mode 3, Timer 1 run control is handled through its mode settings. To run Timer 1 while Timer 0 is in Mode 3, set the Timer 1 Mode as 0, 1, or 2. To disable Timer 1, configure it for Mode 3.
Pre-scaled Clock
SYSCLK
Figure 24.3. T0 Mode 3 Block Diagram
CKCON
T T
1
M
0
M
C
A
1
S S
C
A
0
TMOD
G
A
T
E
1
C
/
T
1
T
1
T
1
M
1
M
0
G
A
T
E
0
C
/
T
0
T
0
T
0
M
1
M
0
0
TR1
TH0
(8 bits)
1
0
TF1
TR1
TF0
TR0
IE1
IT1
IE0
IT0
Interrupt
Interrupt
1
T0
TL0
(8 bits)
TR0
Crossbar
GATE0
/INT0
290 Rev. 1.2
C8051F060/1/2/3/4/5/6/7
Figure 24.4. TCON: Timer Control Register
Bit7:
Bit6:
Bit5:
Bit4:
Bit3:
Bit2:
Bit1:
Bit0:
R/W
TF1
Bit7
R/W
TR1
Bit6
R/W
TF0
Bit5
R/W
TR0
Bit4
R/W
IE1
Bit3
R/W
IT1
Bit2
R/W
IE0
Bit1
R/W
IT0
Reset Value
00000000
Bit0
Bit
Addressable
SFR Address:
0x88
SFR Page: 0
TF1: Timer 1 Overflow Flag.
Set by hardware when Timer 1 overflows. This flag can be cleared by software but is automatically cleared when the CPU vectors to the Timer 1 interrupt service routine.
0: No Timer 1 overflow detected.
1: Timer 1 has overflowed.
TR1: Timer 1 Run Control.
0: Timer 1 disabled.
1: Timer 1 enabled.
TF0: Timer 0 Overflow Flag.
Set by hardware when Timer 0 overflows. This flag can be cleared by software but is automatically cleared when the CPU vectors to the Timer 0 interrupt service routine.
0: No Timer 0 overflow detected.
1: Timer 0 has overflowed.
TR0: Timer 0 Run Control.
0: Timer 0 disabled.
1: Timer 0 enabled.
IE1: External Interrupt 1.
This flag is set by hardware when an edge/level of type defined by IT1 is detected. It can be cleared by software but is automatically cleared when the CPU vectors to the External Interrupt 1 service routine if IT1 = 1. This flag is the inverse of the /INT1 signal.
IT1: Interrupt 1 Type Select.
This bit selects whether the configured /INT1 interrupt will be falling-edge sensitive or active-low.
0: /INT1 is level triggered, active-low.
1: /INT1 is edge triggered, falling-edge.
IE0: External Interrupt 0.
This flag is set by hardware when an edge/level of type defined by IT0 is detected. It can be cleared by software but is automatically cleared when the CPU vectors to the External Interrupt 0 service routine if IT0 = 1. This flag is the inverse of the /INT0 signal.
IT0: Interrupt 0 Type Select.
This bit selects whether the configured /INT0 interrupt will be falling-edge sensitive or active-low.
0: /INT0 is level triggered, active logic-low.
1: /INT0 is edge triggered, falling-edge.
Rev. 1.2
291
C8051F060/1/2/3/4/5/6/7
Figure 24.5. TMOD: Timer Mode Register
R/W
GATE1
Bit7
R/W
C/T1
Bit6
R/W
T1M1
Bit5
R/W
T1M0
Bit4
R/W
GATE0
Bit3
R/W
C/T0
Bit2
R/W
T0M1
Bit1
R/W
T0M0
Bit0
Reset Value
00000000
SFR Address:
0x89
SFR Page: 0
Bit7:
Bit6:
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.
C/T1: Counter/Timer 1 Select.
0: Timer Function: Timer 1 incremented by clock defined by T1M bit (CKCON.4).
1: Counter Function: Timer 1 incremented by high-to-low transitions on external input pin
(T1).
Bits5-4: T1M1-T1M0: Timer 1 Mode Select.
These bits select the Timer 1 operation mode.
T1M1
0
0
1
1
T1M0
0
1
0
1
Mode
Mode 0: 13-bit counter/timer
Mode 1: 16-bit counter/timer
Mode 2: 8-bit counter/timer with autoreload
Mode 3: Timer 1 inactive
Bit3:
Bit2:
GATE0: Timer 0 Gate Control.
0: Timer 0 enabled when TR0 = 1 irrespective of /INT0 logic level.
1: Timer 0 enabled only when TR0 = 1 AND /INT0 = logic 1.
C/T0: Counter/Timer Select.
0: Timer Function: Timer 0 incremented by clock defined by T0M bit (CKCON.3).
1: Counter Function: Timer 0 incremented by high-to-low transitions on external input pin
(T0).
Bits1-0: T0M1-T0M0: Timer 0 Mode Select.
These bits select the Timer 0 operation mode.
T0M1
0
0
1
1
T0M0
0
1
0
1
Mode
Mode 0: 13-bit counter/timer
Mode 1: 16-bit counter/timer
Mode 2: 8-bit counter/timer with autoreload
Mode 3: Two 8-bit counter/timers
292 Rev. 1.2
C8051F060/1/2/3/4/5/6/7
Figure 24.6. CKCON: Clock Control Register
R/W
-
Bit7
R/W
-
Bit6
R/W
-
Bit5
R/W
T1M
Bit4
R/W
T0M
Bit3
R/W
-
Bit2
R/W
SCA1
Bit1
R/W
SCA0
Reset Value
00000000
Bit0
SFR Address:
0x8E
SFR Page: 0
Bits7-5: UNUSED. Read = 000b, Write = don’t care.
Bit4: T1M: Timer 1 Clock Select.
This select the clock source supplied to Timer 1. T1M is ignored when C/T1 is set to logic 1.
0: Timer 1 uses the clock defined by the prescale bits, SCA1-SCA0.
Bit3:
1: Timer 1 uses the system clock.
T0M: Timer 0 Clock Select.
This bit selects the clock source supplied to Timer 0. T0M is ignored when C/T0 is set to logic 1.
0: Counter/Timer 0 uses the clock defined by the prescale bits, SCA1-SCA0.
1: Counter/Timer 0 uses the system clock.
Bit2: UNUSED. Read = 0b, Write = don’t care.
Bits1-0: SCA1-SCA0: Timer 0/1 Prescale Bits
These bits control the division of the clock supplied to Timer 0 and/or Timer 1 if configured to use prescaled clock inputs.
SCA1
0
0
1
1
SCA0
0
1
0
1
Prescaled Clock
System clock divided by 12
System clock divided by 4
System clock divided by 48
External clock divided by 8†
†Note: External clock divided by 8 is synchronized with the system clock, and external clock must be less than or equal to the system clock frequency to operate the timer in this mode.
Rev. 1.2
293
C8051F060/1/2/3/4/5/6/7
R/W
Bit7
R/W
Bit6
R/W
Bit5
Figure 24.7. TL0: Timer 0 Low Byte
R/W
Bit4
R/W
Bit3
R/W
Bit2
R/W
Bit1
R/W Reset Value
00000000
Bit0
SFR Address:
0x8A
SFR Page: 0
Bits 7-0: TL0: Timer 0 Low Byte.
The TL0 register is the low byte of the 16-bit Timer 0
R/W
Bit7
R/W
Bit6
R/W
Bit5
Figure 24.8. TL1: Timer 1 Low Byte
R/W
Bit4
R/W
Bit3
R/W
Bit2
R/W
Bit1
R/W Reset Value
00000000
Bit0
SFR Address:
0x8B
SFR Page: 0
Bits 7-0: TL1: Timer 1 Low Byte.
The TL1 register is the low byte of the 16-bit Timer 1.
Figure 24.9. TH0: Timer 0 High Byte
R/W
Bit7
R/W
Bit6
R/W
Bit5
R/W
Bit4
R/W
Bit3
R/W
Bit2
Bits 7-0: TH0: Timer 0 High Byte.
The TH0 register is the high byte of the 16-bit Timer 0.
Figure 24.10. TH1: Timer 1 High Byte
R/W
Bit1
R/W Reset Value
00000000
Bit0
SFR Address:
0x8C
SFR Page: 0
R/W
Bit7
R/W
Bit6
R/W
Bit5
R/W
Bit4
R/W
Bit3
R/W
Bit2
R/W
Bit1
R/W Reset Value
00000000
Bit0
SFR Address:
0x8D
SFR Page: 0
Bits 7-0: TH1: Timer 1 High Byte.
The TH1 register is the high byte of the 16-bit Timer 1.
294 Rev. 1.2
advertisement
Related manuals
advertisement
Table of contents
- 7 C8051F
- 19 1. System Overview
- 25 1.1. CIP-51™ Microcontroller Core
- 25 1.1.1. Fully 8051 Compatible
- 25 1.1.2. Improved Throughput
- 26 1.1.3. Additional Features
- 27 1.2. On-Chip Memory
- 28 1.3. JTAG Debug and Boundary Scan
- 29 1.4. Programmable Digital I/O and Crossbar
- 30 1.5. Programmable Counter Array
- 31 1.6. Controller Area Network
- 32 1.7. Serial Ports
- 33 1.8. 16-Bit Analog to Digital Converters
- 34 1.9. 10-Bit Analog to Digital Converter
- 35 1.10.12-bit Digital to Analog Converters
- 36 1.11.Analog Comparators
- 37 2. Absolute Maximum Ratings
- 38 3. Global DC Electrical Characteristics
- 39 4. Pinout and Package Definitions
- 51 5. 16-Bit ADCs (ADC0 and ADC1)
- 52 5.1. Single-Ended or Differential Operation
- 52 5.1.1. Pseudo-Differential Inputs
- 53 5.2. Voltage Reference
- 54 5.3. ADC Modes of Operation
- 54 5.3.1. Starting a Conversion
- 54 5.3.2. Tracking Modes
- 56 5.3.3. Settling Time Requirements
- 66 5.4. Calibration
- 69 5.5. ADC0 Programmable Window Detector
- 75 6. Direct Memory Access Interface (DMA0)
- 75 6.1. Writing to the Instruction Buffer
- 76 6.2. DMA0 Instruction Format
- 76 6.3. XRAM Addressing and Setup
- 77 6.4. Instruction Execution in Mode
- 78 6.5. Instruction Execution in Mode
- 79 6.6. Interrupt Sources
- 79 6.7. Data Buffer Overflow Warnings and Errors
- 87 7. 10-Bit ADC (ADC2, C8051F060/1/2/3)
- 88 7.1. Analog Multiplexer
- 89 7.2. Modes of Operation
- 89 7.2.1. Starting a Conversion
- 90 7.2.2. Tracking Modes
- 91 7.2.3. Settling Time Requirements
- 7 C8051F
- 97 7.3. Programmable Window Detector
- 99 7.3.1. Window Detector In Single-Ended Mode
- 100 7.3.2. Window Detector In Differential Mode
- 103 8. DACs, 12-Bit Voltage Mode (DAC0 and DAC1, C8051F060/1/2/3)
- 104 8.1. DAC Output Scheduling
- 104 8.1.1. Update Output On-Demand
- 104 8.1.2. Update Output Based on Timer Overflow
- 104 8.2. DAC Output Scaling/Justification
- 111 9. Voltage Reference 2 (C8051F060/2)
- 113 10. Voltage Reference 2 (C8051F061/3)
- 115 11. Voltage Reference 2 (C8051F064/5/6/7)
- 117 12. Comparators
- 119 12.1.Comparator Inputs
- 123 13. CIP-51 Microcontroller
- 125 13.1.Instruction Set
- 125 13.1.1.Instruction and CPU Timing
- 125 13.1.2.MOVX Instruction and Program Memory
- 130 13.2.Memory Organization
- 130 13.2.1.Program Memory
- 131 13.2.2.Data Memory
- 131 13.2.3.General Purpose Registers
- 131 13.2.4.Bit Addressable Locations
- 131 13.2.5.Stack
- 132 13.2.6.Special Function Registers
- 132 13.2.6.1.SFR Paging
- 132 13.2.6.2.Interrupts and SFR Paging
- 134 13.2.6.3.SFR Page Stack Example
- 148 13.2.7.Register Descriptions
- 151 13.3.Interrupt Handler
- 151 13.3.1.MCU Interrupt Sources and Vectors
- 151 13.3.2.External Interrupts
- 153 13.3.3.Interrupt Priorities
- 153 13.3.4.Interrupt Latency
- 154 13.3.5.Interrupt Register Descriptions
- 160 13.4.Power Management Modes
- 160 13.4.1.Idle Mode
- 161 13.4.2.Stop Mode
- 163 14. Reset Sources
- 164 14.1.Power-on Reset
- 164 14.2.Power-fail Reset
- 164 14.3.External Reset
- 165 14.4.Missing Clock Detector Reset
- 165 14.5.Comparator0 Reset
- 165 14.6.External CNVSTR2 Pin Reset
- 165 14.7.Watchdog Timer Reset
- 7 C8051F
- 166 14.7.1.Enable/Reset WDT
- 166 14.7.2.Disable WDT
- 166 14.7.3.Disable WDT Lockout
- 166 14.7.4.Setting WDT Interval
- 171 15. Oscillators
- 171 15.1.Programmable Internal Oscillator
- 173 15.2.External Oscillator Drive Circuit
- 173 15.3.System Clock Selection
- 175 15.4.External Crystal Example
- 175 15.5.External RC Example
- 175 15.6.External Capacitor Example
- 177 16. Flash Memory
- 177 16.1.Programming The Flash Memory
- 178 16.2.Non-volatile Data Storage
- 179 16.3.Security Options
- 183 16.3.1.Summary of Flash Security Options
- 187 17. External Data Memory Interface and On-Chip XRAM
- 187 17.1.Accessing XRAM
- 187 17.1.1.16-Bit MOVX Example
- 187 17.1.2.8-Bit MOVX Example
- 188 17.2.Configuring the External Memory Interface
- 188 17.3.Port Selection and Configuration
- 190 17.4.Multiplexed and Non-multiplexed Selection
- 190 17.4.1.Multiplexed Configuration
- 191 17.4.2.Non-multiplexed Configuration
- 192 17.5.Memory Mode Selection
- 192 17.5.1.Internal XRAM Only
- 192 17.5.2.Split Mode without Bank Select
- 193 17.5.3.Split Mode with Bank Select
- 193 17.5.4.External Only
- 194 17.6.Timing
- 196 17.6.1.Non-multiplexed Mode
- 196 17.6.1.1.16-bit MOVX: EMI0CF[4:2] = ‘101’, ‘110’, or
- 197 17.6.1.2.8-bit MOVX without Bank Select: EMI0CF[4:2] = ‘101’ or
- 198 17.6.1.3.8-bit MOVX with Bank Select: EMI0CF[4:2]
- 199 17.6.2.Multiplexed Mode
- 199 17.6.2.1.16-bit MOVX: EMI0CF[4:2] = ‘001’, ‘010’, or
- 200 17.6.2.2.8-bit MOVX without Bank Select: EMI0CF[4:2] = ‘001’ or
- 201 17.6.2.3.8-bit MOVX with Bank Select: EMI0CF[4:2]
- 203 18. Port Input/Output
- 205 18.1.Ports 0 through 3 and the Priority Crossbar Decoder
- 205 18.1.1.Crossbar Pin Assignment and Allocation
- 206 18.1.2.Configuring the Output Modes of the Port Pins
- 207 18.1.3.Configuring Port Pins as Digital Inputs
- 207 18.1.4.Weak Pull-ups
- 7 C8051F
- 207 18.1.5.Configuring Port 1 and 2 pins as Analog Inputs
- 208 18.1.6.Crossbar Pin Assignment Example
- 219 18.2.Ports 4 through 7 (C8051F060/2/4/6 only)
- 219 18.2.1.Configuring Ports which are not Pinned Out
- 219 18.2.2.Configuring the Output Modes of the Port Pins
- 219 18.2.3.Configuring Port Pins as Digital Inputs
- 219 18.2.4.Weak Pull-ups
- 220 18.2.5.External Memory Interface
- 225 19. Controller Area Network (CAN0, C8051F060/1/2/3)
- 227 19.1.Bosch CAN Controller Operation
- 228 19.2.CAN Registers
- 228 19.2.1.CAN Controller Protocol Registers
- 228 19.2.2.Message Object Interface Registers
- 228 19.2.3.Message Handler Registers
- 229 19.2.4.CIP-51 MCU Special Function Registers
- 229 19.2.6.CAN0ADR Autoincrement Feature
- 235 20. System Management BUS / I2C BUS (SMBUS0)
- 236 20.1.Supporting Documents
- 236 20.2.SMBus Protocol
- 237 20.2.1.Arbitration
- 237 20.2.2.Clock Low Extension
- 237 20.2.3.SCL Low Timeout
- 237 20.2.4.SCL High (SMBus Free) Timeout
- 238 20.3.SMBus Transfer Modes
- 238 20.3.1.Master Transmitter Mode
- 238 20.3.2.Master Receiver Mode
- 239 20.3.3.Slave Transmitter Mode
- 239 20.3.4.Slave Receiver Mode
- 241 20.4.SMBus Special Function Registers
- 241 20.4.1.Control Register
- 244 20.4.2.Clock Rate Register
- 245 20.4.3.Data Register
- 245 20.4.4.Address Register
- 246 20.4.5.Status Register
- 251 21. Enhanced Serial Peripheral Interface (SPI0)
- 252 21.1.Signal Descriptions
- 252 21.1.1.Master Out, Slave In (MOSI)
- 252 21.1.2.Master In, Slave Out (MISO)
- 252 21.1.3.Serial Clock (SCK)
- 252 21.1.4.Slave Select (NSS)
- 253 21.2.SPI0 Master Mode Operation
- 255 21.3.SPI0 Slave Mode Operation
- 255 21.4.SPI0 Interrupt Sources
- 7 C8051F
- 256 21.5.Serial Clock Timing
- 258 21.6.SPI Special Function Registers
- 265 22. UART
- 266 22.1.UART0 Operational Modes
- 266 22.1.1.Mode 0: Synchronous Mode
- 267 22.1.2.Mode 1: 8-Bit UART, Variable Baud Rate
- 269 22.1.3.Mode 2: 9-Bit UART, Fixed Baud Rate
- 270 22.1.4.Mode 3: 9-Bit UART, Variable Baud Rate
- 271 22.2.Multiprocessor Communications
- 271 22.2.1.Configuration of a Masked Address
- 271 22.2.2.Broadcast Addressing
- 272 22.3.Frame and Transmission Error Detection
- 277 23. UART
- 278 23.1.Enhanced Baud Rate Generation
- 279 23.2.Operational Modes
- 279 23.2.1.8-Bit UART
- 280 23.2.2.9-Bit UART
- 281 23.3.Multiprocessor Communications
- 287 24. Timers
- 287 24.1.Timer 0 and Timer
- 287 24.1.1.Mode 0: 13-bit Counter/Timer
- 289 24.1.2.Mode 1: 16-bit Counter/Timer
- 289 24.1.3.Mode 2: 8-bit Counter/Timer with Auto-Reload
- 290 24.1.4.Mode 3: Two 8-bit Counter/Timers (Timer 0 Only)
- 295 24.2.Timer 2, Timer 3, and Timer
- 295 24.2.1.Configuring Timer 2, 3, and 4 to Count Down
- 296 24.2.2.Capture Mode
- 297 24.2.3.Auto-Reload Mode
- 298 24.2.4.Toggle Output Mode
- 303 25. Programmable Counter Array
- 304 25.1.PCA Counter/Timer
- 305 25.2.Capture/Compare Modules
- 306 25.2.1.Edge-triggered Capture Mode
- 307 25.2.2.Software Timer (Compare) Mode
- 308 25.2.3.High Speed Output Mode
- 309 25.2.4.Frequency Output Mode
- 310 25.2.5.8-Bit Pulse Width Modulator Mode
- 311 25.2.6.16-Bit Pulse Width Modulator Mode
- 312 25.3.Register Descriptions for PCA
- 317 26. JTAG (IEEE 1149.1)
- 318 26.1.Boundary Scan
- 321 26.1.1.EXTEST Instruction
- 321 26.1.2.SAMPLE Instruction
- 321 26.1.3.BYPASS Instruction
- 321 26.1.4.IDCODE Instruction
- 318 C8051F
- 318 C8051F