Enthernet Code
Enthernet Code
DIIDevHeads IoT Integration Server
Created by Enthernet Code on 6/7/2024 in #middleware-and-os
need to calculate the elapsed time in milliseconds between two points in my code(using STM32F103C8T)
@Middleware & OS hello guys, I am using an STM32F103C8T6 with FreeRTOS, and I need to calculate the elapsed time in milliseconds between two points in my code. my code snippet below captures the tick count but does not convert it to milliseconds. static unsigned long gMSTP_timer_tick = 0; void MSTP_timer_reset() { gMSTP_timer_tick = xTaskGetTickCount(); } FLOAT32 MSTP_timer_difference() { unsigned long difference = xTaskGetTickCount() - gMSTP_timer_tick; gMSTP_timer_tick += difference; return (FLOAT32) difference; }
2 replies