Jump to content
The simFlight Network Forums

PMDG Offsets


Recommended Posts

Hello Paul,

I don't understand how I can use PMDG offsets in VB.net. I know dand I have read two PDF talking about those offsets

I would like check AP, taxi lights, navigation lights and strobe lights.

 

6545 1 BYTE MCP_annunCMD_A Boolean
6547 1 BYTE MCP_annunCMD_B Boolean
6564 1 BYTE MAIN_annunAUTO_BRAKE_DISARM Boolean

6500 1 BYTE LTS_PositionSw 0: STEADY
1: OFF
2: STROBE & STEADY
6501 1 BYTE LTS_AntiCollisionSw Boolean
64F4 2 BYTE x 2 LTS_LandingLtRetractableSw[2] 0: RETRACT
1: EXTEND
2: ON
64F6 2 BYTE x 2 LTS_LandingLtFixedSw[2] Boolean
64F8 2 BYTE x 2 LTS_RunwayTurnoffSw[2] Boolean
64FA 1 BYTE LTS_TaxiSw Boolean

 

This is for 737NGX offsets.

Someone can help me to do this please? If easiest to do in C# 

Where I can find a converter translate vn.net to C# ?

Thanks

Regards Fred

Link to comment
Share on other sites

There are not much different to using normal offsets. Make sure you've changed the '737NGX_Options.ini' file as described in the document 'Offset Mapping for PMDG 737NGX.pdf'.

For the information you wanted declare offsets as follows:

    Dim MCP_annunCMD_A As Offset(Of Byte) = New Offset(Of Byte)(&H6545)
    Dim MCP_annunCMD_B As Offset(Of Byte) = New Offset(Of Byte)(&H6547)
    Dim LTS_TaxiSw As Offset(Of Byte) = New Offset(Of Byte)(&H64FA)
    Dim LTS_AntiCollisionSw As Offset(Of Byte) = New Offset(Of Byte)(&H6501)
    Dim LTS_PositionSw As Offset(Of Byte) = New Offset(Of Byte)(&H6500)

Use the values like this:

        FSUIPCConnection.Process()
        Dim autopilot_A As Boolean = MCP_annunCMD_A.Value > 0
        Dim autopilot_B As Boolean = MCP_annunCMD_B.Value > 0
        Dim taxiLights As Boolean = LTS_TaxiSw.Value > 0
        Dim strobeLights As Boolean = LTS_AntiCollisionSw.Value > 0

        If LTS_PositionSw.Value = 0 Then
            ' Steady
        ElseIf LTS_PositionSw.Value = 1 Then
            ' Off
        ElseIf LTS_PositionSw.Value = 2 Then
            ' Stobe and Steady
       End If

Some of the offsets have values for multiple switches, e.g. LTS_LandingLtFixedSw. I assume there are two switches for landing lights in the 737 cockpit. For these just declare multiple offsets, increasing the offset address. e.g.

64F6 2 BYTE x 2 LTS_LandingLtFixedSw[2]   Boolean
    Dim LTS_LandingLtFixedSw1 As Offset(Of Byte) = New Offset(Of Byte)(&H64F6)
    Dim LTS_LandingLtFixedSw2 As Offset(Of Byte) = New Offset(Of Byte)(&H64F7)

Paul

Link to comment
Share on other sites

Thanks Paul for your quick answer so, I have a litle problem

You tell me to do this:

 Dim MCP_annunCMD_A As Offset(Of Byte) = New Offset(Of Byte)(&H6545)
    Dim MCP_annunCMD_B As Offset(Of Byte) = New Offset(Of Byte)(&H6547)
    Dim LTS_TaxiSw As Offset(Of Byte) = New Offset(Of Byte)(&H64FA)
    Dim LTS_AntiCollisionSw As Offset(Of Byte) = New Offset(Of Byte)(&H6501)
    Dim LTS_PositionSw As Offset(Of Byte) = New Offset(Of Byte)(&H6500)

So I don't know how to put this in my file. Can you help me please?

Regards Fred

FsuipcData.vb

Link to comment
Share on other sites

Ok thanks Paul

