SPRUIM2H May 2020 – October 2023 AM2431 , AM2432 , AM2434 , AM6411 , AM6412 , AM6421 , AM6422 , AM6441 , AM6442
In this example, the ECAP module is configured to operate as a PWM generator. Here a very simple single channel PWM waveform is generated from output pin APWMn. The PWM polarity is active high, which means that the compare value (CAP2 reg is now a compare register) represents the on-time (high level) of the period. Alternatively, if the APWMPOL bit is configured for active low, then the compare value represents the off-time.
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 |