I have a problem in timer , how can i calculate the time in seconds from the timer register?
for example this is my program:
Code: Select all
if(first_rising_edge == 1)
{
start_timer_3;
}
if(second_rising_edge == 1)
{
stop_timer_3;
time_elapsed = ?
frequency = 1/ time_elapsed;
}
the idea is to start timer 3 if first rising edge is detected and stop it if second rising edge is detected then
calculate the period in seconds from the value in timer 3.
i tried many times but i keep getting wrong values.
this is the configurations of my MCU MINI-M4 for STM32 :
MCU: STM32F415RG
MCU running: 60Mhz
timer_3 prescalar is : 1
timer_3 generates an interrupt every : 65535
Best,
Sameer