I have put this in my fsuipcData.vb

Public Sub pmdg737sk()
        'FSUIPCConnection.Process()
        Dim MCP_annunCMD_A As Offset(Of Byte) = New Offset(Of Byte)(&H6545)
        Dim MCP_annunCMD_B As Offset(Of Byte) = New Offset(Of Byte)(&H6547)
        Dim LTS_TaxiSw As Offset(Of Byte) = New Offset(Of Byte)(&H64FA)
        Dim LTS_AntiCollisionSw As Offset(Of Byte) = New Offset(Of Byte)(&H6501)
        Dim LTS_PositionSw As Offset(Of Byte) = New Offset(Of Byte)(&H6500)

        Dim autopilot_A As Boolean = MCP_annunCMD_A.Value > 0
        If MCP_annunCMD_A.Value > 0 Then
            Dim vt As String = DateTime.UtcNow.ToString("[HH:mm]") & Chr(32) & "Auto-pilot CMD A On" & vbCrLf
            My.Computer.FileSystem.WriteAllText(logname, vt, True)
            Dim xml As String = DateTime.UtcNow.ToString("[HH:mm]") & Chr(32) & "Auto-pilot CMD A On " & "*"
            My.Computer.FileSystem.WriteAllText(reportname, xml, True)
        Else
            Dim vt As String = DateTime.UtcNow.ToString("[HH:mm]") & Chr(32) & "Auto-pilot CMD A Off" & vbCrLf
            My.Computer.FileSystem.WriteAllText(logname, vt, True)
            Dim xml As String = DateTime.UtcNow.ToString("[HH:mm]") & Chr(32) & "Auto-pilot CMD A Off " & "*"
            My.Computer.FileSystem.WriteAllText(reportname, xml, True)
        End If

        Dim strobeLights As Boolean = LTS_AntiCollisionSw.Value > 0
        If LTS_PositionSw.Value = 0 Then
            ' Steady
            Dim vta As String = DateTime.UtcNow.ToString("[HH:mm]") & Chr(32) & "Steady On" & vbCrLf
            My.Computer.FileSystem.WriteAllText(logname, vta, True)
            Dim xmla As String = DateTime.UtcNow.ToString("[HH:mm]") & Chr(32) & "Steady On " & "*"
            My.Computer.FileSystem.WriteAllText(reportname, xmla, True)
        ElseIf LTS_PositionSw.Value = 1 Then
            ' Off
            Dim vtb As String = DateTime.UtcNow.ToString("[HH:mm]") & Chr(32) & "Strobe lights Off" & vbCrLf
            My.Computer.FileSystem.WriteAllText(logname, vtb, True)
            Dim xmlb As String = DateTime.UtcNow.ToString("[HH:mm]") & Chr(32) & "Strobe lights Off " & "*"
            My.Computer.FileSystem.WriteAllText(reportname, xmlb, True)
        ElseIf LTS_PositionSw.Value = 2 Then
            ' Stobe and Steady
            Dim vtc As String = DateTime.UtcNow.ToString("[HH:mm]") & Chr(32) & "Strobe lights On" & vbCrLf
            My.Computer.FileSystem.WriteAllText(logname, vtc, True)
            Dim xmlc As String = DateTime.UtcNow.ToString("[HH:mm]") & Chr(32) & "Strobe lights On " & "*"
            My.Computer.FileSystem.WriteAllText(reportname, xmlc, True)
        End If
        Dim autopilot_B As Boolean = MCP_annunCMD_B.Value > 0
        If MCP_annunCMD_B.Value > 0 Then
            Dim vtd As String = DateTime.UtcNow.ToString("[HH:mm]") & Chr(32) & "Auto-pilot CMD B On" & vbCrLf
            My.Computer.FileSystem.WriteAllText(logname, vtd, True)
            Dim xmld As String = DateTime.UtcNow.ToString("[HH:mm]") & Chr(32) & "Auto-pilot CMD B On " & "*"
            My.Computer.FileSystem.WriteAllText(reportname, xmld, True)
        Else
            Dim vtd As String = DateTime.UtcNow.ToString("[HH:mm]") & Chr(32) & "Auto-pilot CMD B Off" & vbCrLf
            My.Computer.FileSystem.WriteAllText(logname, vtd, True)
            Dim xmld As String = DateTime.UtcNow.ToString("[HH:mm]") & Chr(32) & "Auto-pilot CMD B Off " & "*"
            My.Computer.FileSystem.WriteAllText(reportname, xmld, True)
        End If

    End Sub

