Dear friends!
I tried to get Latitude-readings with Chris Brett's VB-Programm "UIPCHello" (included in Pete Dowson's "FSUIPC_SDK.zip" ; thank you a lot, Chris and Pete! ...but I would be greatful for further help; I'm not a professional programmer... :oops: ).
I supplemented Chris' program code in the "Private Sub Timer1_Timer()"-section with
"FSUIPC_Read(&H560, 8, VarPtr(Latitude(1)), dwResult)", where the Variable "Latitude(i)" was
either: "Dim Latitude(8) As Byte"
or "Dim Latitude(8) As Integer"
or "Dim Latitude(8) As Long"
or "Dim Latitude(8) As Double"
(For Details see below)
Whereas the Clock-bytes were always correctly transmitted, the &H560 - &H568 yielded:
======================================================================
for "Ranch Texas" Latitude 29.6452214482156
[list=]
-----------Byte--------- Integ---------------------Long-------------------Double
1 0 0 1317470208 1.03739986505718E-307
2 0 20103 3319350
3 135 -22986 0 0
4 78 50 0 0
5 54 0 0 0
6 166 0 0 0
7 50 0 0 0
8 0 0 0 0
======================================================================
for "Seattle Tacoma" Latitude 47.4314848387555
...........Byte.........Integer....................Long.....................Double
1............0...........0........................1119944704.............3.65588727537466E-307
2............0...........17089...................5271087
3............193........28207...................0........................0
4............66.........80........................0........................0
5............47..........0........................0........................0
6............110.........0........................0.......................0
7.............80.........0........................0.......................0
8..............0.........0.........................0......................0
======================================================================
for "Canberra Austr" Latitude -35.3143320222001
.............Byte........Integer....................Long..................Double
1.............0............0.....................-1446117376........-2.82530817051241E+307
2.............0...........-22066...............-3924502.............0
3............206..........7658..................0.....................0
4............169.........-60.....................0.....................0
5............234...........0.....................0.....................0
6.............29...........0.....................0.....................0
7.............196..........0.....................0....................0
8............255...........0....................0.....................0
======================================================================
COPY OF MODIFIED PRIVATE SUB TIMER:
Private Sub Timer1_Timer()
Dim dwResult As Long
Dim auiTime() As Byte
Dim Latitude(8) As Byte
'Dim Latitude(8) As Integer
'Dim Latitude(8) As Long
'Dim Latitude(8) As Double
ReDim auiTime(3)
' As an example of retrieving data, we will get the FS clock time.
' If we wanted additional reads/writes at the same time, we could put them here
If FSUIPC_Read(&H238, 3, VarPtr(auiTime(1)), dwResult) Then
' "Read" proceeded without any problems
If FSUIPC_Process(dwResult) Then
' "Process" proceeded without any problems
lblClock.Caption = Format(auiTime(1), "00") & ":" & _
Format(auiTime(2), "00") & ":" & _
Format(auiTime(3), "00")
Else
' Unable to "Process"
lblClock.Caption = "Processing: " & ResultText(dwResult)
End If
Else
' Unable to "Read"
lblClock.Caption = "Reading: " & ResultText(dwResult)
End If
' The same for Latitude:
If FSUIPC_Read(&H560, 8, VarPtr(Latitude(1)), dwResult) Then
' "Read" proceeded without any problems
If FSUIPC_Process(dwResult) Then
' "Process" proceeded without any problems
For i = 1 To 8
txtLat(i).Text = Latitude(i) 'of course I placed 8 Text(i)-fields on the form
Next i
End If
End If
End Sub
========================================================================
I am aware that crude data from &H560 to &H568 necessitates calculation to get Latitude.
"FSUIPC for Programmers.pdf" (in "FSUIPC_SDK.zip") says:
"Latitude of aircraft in FS units.
To convert to Degrees:
If your compiler supports long long (64-bit) integers then use such a variable to simply copy this 64-bit value
into a double floating point variable and multiply by 90.0/(10001750.0 * 65536.0 * 65536.0).
Otherwise you will have to handle the high 32-bits and the low 32-bits separately, combining them into one double
floating point value (say dHi). To do, copy the high part (the 32-bit int at 0564) to one double and the low part
(the 32-bit unsigned int at 0560) to another (say dLo). Remember that the low part is only part of a bigger
number, so doesn‘t have a sign of its own. Divide dLo by (65536.0 * 65536.0) to give it its proper magnitude
compared to the high part, then either add it to or subtract it from dHi according to whether dHi is positive or
negative. This preserves the integrity of the original positive or negative number. Finally multiply the result by
90.0/10001750.0 to get degrees.
Either way, a negative result is South, positive North."
But unfortunately I could not solve this SODOKU... :?
Thank you for help.
Werner.niederer(a°t)sunrise.ch, Switzerland