MAX32665-MAX32668 User Guide
Maxim Integrated Page 343 of 457
16.10.1 Gated Mode Timer Period
The timer period ends when TMRn_CNT = TMRn_CMP and the timer automatically performs the following actions:
1. TMRn_CNT is reset to 0x0000 0001. The timer remains enabled and continues incrementing.
2. The timer interrupt bit TMRn_INT.irq will be set. An interrupt will be generated if enabled.
16.10.2 Gated Mode Configuration
Configure the timer for Gated mode by doing the following:
1. Set TMRn_CN.ten = 0 to disable the timer.
2. Set TMRn_CN.tmode to 110b to select Gated mode.
3. Set TMRn_CN.pres3:TMRn_CN.pres to set the prescaler that determines the timer frequency.
4. Configure the timer pin:
a. Configure the pin as a timer input and configure the electrical characteristics as needed.
b. Set TMRn_CN.tpol to match the desired initial (inactive) state.
5. If using the timer interrupt, enable the interrupt and set the interrupt priority.
6. Write an initial value to TMRn_CNT, if desired. This effects only the first period; subsequent timer periods always
reset TMRn_CNT = 0x0000 0001.
7. Write the compare value to TMRn_CMP.
8. Set TMRn_CN.ten = 1 to enable the timer.