Auto Pilot doesn't work and Strobe is not logged like Steady state. help please ?

Fred

Edited by Frédéric-O DUCHEMIN
Add code
Link to comment
Share on other sites

PMDG 777 SDK

6485 3 BYTE x 3 LTS_LandingLights_Sw_ON[3] Booleans
Left/Right/Nose
6488 1 BYTE LTS_Beacon_Sw_ON Boolean
6489 1 BYTE LTS_NAV_Sw_ON Boolean
648A 1 BYTE LTS_Logo_Sw_ON Boolean
648B 1 BYTE LTS_Wing_Sw_ON Boolean
648C 2 BYTE x 2 LTS_RunwayTurnoff_Sw_ON[2] Boolean
648E 1 BYTE LTS_Taxi_Sw_ON Boolean
648F 1 BYTE LTS_Strobe_Sw_ON Boolean

how to translate ?

Link to comment
Share on other sites

        Dim MCP_annunCMD_A As Offset(Of Byte) = New Offset(Of Byte)(&H6545)
        Dim MCP_annunCMD_B As Offset(Of Byte) = New Offset(Of Byte)(&H6547)
        Dim LTS_TaxiSw As Offset(Of Byte) = New Offset(Of Byte)(&H64FA)
        Dim LTS_AntiCollisionSw As Offset(Of Byte) = New Offset(Of Byte)(&H6501)
        Dim LTS_PositionSw As Offset(Of Byte) = New Offset(Of Byte)(&H6500)

 

These lines must not be included in the pmdg737sk() method. As I said in an earlier post, they must go at the top of the module with the other offset declarations. If you leave them here your program will crash after a while.

'FSUIPCConnection.Process()

This line is commented out so you'll never get any data back for these offsets.

Otherwise, I cannot see any errors. I can't test this because I don't have the PMDG aircraft. Make sure you've added the line EnableDataBroadcast=1 to the 737NGX_Options.ini file. See the file 'Offset Mapping for PMDG 737NGX.pdf' for details.

Paul

Link to comment
Share on other sites

3 hours ago, Frédéric-O DUCHEMIN said:

PMDG 777 SDK


6485 3 BYTE x 3 LTS_LandingLights_Sw_ON[3] Booleans
Left/Right/Nose
6488 1 BYTE LTS_Beacon_Sw_ON Boolean
6489 1 BYTE LTS_NAV_Sw_ON Boolean
648A 1 BYTE LTS_Logo_Sw_ON Boolean
648B 1 BYTE LTS_Wing_Sw_ON Boolean
648C 2 BYTE x 2 LTS_RunwayTurnoff_Sw_ON[2] Boolean
648E 1 BYTE LTS_Taxi_Sw_ON Boolean
648F 1 BYTE LTS_Strobe_Sw_ON Boolean

how to translate ?

Let's take the first one as an example:

6485 3 BYTE x 3 LTS_LandingLights_Sw_ON[3] Booleans Left/Right/Nose

These are Landing Light Switches. There are 3 of them. One for the lights on the Left, one for Right and one for the lights on the Nose.

The length is BYTE so that's what you declare the offset 'Of'.

The offset address is 6485. But because there are 3 lights, each 1 BYTE long, this is the address of the first (Left) switch.

The Right switch will be 1 byte more = 6486. The Nose switch will be 1 byte more than that = 6487.

They are Boolean values so expect values to be either = 0 (OFF) or >0 (ON)

