Hi Eric,

I already tried that thing. When I tried to subtract the other way I was 
getting 0000 002d something like that. That makes it 45 in decimal and when 
divided by 1024 it is 0.04 which is incorrect. 

Kartik.

--- On Fri, 4/30/10, Eric Decker <cire...@gmail.com> wrote:

From: Eric Decker <cire...@gmail.com>
Subject: Re: [Tinyos-help] Need help with recording the time difference  
between 2 events
To: "Kartik Siddhabathula" <siddhabathulakar...@yahoo.com>
Cc: "TinyoS help" <tinyos-help@millennium.berkeley.edu>
Date: Friday, April 30, 2010, 1:15 AM



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.

eric

On Thu, Apr 29, 2010 at 10:25 PM, Kartik Siddhabathula 
<siddhabathulakar...@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,Kartik

--- On Thu, 4/29/10, Eric Decker <cire...@gmail.com> wrote:

 
From: Eric Decker <cire...@gmail.com>
Subject: Re: [Tinyos-help] Need help with recording the time difference  
between 2 events
To: "Kartik Siddhabathula" <siddhabathulakar...@yahoo.com>

Cc: "TinyoS help"
 <tinyos-help@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 
<siddhabathulakar...@yahoo.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,
Kartik



      
_______________________________________________

Tinyos-help mailing list

Tinyos-help@millennium.berkeley.edu

https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help





-- 
Eric B. Decker
Senior (over 50 :-) Researcher













      


-- 
Eric B. Decker
Senior (over 50 :-) Researcher







      
_______________________________________________
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to