Jump to content
The simFlight Network Forums

Question on TurnRate and Ground speed


Recommended Posts

Hi Peter,

this is Rana.. we have spoken once before for my freeware FlightSim Manager key. Implemented a host of new features since we last spoke, and I need to clarify something for one of the feature.

1) Turn Rate &H037C (2 Byte) - the SDK reads this is from -512 to 512. How do I measure it? I thought it might be 1st Byte - 2nd Byte, but then it can only return -255 to 255 - can you please calirify it?

2) Groundspeed &H02B4 (4 Byte) - the SDK reads /65536 to get value in meter/s. However, FSInterogator shows the following formula

#*3600/65536/1852

using FSInt. formula matches the value on the Airspeed panel. In which case, is it in knots?

thanks - I am adding a warning system to my softwarethis would def. help me out.

Link to comment
Share on other sites

1) Turn Rate &H037C (2 Byte) - the SDK reads this is from -512 to 512. How do I measure it? I thought it might be 1st Byte - 2nd Byte, but then it can only return -255 to 255 - can you please calirify it?

What do you mean, -355 to 255? A 2-byte (16-bit signed short) can accommodate -32768 to +32767. The use here for a range -512 to +512 is easily accommodated!

A single 8-bit signed byte can accommodate only -128 to +127. So where do you get -255 to +255 from?

2) Groundspeed &H02B4 (4 Byte) - the SDK reads /65536 to get value in meter/s. However, FSInterogator shows the following formula

#*3600/65536/1852

using FSInt. formula matches the value on the Airspeed panel. In which case, is it in knots?

You convert metres per second to knots by *3600 / 1852. This is what FSInterrogate is doing. Both are correct, please note the difference in units.

All the information you need is in the document, you just need to read it a little more carefully. Okay?

Regards,

Pete

Link to comment
Share on other sites

Thanks pete for replying to me so quickly.

I have looked through the document, and also did a search on the forum, before posting this thread, as I do understand you are very busy. I guess I somehow missed it.

Thanks for the meter - knot.. I did think that was a possibility.

If you can just bear with me with one more question.

On query, if

&H037C = FB 11111011

&H037D = FF 11111111

how do I calculate this turn rate.. sorry again, but hadn't had much sleep lately, and cant seem to focus.

thanks

Link to comment
Share on other sites

If you can just bear with me with one more question.

On query, if

&H037C = FB 11111011

&H037D = FF 11111111

how do I calculate this turn rate.. sorry again, but hadn't had much sleep lately, and cant seem to focus.

Oh dear. You didn't understand my last reply at all, then?

Surely you must be reading 16-bit numbers from the interface for other values in your program? Why is it that you are stumbling on this, one of the easiest 16 bit numbers to deal with?

Do NOT read 037C into two separate bytes! It is one 16-bit word. Read it into a "short", or whatever a 16-bit integer is defined as in your language.

As a 16 bit word the above value is 1111111111111011 which is 0xFFFB which in decimal is -5, so it is 5/512ths of the way to a 2-minute left turn.

Please, please, always try to view the values in FS in the way that they are defined. The length of a 16 bit number is 2 bytes, just as the length of a 32-bit integer is 4 bytes and that of a 64 bit double float is 8 bytes, but for numbers occupying those bytes you view them as numbers, not individual bytes.

The length is only important in the Read and Write statements, because the interface doesn't know what your data is, it is just allocating and transferring memory blocks.

Pete

Link to comment
Share on other sites

Thats Pete for taking it easy on me... after getting some sleep, suddenly I can speak latin, and understand signed.... :)

reference for visual basic coders: Hi guys, you can use the following function to convert signed value to unsigned..

'---------------------------------------------------------------------------------------

' Procedure : ConvertToUnsigned

' DateTime : 28/07/2004 21:49

' Author : Rana.Hossain@RanaInside.com

' Purpose :

'---------------------------------------------------------------------------------------

Public Function ConvertToUnsigned(unsigned As Long) As Currency

Dim L As Long

If unsigned > 65535 Then

' illegal

Else

L = unsigned And &H7FFF&

ConvertToUnsigned = L Or -(unsigned And &H8000&)

End If

End Function

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.