cancel
Showing results for 
Search instead for 
Did you mean: 

Long timer interrupt periods

Indois
Associate II

Hello,

I would like to have timer interrupts every 10 minutes for temperature readings. Also, I would like to have opportunity to change this period in the code. How could such long period be implemented? Are there any examples? I am using STM32L011F4 MCU and STM32CubeIDE environment.

Thank you.

11 REPLIES 11

> But if I use counting, it will act like delay which results in blocking the program.

No.

Simply setup up the timer for the 1 minute period, enable it, enable interrupt, and set a global variable to 10. In the ISR, decrement that global variable, and once it reaches 0, you do your action (temperature measurement). Counting happens only once in a minute in the ISR, the rest of program runs as usually.

JW

For long duration presumably you could use the RTC Alarm?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..