Configuration of a timer to generate a positive pulse in Output Compare mode with a length of tPULSE and after a delay of tDELAY. This example is based on the STM32C0xx TIM LL API. The peripheral initialization uses LL initialization function to demonstrate LL Init.
The pulse is generated on OC1.
This example uses 2 timer instances:
___
User push-button _____________________| |___________________________________
__________
OC1 (TIM1_CH1) _________________________________| |_____________
<----50us----><----50us---->
| |_ uwMeasuredPulseLength
|__uwMeasuredDelay
TIM1_CH1 delay and pulse length are measured every time a pulse is generated. Both can be observed through the debugger by monitoring the variables uwMeasuredDelay and uwMeasuredPulseLength respectively.
___
TITI2 ((TIM2_CH2)) __________________| |___________________________________
_________________
OC1 (TIM2_CH1) _________________________________| |_______________
<-------2s-------><-----------3s------------>
Both TIM1 and TIM2 are configured to generate a single pulse (timer counter stops automatically at the next update event (UEV).
Connecting TIM1 OC1 to TIM2 TI2 allows to trigger TIM2 counter by pressing the User push-button.
Timers, Output, signals, One Pulse, PWM, Oscilloscope, External signal, Autoreload, Waveform
This example runs on STM32C071RBTx devices.
This example has been tested with NUCLEO-H563ZI board and can be easily tailored to any other supported device and development board.
NUCLEO-C071RB Set-up:
In order to make the program work, you must do the following :