Skip to main content
Aes.1
Associate
January 22, 2020
Question

make a off delay timer

  • January 22, 2020
  • 6 replies
  • 1355 views

i want to assign a number to parameter in program and check if my parameter is equal to my number , disable a pin after passing a 10 sec.

in the other hand i want to make a off delay timer with HAL library .

i use STM 32 AND KEIL IDE.

This topic has been closed for replies.

6 replies

Tesla DeLorean
Guru
January 22, 2020

Ok

What STM32? There's like a thousand different "STM32"

Running at what frequency?

Using interrupts?

Or polling the TIM count?

Perhaps divide a clock down to 10's of milliseconds, and then count those off to get to 10 seconds.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
Aes.1
Aes.1Author
Associate
January 22, 2020

Stm32f103c8t6

16 MHZ

i want to use internal interrupts .

and please tell me how to start and stop a timer

Tesla DeLorean
Guru
January 22, 2020

They have an "Enable" bit, and there is also a One-Shot mode.

Can't you just use a 1ms SysTick, and count off 10,000 ticks? Or make a simple scheduler?

From 16 MHz TIM CLK, using 16-bit Prescaler/Period

Prescaler = 64000-1

Period = 250 - 1

For 1Hz (1 Second)

Prescaler = 64000-1

Period = 2500 - 1

For 0.1Hz (10 Seconds)

An update interrupt will occur at startup (time zero), and every time it subsequently wraps.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
waclawek.jan
Super User
January 22, 2020

Homework?

Did you already do a blinky?

Have you read relevant portions of RM0008?

JW

dbgarasiya
Senior
January 25, 2020

just set enable bit to start and clear will stop timer

dbgarasiya
Senior
January 28, 2020

have you done?