I am not able to understand the difference between following two: __HAL_TIM_GetCompare(&htimX, TIM_CHANNEL_X) __HAL_TIM_GetCounter(&htimX) I checked the datasheet for STM32F031K6T6 but not able to understand the difference.
..
..
__HAL_TIM_GetCounter(&htimX) allow to read CNT register where is the value that correspond with current "time". As time We mean nummber of clock cycles. When your CNT register equals ARR register, then CNT register reset and count again.
__HAL_TIM_GetCompare(&htimX, TIM_CHANNEL_X) allows read CCR register. The register used to for example in Output compare mode or input capture mode.
In Output compare mode (toggle mode):
You can manipulate signal when registers have been equal. When CNT == CCR then the signal toggles.
Remeber this is just example. CCR register support many various cases and features
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.