What I was trying to say is that ints in a TOS_Msg received
on a host machine are in little-endian order (LSB first).
If you are trying to do something with the data on the host
you need to make sure you are putting the bytes in the right
place in your program variables. MIG will do this for you
and I did it like this in Java:

        // convert buffer at byte 'start'
        //  from a little-endian int into a Java int
        protected static int ti( byte[] buf, int start )
        {
                return ((buf[start+1] << 8) & 0xff00) + (buf[start] & 0xff);
        }

If you are only working internal to the motes this should not be an issue.
MS


Itamar Amsili wrote:
Hi
you right our value is not stable at all, how could we read it reversed we just used the read interface from the CVS...
what should we do to fix it?
thanks for the reponse

----- Original Message -----
From: Michael Schippling <[EMAIL PROTECTED]>
Date: Monday, April 23, 2007 20:23
Subject: Re: [Tinyos-help] tinyos 2 - MTS300 temperature and light values
To: Itamar Amsili <[EMAIL PROTECTED]>
Cc: [email protected]

 > The LSB shouldn't be all zeros, perhaps you are thinking of the
 > byte ordering.
 > If you are receiving a message stream on a PC the Low Byte will
 > come first,
 > and if you have the bytes reversed your reading will look way
 > high and unstable.
 >
 > MS
 >
 >
 > Itamar Amsili wrote:
 > > Hello,
 > > We have a MTS300 sensor board. We encounter a problem with
 > understanding
 > > the
 > > values that we recieve from the board sensing function. The
 > values are
 > > extremly high and we dont realy know in what scale are they
 > measured.> We know that the values are saved in 16BIT and the
 > LSB are zeroes.
 > > Any help will be appreciated.
 > > Thanks in advance,
 > > Eran and Itamar.
> > > > ‎
 > >
 > >
 > > ---------------------------------------------------------------
 > ---------
 > >
 > > _______________________________________________
 > > Tinyos-help mailing list
 > > [email protected]
 > > https://mail.millennium.berkeley.edu/cgi-
 > bin/mailman/listinfo/tinyos-help
 >
‎
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to