006 Timer Interruption (STLink STM32CubeIDE HAL Drivers Interrupcion de Timer)

Опубликовано: 15 Октябрь 2024
на канале: Super Micros
690
14

DESCRIPCIÓN:

Programando el Timer 10 de la STM32F429 Discovery, se calcula el periodo y prescaler para tener una interrupcion cada 1 ms, ademas usamos el boton para detener las interrupciones del timer cuando no esta en One pulse Mode.

Code : https://drive.google.com/open?id=10fR...

Example for Interruption of a Timer
For 1 mS

time= 1 mS
Frequency of 1 mS = 1 KHz

We need know what is the frequency of the timer to
configure, consult the Reference Manual of
the STM32 procesessor that you are working.

In this case the frequency is 180 MHz

so the FreqReq that we need is:
FreqReq = 180 000 000 / 1000 (1Khz of 1000 mS)
FreqReq = 180 000

Period and Prescaler are 2 register of
16 bit (0-65535)

Formula

FreqReq = Period x Prescaler;

if I asume Period = 100 (Could asume a number
into 0 - 65535)

so Prescaler = FreqReq / Period;
Prescaler = 180 000 / 100
Prescaler = 1800