On Tue, 16 Aug 2011, Derrick Washington wrote:

> Anders
>
>  I have included the following line in my generic xml file
>
> <output>
>      <binary_mode>true</binary_mode>
>      <byte_order>network</byte_order>
>
>  My C++ code looks like this now.
>
> float gps_vdummy, gps_xdummy, gps_ydummy, gps_zdummy;
>
> if ( (quik_silva_status_reg & 0x00001000) != 0 ) { //CHECK TO SEE IF
> SIMULATOR DATA IS AVAIABLE
>
>     gps_vdummy  = rs232_uart1_fp;
>     gps_zdummy = rs232_uart1_fp;
>     gps_xdummy = rs232_uart1_fp;
>     gps_ydummy = rs232_uart1_fp;
>     etc ...
>
>  My hardware is returning a 32bit floating point word, in hardware what is
> happening is my UART is taking in the bytes one at a time of course and
> shifting the into a 32bit register a byte at a time, and returning that
> 32bit value.  Soooo if FG is sending the data MSB(most significant byte
> first), then I should be getting the correct value, right?

So rs232_uart1_fp is a floating point variable located at the 
address of the UART output register/port or something similar?
Are you sure it supports that (i.e. reading it as a float)? If not could 
you try reading the 32bit value into an int variable and reinterpret it 
as a float with something like

unsigned int foo = rs232_uart1_u32;
float bar = *(float *)&foo;

Also, there is no need to wait before reading the next word from the UART?


Cheers,

Anders - who hasn't programmed an UART since the 68hc11 and late Amiga
          days.
-- 
---------------------------------------------------------------------------
Anders Gidenstam
WWW: http://www.gidenstam.org/FlightGear/

------------------------------------------------------------------------------
Get a FREE DOWNLOAD! and learn more about uberSVN rich system, 
user administration capabilities and model configuration. Take 
the hassle out of deploying and managing Subversion and the 
tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to