HAL Timer Module - read & set counter value
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2014-07-16 3:22 AM
Posted on July 16, 2014 at 12:22
In the old standard drivers, you could use TIM_GetCounter(TIM2) and TIM_SetCounter(TIM2, 0) to read or modify the timer counter values. Is there a similar thing within the HAL drivers? I can't seem to find any replacement functions for these. Should I just access the register directly? TIM2->CNT
#hal-diver #timers #stm32f4
Labels:
- Labels:
-
STM32Cube MCU Packages
-
STM32F4 Series
-
TIM
This discussion is locked. Please start a new topic to ask your question.
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2014-07-16 5:12 AM
Posted on July 16, 2014 at 14:12
Hi h.hammer,
You can use the following Macros available under stm32f4xx_hal_tim.h file in order to Set/Get the TIM Counter Register value:#define __HAL_TIM_SetCounter(__HANDLE__, __COUNTER__) ((__HANDLE__)->Instance->CNT = (__COUNTER__))
#define __HAL_TIM_GetCounter(__HANDLE__) ((__HANDLE__)->Instance->CNT)
With regards.
