[En-Nut-Discussion] Problem regarding the Timer API

Ulrich Prinz uprinz2 at netscape.net
Fri May 29 13:04:20 CEST 2009


Hi Prasad,

Two options:
If the timers granularity is good enough ( timer is 1ms and measurement 
is 10s) you let the timer trigger a counter at the timer event.

If this is not enough, as you might need us or less granularity, you 
should configure the timer of the CPU as a counter driven by the CPU 
clock or any other more precise external clock. Then on the first event, 
you reset the timer to 0 and on the second event you read out and reset 
the timer again. In this case a backup throug an timer overflow counter 
might help if the second event is unexpectedly long away and the timer 
overflows.

I didn't look into the timer API from NutOS, but If you need to do high 
speed or high efficiency things, it's always better to optimize your 
software to the underlying hardware/CPU architecture for best results.

Regards, Ulrich

Prasad.Nagapati at infineon.com wrote:
> Hi All,
> 
> I have one question regarding the Timers. 
> 
> I want to use the timer in my application, there is certain condition
> however.
> 
> An event is triggered (say UART) and I want to start the timer for this
> event. But I don't know how much time it will take for the processing
> that event. Once the processing is done I will get another trigger (from
> UART) and I want to stop the timer. And I want to calculate the time
> taken for the processing of this event.
> 
> Hence if I use any API's say NutTimerStart <group__xgTimer.html>  I have
> to give the time in milliseconds but I don't know it in advance. Also if
> I use NutTimerStartTicks <group__xgTimer.html>  again I have to give the
> ticks in advance.
> Please suggest me which API's I can use, if not how I should use the
> timer for this particular case.
> 
> Thanks in advance
> Prasad H N
> 
> _______________________________________________
> http://lists.egnite.de/mailman/listinfo/en-nut-discussion



More information about the En-Nut-Discussion mailing list