cancel
Showing results for 
Search instead for 
Did you mean: 

make a off delay timer

Aes.1
Associate

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.

6 REPLIES 6

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 Up vote any posts that you find helpful, it shows what's working..

Stm32f103c8t6

16 MHZ

i want to use internal interrupts .

and please tell me how to start and stop a timer

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 Up vote any posts that you find helpful, it shows what's working..

Homework?

Did you already do a blinky?

Have you read relevant portions of RM0008?

JW

dbgarasiya
Senior II

just set enable bit to start and clear will stop timer

dbgarasiya
Senior II

have you done?