On Tue, 16 Aug 2011, Derrick Washington wrote:

> OK so I have to specify wether or not FG should be using host or network
> byte order.  OK, I don't have the source code I just downloaded the
> executable, so I'll have to figure out some way of checking it.  OK then
> once I specify this I have to somehow check to see exactly what that
> order box is using MSB first, or LSB first.
>
> BTW in my generic protocol file I didn't not have this specified at all, I
> wasn't aware that I had to do that, maybe I over looked something, but I
> haven't seen this before.  The battle continues, thanks for your input.

If you don't specify byte order, host order will be used. Anything x86 is 
very likely to use LSB order (a PC certainly is).

If you post how your code decode the value we might be able to spot the 
problem. Have you verified that your code does not receive the 
expected value?

Your earlier code, with my correction, should receive float values in 
network order (if reading the rs232_uart1 variable really gives you the 
next byte from the serial port each time - I would have expected some sort 
of handshaking or waiting between the bytes?):

for ( int i = 0; i <= 3; i++ )
   { dummy_var = (dummy_var << 8) | rs232_uart1; }

return *(float *)&dummy_var;


Cheers,

Anders
-- 
---------------------------------------------------------------------------
Anders Gidenstam
WWW: http://www.gidenstam.org/FlightGear/

------------------------------------------------------------------------------
uberSVN's rich system and user administration capabilities and model 
configuration take the hassle out of deploying and managing Subversion and 
the tools developers use with it. Learn more about uberSVN and get a free 
download at:  http://p.sf.net/sfu/wandisco-dev2dev
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to