Page 1 of 1

OSTimer and OSBYTES_OF_TICKS

PostPosted: Tue May 14, 2002 8:18 am
by dfleck
In the user manual, the note says "Once this counter reaches its maximum value it remains at that value.". I am using the PICC-18 standard library with OSA configuration. I call OSTimer from my timer1 interrupt which occurs every 2ms. Does the tick counter roll-over or does it stop at 0xFFFFFFFF? Looking at OSTimer it seems the tick counter will roll-over. I was assuming that roll-over of the tick counter would be handled automatically, and that OS_Delay, etc. will work regardless of how long my appilication runs. Is this true, or is manual intervention required to handle the tick counter?

------------------
Donald A. Fleck


Re: OSTimer and OSBYTES_OF_TICKS

PostPosted: Tue May 14, 2002 8:27 am
by aek
Hi Donald.

Which page of the manual?

The tick counter will rollover from 0xFFFFFFFF to 0x00000000, assuming you're doing a source-code build with OSBYTES_OF_TICKS set to 4.

Your assumption that it will all work without intervention is correct.

Keep in mind that ticks and delays are not the same thing. Ticks are just an open-ended free-running counter that tracks the number of system ticks, and can be read via OSGetTicks(). Ticks are useful for long-term time measurement.

Delays are in ticks units, but that's the only link between them. You could have

code:
#define OSBYTES_OF_TICKS  4
#define OSBYTES_OF_DELAYS 2

and you could infer a time period of up to 2**32x1ms with calls to OSGetTicks(), but you could only delay a task by 2**16x1ms in a single OS_Delay(2**16-1).

Hope this Helps,

------------------


Re: OSTimer and OSBYTES_OF_TICKS

PostPosted: Tue May 14, 2002 9:20 am
by dfleck
Thanks. See p.135 (config option OSBYTES_OF_TICKS).

------------------
Donald A. Fleck


Re: OSTimer and OSBYTES_OF_TICKS

PostPosted: Wed May 15, 2002 6:17 am
by Salvo Tech Support
The OSBYTES_OF_TICKS entry in Chapter 5 of the Salvo User Manual has now been corrected.

It will be part of the manual's next release.

------------------
--------
Salvo Technical Support
Please request all tech support through the Forums.