[Tinyos-help] Need help with recording the time difference between 2 events
cire831 at gmail.com
Thu Apr 29 23:15:27 PDT 2010
Well try subtracting in the other order. You are seeing numbers like FFFF63
because they are negative. You really should have more digits. Something
like FFFFxxxx because they are 32 bit numbers.
// Reading the local time when the button is pressed
button_time = call LocalTime.get();
// Taking the time difference between boot and button press
time_diff = boot_time-button_time;
you really want time_diff = button_time - boot_time.
Also please review how unsigned arithmetic works.
On Thu, Apr 29, 2010 at 10:25 PM, Kartik Siddhabathula <
siddhabathulakartik at yahoo.com> wrote:
> Hi Eric,
> Please find attached my code. The problem that I am facing is inconsistent
> result. Am getting the value for the difference of the two events as FFFFAD
> / FFFF63 in hex. That makes it 16777059 in int and nearly 16384 secs when
> divided by 1024 whereas the difference between the two events is hardly
> 10/15 secs. So, am not convinced with the results.
> Please advice.
> Thanks in advance,
> --- On *Thu, 4/29/10, Eric Decker <cire831 at gmail.com>* wrote:
> From: Eric Decker <cire831 at gmail.com>
> Subject: Re: [Tinyos-help] Need help with recording the time difference
> between 2 events
> To: "Kartik Siddhabathula" <siddhabathulakartik at yahoo.com>
> Cc: "TinyoS help" <tinyos-help at millennium.berkeley.edu>
> Date: Thursday, April 29, 2010, 11:53 PM
> I've used localtime<TMilli> with out trouble. What kind of problems have
> you had with it? Keep in mind that its resolution is a mis (binary
> millisecond, 1/1024 second).
> For higher resolution timing I just grab the value of TAR the timer
> register which is set up for 1uis ticks. 1/(1024*1024) seconds.
> On Thu, Apr 29, 2010 at 5:42 PM, Kartik Siddhabathula <
> siddhabathulakartik at yahoo.com<http://email@example.com>
> > wrote:
>> Hi All,
>> I am using tinyos-2.x and telosb motes. I am looking to record the time
>> difference between two events. Can I use moteclockp.nc to get the
>> difference? LocalTimeMilliC is not giving accurate results. Am having a lot
>> of trouble with it.
>> Please help.
>> Thanks in advance,
>> Tinyos-help mailing list
>> Tinyos-help at millennium.berkeley.edu<http://mc/compose?to=Tinyosfirstname.lastname@example.org>
> Eric B. Decker
> Senior (over 50 :-) Researcher
Eric B. Decker
Senior (over 50 :-) Researcher
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tinyos-help