Hi Mala,
It is (poorly) documented that the millisecond timer is in "binary
milliseconds" -- or 1024 ticks every second. This is the designed and
expected behavior, not a bug, and will not change in the future. Most
embedded devices do not have floating point support in hardware, so
any floating point operation is slow, and the floating point library
takes a lot of program space.
Look up TinyOS 2.x TEP 102 Timers for more details.
Best,
Cory
On 5/22/06, Mala <[EMAIL PROTECTED]> wrote:
I was writing a simple program to send a periodic message and ran them on
tmotes. That time, I noticed that the messages were appearing at an
interval of 5.85 seconds instead of the 6 seconds that I had programmed. On
further debugging I noticed that the following code in Timer library
command result_t Timer.start[uint8_t num]( char type, uint32_t milli )
{
switch( type )
{
case TIMER_REPEAT:
return setTimer( num, milli*32, TRUE );
case TIMER_ONE_SHOT:
return setTimer( num, milli*32, FALSE );
}
return FAIL;
}
Here per millisecond is considered to be 32 ticks, while it actually is
32.768 ticks. This error led to the difference that I noticed in the timing
of my messages.
Why is this done? Is there any particular reason for doing an integer
operation where we should be doing a floating point operation? Is there any
plan to fix the same?
Regards,
Mala
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help