AnsweredAssumed Answered

TIMER GET COUNTER VALUE

Question asked by MK.ShaSha on Feb 3, 2016
Latest reply on Feb 4, 2016 by dembek.radoslaw.001
ulStart = __HAL_TIM_GetCounter(&htim17) / ulClkFrq ;
              
            do {
                                  /* TimeOut Check */
                ulNow = __HAL_TIM_GetCounter(&htim17)/ ulClkFrq;
                //  ulNow = __HAL_TIM_SetCounter(&htim17, count)/ ulClkFrq;
                    
                      
                if( ulStart > ulNow )
                {
                    ulTick = (((TIMER_CNT_MAX_VAL / ulClkFrq + (unsigned long)1) - ulStart) + ulNow);
                }
                else
                {
                    ulTick = (ulNow - ulStart);
                }
                if( 250 <= ulTick )
                {
                    break;      /* exit do while */
                }
              
            } while( 0xff == count ); 


As seen above, I need to get the difference between ulStart and ulNow. However, ulNow always remains as 0 as the do-while loops. It never increments. Do I have to change the logic of this code to achieve the difference?
Thanks!

Outcomes