![Maxim Integrated MAX32660 Скачать руководство пользователя страница 121](http://html1.mh-extra.com/html/maxim-integrated/max32660/max32660_user-manual_1744484121.webp)
MAX32660 User Guide
Maxim Integrated
Page 121 of 195
10.11
Capture/Compare Mode (111b)
In Capture/Compare mode, the timer starts counting after the first external timer input transition occurs. The transition, a
rising edge or falling edge on the
tim r’s
input signal, is set using the
.tpol
bit.
Each subsequent transition, after the first transition of the timer input signal, captures the
the
register (capture event). When a capture event occurs, a timer interrupt is generated, the
value is reset to 0x0000 0001, and the timer resumes counting.
If no capture event occurs, the timer counts up to the
value. At the end of the cycle where the
equals the
value, a timer interrupt is generated, the
T value is reset to 0x0000 0001, and the timer
resumes counting.
10.11.1
Timer Period
The timer period ends when the selected transition occurs on the timer pin, or on the clock cycle following
The timer peripheral automatically performs the following actions at the end of the timer period:
If the end of the timer period was caused by a transition on the timer pin:
1.
is copied to
2.
is reset to 0x0000 0001. The timer remains enabled and continues incrementing.
3.
The timer interrupt bit,
.irq
, is set. A Timer IRQ is generated, if enabled.
4.
If the end of the timer period was caused by a transition on the timer pin:
a.
is reset to 0x0000 0001.
b.
The timer remains enabled and continues incrementing.
5.
The timer interrupt bit
.irq
will be set. An interrupt is generated, if enabled.
10.11.2
Configuration
Configure the timer for Capture/Compare mode by doing the following:
1.
Set
.ten
= 0 to disable the timer.
2.
Set
.tmode
to 111b to select Capture/Compare mode.
3.
Set
.pres3
.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
.tpol
to select the positive edge (
.tpol
= 0) or negative edge (
.tpol
= 0)
transition causes the capture event.
5.
If using the timer interrupt, enable the interrupt and set the interrupt priority.
6.
, if desired. This effects only the first period; subsequent timer periods always
reset
= 0x0000 0001.
7.
Set
.ten
to 1 to enable the timer. Counting starts after the fir
st transiti n f th tim r’s input signal.
interrupt is generated by the first transition of the input signal.
In Capture/Compare mode, the elapsed time from the timer start to the capture event is calculated using the following
equation:
Equation 10-9: Capture Mode Elapsed Time
𝐶𝑎𝑝𝑡𝑢𝑟𝑒 𝑒𝑙𝑎𝑝𝑠𝑒𝑑 𝑡𝑖𝑚𝑒 𝑖𝑛 𝑠𝑒𝑐𝑜𝑛𝑑𝑠 =
𝑇𝑀𝑅_𝑃𝑊𝑀 − 𝑇𝑀𝑅_𝐶𝑁𝑇
𝐼𝑁𝐼𝑇𝐼𝐴𝐿_𝐶𝑁𝑇_𝑉𝐴𝐿𝑈𝐸
𝑓
𝐶𝑁𝑇_𝐶𝐿𝐾
(𝐻𝑧)
Содержание MAX32660
Страница 4: ...MAX32660 User Guide Maxim Integrated Page 4 of 195 8 UART 84 9 Real Time Clock RTC 96 10 Timers 105...
Страница 7: ...MAX32660 User Guide Maxim Integrated Page 7 of 195 15 Trademarks 195 16 Revision History 195...
Страница 14: ...MAX32660 User Guide Maxim Integrated Page 14 of 195 Figure 2 1 MAX32660 High Level Block Diagram...