27.4.6.1 Timer Synchronized Operation
In Sync operation, the timer can be synchronized with other modules using the synchronization/trigger inputs selected by SYNC[4:0]. Basic operation is shown in Figure 27-24. Whenever the selected Sync input is asserted (high), the timer rolls over to 0000h on the next positive edge of the time base signal.
The timer functions in Synchronized operation when TRIGEN (CCPxCON1[23]) is cleared and
the SYNC[4:0] bits have any value except ‘11111
’. The CCPTRIG bit
(CCPxSTAT[7]) has no function.
Selecting a SYNCx bits value of ‘00000
’ causes the module to run as a
periodic timer with automatic rollover to 0000h when the Timer register matches the
value of CCPxPR. A value of ‘11111
’ rolls over after an overflow from
FFFFh.
For values of the SYNC[4:0] bits other than ‘00000
’ or
‘11111’
, the timer is reset when the input selected by the SYNCx
bits is asserted.
The procedure for configuring the module for Synchronous operation is shown in Setup for Synchronous Operation (16-Bit Dual Timer Mode).
Setup for Synchronous Operation (16-Bit Dual Timer Mode)
CCP1CON1bits.TRIGEN = 0; // Set Sync/Triggered mode (Synchronous Mode)
CCP1CON1bits.SYNC = 0; // rolls over at FFFFh or match
// with period register (self sync)
CCP1CON1bits.T32 = 0; // 16 bit dual timer mode
CCP1CON1bits.TMRSYNC = 0; // Set timebase synchronization (Synchronized)
CCP1CON1bits.CLKSEL = 0; // Set the clock source (Tcy)
CCP1CON1bits.TMRPS = 0; // Set the clock pre-scaler (1:1)
CCP1PR = 0x00000FFF; // 32 bit CCP period register
CCP1CON1bits.CCPON = 1; // Start the Timer