SPRUIV7B May 2022 – September 2023 AM620-Q1 , AM623 , AM625 , AM625-Q1 , AM625SIP
The following sections will provide applications examples and code snippets to show how to configure and operate the ECAP module. For clarity and ease of use, below are useful #defines which will help in the understanding of the examples.
// ECCTL1 ( ECAP Control Reg 1)
//==========================
// CAPxPOL bits
#defineEC_RISING 0x0
#defineEC_FALLING 0x1
// CTRRSTx bits
#defineEC_ABS_MODE 0x0
#defineEC_DELTA_MODE 0x1
// PRESCALE bits
#defineEC_BYPASS 0x0
#defineEC_DIV1 0x0
#defineEC_DIV2 0x1
#defineEC_DIV4 0x2
#defineEC_DIV6 0x3
#defineEC_DIV8 0x4
#defineEC_DIV10 0x5
// ECCTL2 ( ECAP Control Reg 2)
//==========================
// CONT/ONESHOT bit
#defineEC_CONTINUOUS 0x0
#defineEC_ONESHOT 0x1
// STOPVALUE bit
#defineEC_EVENT1 0x0
#defineEC_EVENT2 0x1
#defineEC_EVENT3 0x2
#defineEC_EVENT4 0x3
// RE-ARM bit
#defineEC_ARM 0x1
// TSCTRSTOP bit
#defineEC_FREEZE 0x0
#defineEC_RUN 0x1
// SYNCO_SEL bit
#defineEC_SYNCIN 0x0
#defineEC_CTR_PRD 0x1
#defineEC_SYNCO_DIS 0x2
// CAP/APWM mode bit
#defineEC_CAP_MODE 0x0
#defineEC_APWM_MODE 0x1
// APWMPOL bit
#defineEC_ACTV_HI 0x0
#defineEC_ACTV_LO 0x1
// Generic
#defineEC_DISABLE 0x0
#defineEC_ENABLE 0x1
#defineEC_FORCE 0x1