Hi, I have applied encoder output to a counter as an input (Timer1-A) Also I have written below logic to avoid this problem (not able to load value in timer register (using ROM_TimerLoadSet (TIMER1_BASE, TIMER_A, 0); ) . lTimerACount = ROM_TimerValueGet(TIMER1_BASE, TIMER_A); // read counter value if(lTimerACount >= lPreviousCount) // chech whether there is any count in timer reg. { lCountDiff = lTimerACount - lPreviousCount; } else { lCountDiff = (65535 - lPreviousCount) + lTimerACount; } if(lCountDiff != 0) { lCountDiff = lCountDiff * 10; DIRN = ROM_GPIOPinRead(GPIO_PORTF_BASE,ENCODER_DIRN); if(DIRN) // CHECK DIRECTION INPUT { bMovingUp = 1; liActualCount += lCountDiff; if(liActualCount >= ulMaxCount) liActualCount = ulMaxCount; } else { bMovingDown = 1; liActualCount -= lCountDiff; if(liActualCount <= 0) liActualCount = 0; } if(!bUpdate) { liCurrentCount = liActualCount; bCalculate = 1; } uiLcdOffDelay = 0; lPreviousCount = lTimerACount; // load current count into old count } But want to load 0 count in timer register as soon as copy to temporary variable lTimerACount . Any guidance on above problem? Regards, Kiran
↧