Jump to content
The simFlight Network Forums

bajovirtual

new Members
  • Posts

    3
  • Joined

  • Last visited

Posts posted by bajovirtual

  1. Pete has already given you the answer yesterday. Why are you posting this again here? I'm going to post this reply to both threads.

    Your code is using the wrong data types. Each data type (e.g. Integer, Short, Double) stores a different amount of data. If you don't use the correct data type then you are getting the wrong values from FSUIPC. This happens because you end up getting the values of two offsets mixed together.

    The "FSUIPC programmer's guide" clearly says this offset is 2 bytes long. You've used an Integer which is 4 bytes long. You need to use Short which is 2 bytes, like this:

    Public GRADOS_HDG As Offset (Of Short) = New FSUIPC.Offset (Of Short)(&H7CC)
    Public GRADOS_HDG_ant As Short

    All this is explained very clearly in the documentation that comes with my DLL. You need to read the "UserGuide.htm" document in the "Docs" folder in the zip you downloaded. Look at the section called "Registering your interest in an Offset". It has a table that tells you what variable type you need to use for each offset size and type.

    Following the rules laid out in that table your entire code should read:

    Public GRADOS_HDG As Offset (Of Short) = New FSUIPC.Offset (Of Short)(&H7CC)
    Public GRADOS_HDG_ant As Short
    Public ALTITUD As Offset (Of Integer) = New FSUIPC.Offset (Of Integer)(&H7D4)
    Public ALTITUD_ant As Integer
    Public AP_VS As Offset (Of Short) = New FSUIPC.Offset (Of Short)(&H7F2)
    Public AP_VS_ant As Short
    FSUIPCConnection.Process()
    GRADOS_HDG_ant = ((GRADOS_HDG.Value * 360) / 65536)
    ALTITUD_ant = ((ALTITUD.Value * 3.28084) / 65536)
    AP_VS_ant = AP_VS.Value
    

    Paul

    Thank you very much and sorry for the trouble of putting the question twice. A greeting and you are great!!

  2. Hi all, I have a problem reading data from the vertical velocity.

    If the value is positive (the plane goes up) the values are correct, but if the data is negative (lower plane) the value of the variable is always the same: Vs = 64836

    To know is this? I am currently working on a project that simulates the autopilot and display the values in a lcd 16x2, all other values pick them up without problems (alt, hdg, ias etc) but I have problems with this value.

    Please help me, thank you very much and I give the code:

    Public GRADOS_HDG As Offset(Of Integer) = New FSUIPC.Offset(Of Integer)(&H7CC)

    Public GRADOS_HDG_ant As Integer

    Public ALTITUD As Offset(Of Integer) = New FSUIPC.Offset(Of Integer)(&H7D4)

    Public ALTITUD_ant As Integer

    Public AP_VS As Offset(Of Integer) = New FSUIPC.Offset(Of Integer)(&H7F2)

    Public AP_VS_ant As Integer

    FSUIPCConnection.Process()

    GRADOS_HDG_ant = ((GRADOS_HDG.Value * 360) / 65536)

    ALTITUD_ant = ((ALTITUD.Value * 3.28084) / 65536)

    AP_VS_ant = AP_VS.Value

  3. Hi everyone! first of all to thank the forum for so much information and help and I must say that my English is not very good because I am Argentine.

    I'm building an autopilot for FSX, with a LCD display and buttons on it, I use the buttons to select each item (ALT, HDG, NAV, etc) and the display shows me information such as altitude, heading, vertical speed, among others.

    The problem, until now the only one, is that I can not read the vertical velocity when it has a negative value when the plane is dropping, for example read the value 300 ft / min and reads it perfect (I'm working in Visual Studio 2010) but in trying to read a value as being down to 200 ft / min variable becomes "Vs = 64836" with more than worth -200 or -1200, the value is always "64836", know I'm doing wrong? with respect to other data (ALT, HDG, etc) I have no problem.

    I send the code to see him:

    Public AP_VS As Offset(Of Integer) = New FSUIPC.Offset(Of Integer)(&H7F2)

    Public AP_VS_ant As Integer

    FSUIPCConnection.Process()

    HDG = ((GRADOS_HDG.Value * 360) / 65536)

    ALT = ((ALTITUD.Value * 3.28084) / 65536)

    AP_VS_ant = AP_VS.Value

    Thank you very much and I hope you can help me!

×
×
  • 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.