cancel
Showing results for 
Search instead for 
Did you mean: 

read timer value function

sashaa
Associate II
Posted on May 21, 2014 at 08:16

hi,

is there a way to read the Timers counter value?

i can't find function for that at the HAL drivers Timer library.

pls help.

(i m using stm32f4 discovery board.

thanks 

#stm32cube #hal-diver #timer
6 REPLIES 6
gk
Associate II
Posted on May 21, 2014 at 10:06

You can try

counter = htim.Instance->CNT;

Posted on May 21, 2014 at 17:26

Hi,

To get TIM counter register value on runtime, you can use the Macro available in :stm32f4xx_hal_tim.h

/**
* @brief Gets the TIM Counter Register value on runtime.
* @param __HANDLE__: TIM handle.
* @retval None
*/
#define __HAL_TIM_GetCounter(__HANDLE__) ((__HANDLE__)->Instance->CNT)

With regards.
gk
Associate II
Posted on May 22, 2014 at 05:41

Hi,

Is any new version than stm32f4xx_hal_tim.h V1.0.0 from 18-February-2014? because I can't see

__HAL_TIM_GetCounter

. I am use STM32Cube FW_F4 V1.1.0
sashaa
Associate II
Posted on May 22, 2014 at 07:43

i cant find This macro in 

STM32Cube FW_F4 V1.1.0

sashaa
Associate II
Posted on May 22, 2014 at 16:06

I add the

__HAL_TIM_GetCounter

macro, and it works good.

Thanks

Posted on May 23, 2014 at 11:03

Hi,

This macro will be available the next STM32Cube_FW_F4 release.

With regards.