Here are the final declarations with colour coding so you can see how it fits together:

    Dim LTS_LandingLights_Sw_ON_Left As Offset(Of Byte) = New Offset(Of Byte)(&H6485)
    Dim LTS_LandingLights_Sw_ON_Right As Offset(Of Byte) = New Offset(Of Byte)(&H6486) ' (6485 + 1)
    Dim LTS_LandingLights_Sw_ON_Nose As Offset(Of Byte) = New Offset(Of Byte)(&H6487)  ' (6485 + 2)

 

Paul

 

Link to comment
Share on other sites

Paul,

A ploblem occur because some lights are present here:

 Private Enum LightType
        Navigation
        Beacon
        Landing
        Taxi
        Strobes
        Instruments
        Recognition
        Wing
        Logo
        Cabin
    End Enum

I would like to check if PMDG in use and use only PMDG offsets

For

Public Sub pmdg777sk()
        Try
            FSUIPCConnection.Process()
        Catch ex As Exception
        End Try
        'Dim autopilot_A As Boolean = MCP_AP_Sw_Pushed.Value > 0
        'If MCP_AP_Sw_Pushed.Value > 0 Then
        '    Dim vtg As String = DateTime.UtcNow.ToString("[HH:mm]") & Chr(32) & "Auto-pilot On" & vbCrLf
        '    My.Computer.FileSystem.WriteAllText(logname, vtg, True)
        '    Dim xmlg As String = DateTime.UtcNow.ToString("[HH:mm]") & Chr(32) & "Auto-pilot On " & "*"
        '    My.Computer.FileSystem.WriteAllText(reportname, xmlg, True)
        'End If

        'If MCP_AP_Sw_Pushed.Value = 0 Then

        '    Dim vte As String = DateTime.UtcNow.ToString("[HH:mm]") & Chr(32) & "Auto-pilot Off" & vbCrLf
        '    My.Computer.FileSystem.WriteAllText(logname, vte, True)
        '    Dim xmle As String = DateTime.UtcNow.ToString("[HH:mm]") & Chr(32) & "Auto-pilot Off " & "*"
        '    My.Computer.FileSystem.WriteAllText(reportname, xmle, True)
        'End If

        Dim strobeLights As Boolean = LTS_Strobe_Sw_ON.Value > 0
        If LTS_Strobe_Sw_ON.Value > 0 Then
            Dim vta As String = DateTime.UtcNow.ToString("[HH:mm]") & Chr(32) & "Steady On" & vbCrLf
            My.Computer.FileSystem.WriteAllText(logname, vta, True)
            Dim xmla As String = DateTime.UtcNow.ToString("[HH:mm]") & Chr(32) & "Steady On " & "*"
            My.Computer.FileSystem.WriteAllText(reportname, xmla, True)
        End If

        If LTS_Strobe_Sw_ON.Value = 0 Then
            ' Off
            Dim vtb As String = DateTime.UtcNow.ToString("[HH:mm]") & Chr(32) & "Strobe lights Off" & vbCrLf
            My.Computer.FileSystem.WriteAllText(logname, vtb, True)
            Dim xmlb As String = DateTime.UtcNow.ToString("[HH:mm]") & Chr(32) & "Strobe lights Off " & "*"
            My.Computer.FileSystem.WriteAllText(reportname, xmlb, True)

        End If
        'Dim autopilot_B As Boolean = MCP_annunCMD_B.Value > 0
        'If MCP_annunCMD_B.Value > 0 Then
        '    Dim vtd As String = DateTime.UtcNow.ToString("[HH:mm]") & Chr(32) & "Auto-pilot CMD B On" & vbCrLf
        '    My.Computer.FileSystem.WriteAllText(logname, vtd, True)
        '    Dim xmld As String = DateTime.UtcNow.ToString("[HH:mm]") & Chr(32) & "Auto-pilot CMD B On " & "*"
        '    My.Computer.FileSystem.WriteAllText(reportname, xmld, True)
        'Else
        '    Dim vtd As String = DateTime.UtcNow.ToString("[HH:mm]") & Chr(32) & "Auto-pilot CMD B On" & vbCrLf
        '    My.Computer.FileSystem.WriteAllText(logname, vtd, True)
        '    Dim xmld As String = DateTime.UtcNow.ToString("[HH:mm]") & Chr(32) & "Auto-pilot CMD B On " & "*"
        '    My.Computer.FileSystem.WriteAllText(reportname, xmld, True)
        'End If

    End Sub

 now I have do this but not working in FsuipcData.vb i have already posted 

