5.3.1 Timer/Counter (TC)

The PIC16F, PIC18F and PIC32CM Timer/Counter peripherals are utilized for timing, waveform generation, input capture, and event handling. These MCUs support multiple timer types with varying features for precise timing and waveform control.

While PIC32CM has timer modules that offer most of these features, both PIC16F and PIC18F require additional peripherals for capture/compare (CCP/ECCP) and waveform generation (CCP/ECCP/PWM). Newer PIC18F devices also feature PWMs that do not require external timers. Table 5-11 provides a comparison of features between PIC16F, PIC18F and PIC32CM.

Table 5-11. PIC16F, PIC18F and PIC32CM Timer Features
FeaturePIC16F TimersPIC18F TimersPIC32CM Timers
Timer Variants

Timer0 (8-bit)

Timer1/3/5 (16-bit)

Timer2/4/6/8/12 (8-bit)

Signal Measurement Timer (SMT)

Timer0 (8-bit)

Timer1/3/5 (16-bit)

Timer2/4/6/8/12 (8-bit)

Signal Measurement Timer (SMT)

Universal Timer (UTMR)

Timer/Counter (TC, 16/32-bit)

Timer/Counter for Control (TCC)

Resolution 8-bit, 16-bit, 24-bit (SMT),8-bit, 16-bit, 24-bit (SMT), 32-bit (cascaded UTMR)8-bit, 16-bit, or 32-bit (selectable)
PrescalerProgrammableProgrammableProgrammable
Capture/Compare ChannelsCCP/ECCPUp to seven (through CCP/ECCP)Up to four
PWM GenerationThrough (Enhanced) Capture/Compare/PWM - (E)CCP stand-alone PWMsThrough (Enhanced) Capture/Compare/PWM - (E)CCP stand-alone PWMsThrough TCx, TCC
PWM ModesStandard Enhanced (Half/Full-Bridge) Steering Standard Enhanced (Half/Full-Bridge) Steering Single/Dual-Slope
Special ModesSMT for relative timingHardware Limit Timer (HLT) for fault detection

SMT for relative timing

UTMR chaining

Circular buffer, multiple output events
Signal MeasurementSMT SMT and UTMRFrequency Meter, advanced TC
BufferingDouble buffering for PWM duty cycle onlyDouble buffering for PWM duty cycle onlyDouble-buffered period/compare/capture
Fault ProtectionAuto-shutdown/RestartAuto-shutdown/RestartRecoverable/non-recoverable fault sources
Event System N/AInter-peripheral triggering through Signal Routing Port (SRPORT) for newer devicesIntegrated for input/output events, synchronization
Direct Memory Access (DMA)N/ASupportedSupported
Interrupts

Overflow

Compare Match

Input Capture

Gate Event

Overflow

Compare match

Input capture

Gate Event

Overflow

Compare match

Input capture

Error

Fault

Waveform Extensions Through Complementary Output Generator (COG)Through Complementary Waveform Generator (CWG)Timer Counter for Control Applications (TCC)
RTC/ Calendar TimerUsing TMR1Using TMR1 or a dedicated RTCC moduleDedicated RTC module