buddym Posted July 26, 2005 Report Share Posted July 26, 2005 Hi all, I know this is a repeat of topics gone by before (more than likely), but I need help in reading values form FSUIPC and using them in my code. I have a Rabbit RCM2200 connected via ethernet, programmed with some C code to take IP data and display it on 1 of 3 VFD displays I have connected to it. This all works fine. I then have VB code to get FSUIPC data and send it to the Rabit module. This works, but the FSUIPC data is not correct. I thought I had the IAS displaying correctly once, but changed the math and can't get back again. I am no math genius, but this doesn't seem to be that hard.....what am I missing? I am able to run the example (VB) from the SDK. All the info displays correctly. I can even send it to my VFDs on the Rabbit. I am able to get values with the "fsread" function, for instance the IAS. This is where I begin to lose it. It appears I need to read 4 bytes, then multiply them by 128 to get the airspeed? And then the heading is 8 bytes, * 360/(65536*65536) ??? This results in overflow..... I am sure someone has already done this, and I am re-inventing the wheel. Does anyone have VB examples of reading and displaying alt, TAS/IAS, heading, COM/NAV, etc ???? I am building radio panels for my A320 cockpit sim and this is my next step. Pleae help, I'm stuck! Link to comment Share on other sites More sharing options...
Pete Dowson Posted July 26, 2005 Report Share Posted July 26, 2005 It appears I need to read 4 bytes, then multiply them by 128 to get the airspeed? You need to say what offset you are using to read things as they are not all unique and in any case it easier for me to look up by offset. The indicated airspeed is at 02BC as a 32-bit integer (i.e., yes, 4 bytes), and is stored with 7 bits of fraction -- hence the * 128. In other words, you do not MULTIPLY by 128 to get knots, you divide. If you want it to the nearest knot add 64 first. If you want to retain fractional values, copy the integer to a floating point value first then divide. Please please use the tools provided to show you these things -- FSInterrogate is excellent for showing the vlaues you get in real time and also the actual calculations used to convert them. This is why it is provided in the SDK. In general the documentation shows you the UNITS in which these things are stored , NOT the formula to convert them. You have it inverted. There are exceptions -- there was so much confusion about how FS stores its Latitudes and Longitudes that I had to re-describe them in terms of conversions. But I don't think many folks have misunderstood the simple stuff. Regards, Pete Link to comment Share on other sites More sharing options...
buddym Posted July 26, 2005 Author Report Share Posted July 26, 2005 Peter, Thanks so much for the replyI had not understood that fsinterrogate could do that! I will fire it up and look at it closely. I did also want to thank you for all of your hard work on the tools you provide us with, and the continuing support you give us. i really appreciate it! buddym tampa,fl Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now