[18:15] PMDG 777-21HLR Emirates  B77L
[18:15] Flight  SDAK003 is ready to depart  EHAM with a final destination of  LEBL
[18:15] Zero Fuel Weight: 408011 lbs - 185071 kg
[18:15] Take-Off Weight: 725444 lbs - 329056 kg
[18:15] Max Gross Weight: 768000.0 lbs - 348359 kg
[18:15] METAR For Departure: 2016/09/28 17:55 EHAM 281755Z 23012KT 9999 FEW035 18/14 Q1021 NOSIG 
[18:15] Boarding
[18:15] Refueling Mid-Flight suspect !!!
[18:15] Steady On
[18:15] Engine 1 ON
[18:15] Engine 2 ON
[18:15] Parking Brake Applied

 

Link to comment
Share on other sites

Quote

I would like to check if PMDG in use and use only PMDG offsets

I think the only way to do that is to check the name of the aircraft. You are already reading this: PMDG 777-21HLR Emirates B77L

Quote

now I have do this but not working in FsuipcData.vb i have already posted 

But what is the problem? Are the values not being returned from the 777? Are they wrong?

Paul

Link to comment
Share on other sites

The code you've posted looks okay. You haven't shown the declaration for LTS_Strobe_Sw_ON, so I can't check that. It should be:

Dim LTS_Strobe_Sw_ON As Offset(Of Byte) = New Offset(Of Byte)(&H648F)

If you have the same in your code then I'm not sure why it isn't working. I can't test it here unfortunately.

Have you added the EnableDataBroadcast line in 777X_Options.ini?

Paul

Link to comment
Share on other sites

The code you've posted looks okay. You haven't shown the declaration for LTS_Strobe_Sw_ON, so I can't check that. It should be:

Dim LTS_Strobe_Sw_ON As Offset(Of Byte) = New Offset(Of Byte)(&H648F)

If you have the same in your code then I'm not sure why it isn't working. I can't test it here unfortunately.

Have you added the EnableDataBroadcast line in 777X_Options.ini?

Paul

  • Upvote 1
Link to comment
Share on other sites

4 hours ago, Paul Henty said:

The code you've posted looks okay. You haven't shown the declaration for LTS_Strobe_Sw_ON, so I can't check that. It should be:


Dim LTS_Strobe_Sw_ON As Offset(Of Byte) = New Offset(Of Byte)(&H648F)

If you have the same in your code then I'm not sure why it isn't working. I can't test it here unfortunately.

Have you added the EnableDataBroadcast line in 777X_Options.ini?

Paul

Yes I have do this. (I'm using Fs2crew needs SDK enabled). the offset in the first start seems to be active but after nothing.

Maybe need to make a timer or hold old value somewhere?

Fred

Link to comment
Share on other sites

You don't need to hold any values.

You should be calling pmdg777sk() and pmdg737sk() regularly. You can put these in your main timer loop. In the FsuipcData.vb module, it looks like the sub drivestarttmr() is the place to call them.

Somewhere after the call to FSUIPCConnection.Process(). Near where you call checklandinglights() and checkiasFL100(). If you put them here then you don't need the FSUIPCConnection.Process() calls in pmdg777sk() or pmdg737sk().

Paul

Link to comment
Share on other sites

On 10/2/2016 at 2:56 PM, Paul Henty said:

Somewhere after the call to FSUIPCConnection.Process(). Near where you call checklandinglights() and checkiasFL100(). If you put them here then you don't need the FSUIPCConnection.Process() calls in pmdg777sk() or pmdg737sk().

Paul

If I put the function in FsuipcData.vb in the window log each time timer makes loop I have Strobes lights, etc populate my window log. 

So I need to place pmdg737sdk() in FrmMain.vb to avoid crash but now I have information only when Get flight

I give you some files if you can look please.

-------------------------------------------------------

I would like make function for displaying GS, TAS, Mach, Fuel Flow in Real-Time Flight Information How can do that?

Thanks

Fred

FsuipcData.vb

FrmMain.vb

 

Link to comment
Share on other sites

Hi,

i think what you are look for is a bit more complicated.

the right approach is quite different.

1) you need a Class containing the PMDG SDK  "translation" for VB.net    (Form5.vb + SDK2.vb  x  NGX)   (Form6.vb. + SDK.vb x 777)

