![Texas Instruments AM1808 Technical Reference Manual Download Page 443](http://html.mh-extra.com/html/texas-instruments/am1808/am1808_technical-reference-manual_1094558443.webp)
Applications
443
SPRUH82C – April 2013 – Revised September 2016
Copyright © 2013–2016, Texas Instruments Incorporated
Enhanced Capture (eCAP) Module
Table 15-5. ECAP Initialization for APWM Mode
Register
Bit
Value
CAP1
CAP1
0x1000
CTRPHS
CTRPHS
0x0
ECCTL2
CAP_APWM
EC_APWM_MODE
ECCTL2
APWMPOL
EC_ACTV_HI
ECCTL2
SYNCI_EN
EC_DISABLE
ECCTL2
SYNCO_SEL
EC_SYNCO_DIS
ECCTL2
TSCTRSTOP
EC_RUN
Example 15-5. Code Snippet for APWM Mode
// Code snippet for APWM mode Example 1
// Run Time (Instant 1, e.g. ISR call)
//======================
ECAPxRegs.CAP2 = 0x300;
// Set Duty cycle i.e. compare value
// Run Time (Instant 2, e.g. another ISR call)
//======================
ECAPxRegs.CAP2 = 0x500;
// Set Duty cycle i.e. compare value
15.3.5.2
Multichannel PWM Generation with Synchronization Example
takes advantage of the synchronization feature between eCAP modules. Here 4 independent
PWM channels are required with different frequencies, but at integer multiples of each other to avoid
"beat" frequencies. Hence one eCAP module is configured as the Master and the remaining 3 are Slaves
all receiving their synch pulse (CTR = PRD) from the master. Note the Master is chosen to have the lower
frequency (F1 = 1/20,000) requirement. Here Slave2 Freq = 2 × F1, Slave3 Freq = 4 × F1 and Slave4
Freq = 5 × F1. Note here values are in decimal notation. Also, only the APWM1 output waveform is
shown.