cancel
Showing results for 
Search instead for 
Did you mean: 

I am working with stm32F100 and I want to calculate the time in hours when some GPIO is on

Mohammed_BEN
Associate II
 
2 REPLIES 2
TDK
Guru

Poll the pin periodically, perhaps every ms, and increment a counter when it's on.

Depends how precise you need to be, but for "hours", polling should be fine.

You can edit your post to add additional details.

If you feel a post has answered your question, please click "Accept as Solution".

Or use EXTI an watch/time transitions.

Could use a milli-second time base, the RTC, or TIM / DWT->CYCNT, depending on the resolution you seek.

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