Sorry I don't know any more about TestSerial. I would guess
that there is a MIG generated message class file someplace
that needs to be re-trained to interpret bytes as unsigned.
Perhaps you can run the program in a debugger and trace
where it goes when it gets the values from the message.
MS


Sindra Dk wrote:
> Hi, and thanks all
> Arik, i tried what you told me but it still does not work, and Michael 
> could you please 
> explain more, cause i did not understand and i don't  knwo where 
> changing java code
> is it in TestSerial.java ??
> 
> 
> Sindra
> 
> 
>  > Date: Sat, 10 Apr 2010 15:19:45 -0600
>  > From: [email protected]
>  > To: [email protected]
>  > CC: [email protected]; [email protected]
>  > Subject: Re: [Tinyos-help] Error when receiving matrix values
>  >
>  > Also be aware that Java has no unsigned ints
>  > so you have to be especially overindulgent
>  > when converting them from the TOS_Msg into
>  > println()able elements, e.g.:
>  >
>  > // ToByte -- TOS to Java
>  > // Unsigned convert buffer at 'start'
>  > // from a byte to Java int, without sign
>  > public static int tb( byte[] buf, int start )
>  > {
>  > return ( buf[start] & 0xff );
>  > }
>  >
>  > Without the "& 0xff" the sign bit of the byte will
>  > be extended into the full int return value.
>  >
>  > MS
>  >
>  > Sindra Dk wrote:
>  > > thanks for your answer, i will try then i tell you if it works or 
> not !!
>  > >
>  > > Sindra
>  > >
>  > > 
> ------------------------------------------------------------------------
>  > > From: [email protected]
>  > > Date: Sat, 10 Apr 2010 23:50:42 +0300
>  > > Subject: Re: [Tinyos-help] Error when receiving matrix values
>  > > To: [email protected]
>  > > CC: [email protected]
>  > >
>  > > Although I still don't see the whole picture, I think that your 
> problem
>  > > is that you are using 8 bits for every element.
>  > > Now either it's 0:225 or -128 to +127.
>  > > So you probably have declared the struct that you send as 
> int8_t[][] array.
>  > > Try to declare it as int16_t and don't forget that the default message
>  > > payload size is 28 bytes.
>  > >
>  > > Arik
>  > >
>  > >
>  > > On Sat, Apr 10, 2010 at 23:39, Sindra Dk <[email protected]
>  > > <mailto:[email protected]>> wrote:
>  > >
>  > > Hi all,
>  > > im working on copression algorithm and i use TinyOS 2.x
>  > > i send an image from PC to mote i decompressed it then when i resend
>  > > it to PC
>  > > i get an error on its pixels value:
>  > >
>  > > Original matrix
>  > > uint8_t A[i][j]={{172,132,4,39},{23,127,5,4},{44,7,6,9},{77,211,19,5}};
>  > >
>  > > $ java TestSerial -comm ser...@com5:telos
>  > > Sending packet 0
>  > > ser...@com5:115200: resynchronising
>  > > Sending packet 1
>  > > Received packet sequence number 1
>  > > l'affichage est:-29 (wrong value)
>  > > l'affichage est:26
>  > > l'affichage est:-32
>  > > l'affichage est:-17
>  > > l'affichage est:-87 (wrong value)
>  > > l'affichage est:19
>  > > l'affichage est:-48
>  > > l'affichage est:5
>  > > l'affichage est:77
>  > > l'affichage est:17
>  > > l'affichage est:72
>  > > l'affichage est:-18
>  > > l'affichage est:-118
>  > > l'affichage est:-4
>  > > l'affichage est:85
>  > > l'affichage est:-8
>  > >
>  > > ***************************************
>  > > Display matrix as C is:
>  > > 227 (this is a true value)
>  > > 26
>  > > -32
>  > > -17
>  > > 169.5 (this is a true value)
>  > > 19.5
>  > > -48.5
>  > > 5.5
>  > > 77
>  > > 17
>  > > 72
>  > > -18
>  > > -118.5
>  > > -4.5
>  > > 85.5
>  > > -8.5
>  > > i don't know why i can't display values higher than 127!!!
>  > > can any one help me please? and thanks in advance.
>  > > Ragards,
>  > > Sindra
>  > >
>  > > 
> ------------------------------------------------------------------------
>  > > Hotmail : une messagerie fiable avec une protection anti-spam
>  > > performante Inscrivez-vous
>  > > <https://signup.live.com/signup.aspx?id=60969>
>  > >
>  > > _______________________________________________
>  > > Tinyos-help mailing list
>  > > [email protected]
>  > > <mailto:[email protected]>
>  > > 
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>  > >
>  > >
>  > >
>  > >
>  > > --
>  > > Best Regards,
>  > > Arik Sapojnik
>  > >
>  > > 
> ------------------------------------------------------------------------
>  > > Hotmail : une messagerie fiable avec la protection anti-spam 
> performante
>  > > de Microsoft Inscrivez-vous 
> <https://signup.live.com/signup.aspx?id=60969>
>  > >
>  > >
>  > > 
> ------------------------------------------------------------------------
>  > >
>  > > _______________________________________________
>  > > Tinyos-help mailing list
>  > > [email protected]
>  > > 
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
> 
> ------------------------------------------------------------------------
> Votre messagerie et bien plus où que vous soyez. Passez à Windows Live 
> Hotmail, c'est gratuit ! Inscrivez-vous 
> <https://signup.live.com/signup.aspx?id=60969>
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to