16-bit advanced control timer (TIM1) RM0016
184/449 Doc ID 14587 Rev 8
When the timer is configured in encoder interface mode, it provides information on the
current position of the sensors. Dynamic information, such as speed, acceleration, and
slowdown, can be obtained by measuring the period between two encoder events using a
second timer configured in capture mode. The output of the encoder, which indicates the
mechanical zero, can be used for this purpose. Depending on the time between two events,
the counter can also be read at regular intervals. This can be done by latching the counter
value into a third input capture register, if one is available. In this case, the capture signal
must be periodic and can be generated by another timer.
17.6 TIM1 interrupts
TIM1 has eight interrupt request sources, mapped on 2 interrupt vectors:
● Break interrupt
● Trigger interrupt
● Commutation interrupt
● Capture/compare 4 interrupt
● Capture/compare 3 interrupt
● Capture/compare 2 interrupt
● Capture/compare 1 interrupt
● Update interrupt (example: overflow, underflow, and counter initialization)
To use the interrupt features for each interrupt channel used, set the desired interrupt
enable bits (BIE, TIE, COMIE, CCiIE, and UIE) in the TIM1_IER register to enable interrupt
requests.
The different interrupt sources can also be generated by software using the corresponding
bits in the TIM1_EGR register.