2) you need a Class/Form connecting to FSX "Microsoft.FlightSimulator.SimConnect" reading all VAR

3)the Form is including Sub proc's you can call from any other Form. (return val by global var is better then a Function)

I'm using this forms with my Programs. You can even fly the PMD-NGX in automatic with your program.

With your Main-Form you are still using a normal Simconnect connection. The Form5/6 is using a separate Simconnect connection.

Carefully read the files included with then attached  "PMDG_VB_Code.rar" file.

Form5 + Form6 (not visible) are plain Form's including a VB "DataGridView" used for reading in the PMDG/SDK.vb class and extracting single Index-Data.

I can't go deeper into details here.

Hope it can be of help to you.

Nota:

In case of Compile problems you must check your "app.config" file. Maybe you need to change the supported Runtime to  <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/> 

A 2 byte value is reading:

newValue = fields(224).GetValue(da)

Dim sb As New StringBuilder()

For Each j As Object In DirectCast(newValue, IEnumerable)

sb.AppendFormat("{0} ", j) 'ON = '1

Next

B777_APON = sb.ToString.Contains("1")

The NGX SDK is a bit different and reading the value directly.

 

Raimund

.

 

PMDG_VB_Code.rar

Link to comment
Share on other sites

Dear Raimund,

thank you very much for VB.net connection examples for NGX from your last post. It helped me a lot as I was completely lost in SimConnect and PMDG SDK staff for quite a long time.... BIG THANKS again!

I have just noticed that your NGX SDK in SDK2.vb file doesn't contain definitions for CDU screen readout (which have been available since last NGX SP). I have tried to modify SDK2 for CDU screen readout, but with no luck so far (seems there is a problem with 2D array structure, which I'm not able to resolve). Did you have chance to see the last NGX SDK from PMDG and are you planning to make some update of SDK2.vb file to expand new available functionality?

CDU screen readout is my main point of interest as I'm building 737NG home cockpit running both CDUs on dedicated PC... 

Brgds 

Petr Cenek

Link to comment
Share on other sites

9 hours ago, pcenek said:

Dear Raimund,

thank you very much for VB.net connection examples for NGX from your last post. It helped me a lot as I was completely lost in SimConnect and PMDG SDK staff for quite a long time.... BIG THANKS again!

I have just noticed that your NGX SDK in SDK2.vb file doesn't contain definitions for CDU screen readout (which have been available since last NGX SP). I have tried to modify SDK2 for CDU screen readout, but with no luck so far (seems there is a problem with 2D array structure, which I'm not able to resolve). Did you have chance to see the last NGX SDK from PMDG and are you planning to make some update of SDK2.vb file to expand new available functionality?

CDU screen readout is my main point of interest as I'm building 737NG home cockpit running both CDUs on dedicated PC... 

Brgds 

Petr Cenek

I don't have this latest Pmdg SDK file. My Sdk file i translated for Vb.net with a copy of the Ngx-Sdk and then included within a program. I'm not using the NGX but the Pmdg_777. Read my message about it.

Pls. just state/write the SDK lines you are interested in.

Raimund

 

Link to comment
Share on other sites

On ‎05‎/‎10‎/‎2016 at 7:22 PM, pcenek said:

Dear Raimund,

thks a lot for prompt reply. PM was sent...

Petr

The NGX_SDK including the CDU data will be translated like the previous NGX_SDK for direct access.

You can't modify the enclosed SDK Class vor VB.net; It must be rewritten including the CDU data.

The CDU part is a different structure using:

14 lines with 24 characters. Symbol, Color and Attributes. Total data is 1008 bites. The CDU Text can then be extracted.

Raimund

.

 

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.