[Tinyos-help] Error when receiving matrix values

Sindra Dk asma_192 at live.fr
Sun Apr 11 05:57:03 PDT 2010


Hi, and thanks allArik, 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 codeis it in TestSerial.java ??

Sindra

> Date: Sat, 10 Apr 2010 15:19:45 -0600
> From: schip at santafe.edu
> To: asma_192 at live.fr
> CC: sapojnik at gmail.com; tinyos-help at millennium.berkeley.edu
> 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: sapojnik at gmail.com
> > Date: Sat, 10 Apr 2010 23:50:42 +0300
> > Subject: Re: [Tinyos-help] Error when receiving matrix values
> > To: asma_192 at live.fr
> > CC: tinyos-help at millennium.berkeley.edu
> > 
> > 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 <asma_192 at live.fr 
> > <mailto:asma_192 at live.fr>> 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 serial at com5:telos
> >     Sending packet 0
> >     serial at 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
> >     Tinyos-help at millennium.berkeley.edu
> >     <mailto:Tinyos-help at millennium.berkeley.edu>
> >     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
> > Tinyos-help at millennium.berkeley.edu
> > 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 !
https://signup.live.com/signup.aspx?id=60969
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://www.millennium.berkeley.edu/pipermail/tinyos-help/attachments/20100411/2937b019/attachment.htm 


More information about the Tinyos-help mailing list