Ron Buchwald Posted June 5, 2005 Report Posted June 5, 2005 sorry to trouble you again but.. offset 2ec0 rudder trim... is a float 64 # I tried the following but it did not work. this is from the developer kit for vb. agagin I need to convert the float # to 0-255 thanks Ron. Here's some example code extracting the 64bit Latitude Integer from offset 0560 Dim Fake64Bit As Currency Dim dwResult As Long Dim Latitude As Double If FSUIPC_Read(&H560, 8, VarPtr(Fake64Bit), dwResult) Then ' "Read" proceeded without any problems If FSUIPC_Process(dwResult) Then ' First we need to multiply the fake64bit number held in the currency VAR by 10,000 ' to remove the decimal point - remember to force the double (#) to avoid overflow Latitude = Fake64Bit * 10000# ' Now convert from FS units to degrees, again forcing the double to avoid overflow Latitude = Latitude * 90# / (10001750# * 65536# * 65536#)
Pete Dowson Posted June 5, 2005 Report Posted June 5, 2005 sorry to trouble you again but.. offset 2ec0 rudder trim... is a float 64 # I tried the following but it did not work. this is from the developer kit for vb. A float64 is a double. Read it into a double, not a 64 bit fixed point number. The example you are basing it on is not a double at all but a fixed point number!! Pete
Ron Buchwald Posted June 6, 2005 Author Report Posted June 6, 2005 Thank you pete that did the trick. for any one who wants to know this is the vb code that gives me a number fron 0 - 255 so I can send it out the serial port. Ron. :D Private Sub Timer1_Timer() Dim dwResult As Long Dim RUDDERDATA As Double If FSUIPC_Read(&H2EC0, 8, VarPtr(RUDDERDATA), dwResult) Then If FSUIPC_Process(dwResult) Then R = RUDDERDATA * 10000# R = R + 1745: R2 = R / 13.7 RUDDERTX.Text = Format(R2, "00") RUDDERSLIDE.Value = R2 end if end if end sub Private Sub RUDDERTX_Change() MSComm1_OnComm End Sub Private Sub MSComm1_OnComm() MSComm1.Output = Chr$(RUDDERSLIDE.Value - 1) End Sub
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