Jump to content
The simFlight Network Forums

KHBO

Members
  • Posts

    15
  • Joined

  • Last visited

Posts posted by KHBO

  1. I've checked the ini file but the AxisCalibration=No was already set. I've deleted the ini file, and restarted flight simulator and the problem was solved.

    Later I noticed that the problem was due to an overflow (the value of the elevator position control went beyong 35000) This caused my program to hang, when i restarted the program the calibration was enabeled, however not shown in the ini file.

    Thanks!

  2. Hi There,

    I've programmed the Elevator Position Control (0BB2) in VB.NET, I'am using a potentiometer in a real B727 yoke. The calculation in my program is correct and also a value between -16384 and +16384 is send to FSUIPC. However when i check my FSUIPC Log files I can see for example: 5104500 Elevator input=-16235, calibrated to -9387

    FSUIPC seems to calibrate my input, something I don't want. Is there another offset for the Elevator Position Control without calibration, or how can I fix this?

    Thanks a lot

  3. Hi Pete,

    In mean time we've managed to get most things working. However we have a few questions. We are experiencing delays of +- 3 sec on the commands given, probabely due to unefficient programming.

    Do you have any FSUIPC related tips concerning a more efficient programming? (Note that there is also code included for the acquisition of voltages).

    Second question: We are getting the voltage values in double format, this means a lot of numbers behind the floating point, however, flightsim requires a Short as input, this means we are loosing all numbers behind the floating point. Currently we devide the voltage input by the max voltage input (so this means max = 1) and * 16348. Is there a more interesting way to cope with this problem?

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

    Private Sub Timer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer.Tick

    'Engine 1 Throttle Lever

    Dim reader1 As AnalogMultiChannelReader

    Dim myTask1 As New Task

    myTask1.AIChannels.CreateVoltageChannel("dev1/ai0", "", AITerminalConfiguration.Rse, -10, 10, AIVoltageUnits.Volts)

    myTask1.Control(TaskAction.Verify)

    reader1 = New AnalogMultiChannelReader(myTask1.Stream)

    Dim datainput1 As Double(,)

    datainput1 = reader1.ReadMultiSample(-1)

    Dim voltage1 As Double = datainput1(0, 0)

    lblVoltageENG1.Text = voltage1

    Dim dwOffset1 As Integer

    Dim Wel1 As Short = ((voltage1 / 8.73) * 16384)

    Dim ThrottleToken1 As Integer

    Dim Result1 As Integer

    dwOffset1 = &H88C

    FSUIPC_Write(dwOffset1, Wel1, ThrottleToken1, Result1)

    myTask1.Dispose()

    'Engine 2 Throttle Lever

    Dim reader2 As AnalogMultiChannelReader

    Dim myTask2 As New Task

    myTask2.AIChannels.CreateVoltageChannel("dev1/ai1", "", AITerminalConfiguration.Rse, -10, 10, AIVoltageUnits.Volts)

    myTask2.Control(TaskAction.Verify)

    reader2 = New AnalogMultiChannelReader(myTask2.Stream)

    Dim datainput2 As Double(,)

    datainput2 = reader2.ReadMultiSample(-1)

    Dim voltage2 As Double = datainput2(0, 0)

    lblVoltageENG2.Text = voltage2

    Dim dwOffset2 As Integer

    Dim Wel2 As Short = ((voltage2 / 8.73) * 16384)

    Dim ThrottleToken2 As Integer

    Dim Result2 As Integer

    dwOffset2 = &H924

    FSUIPC_Write(dwOffset2, Wel2, ThrottleToken2, Result2)

    myTask2.Dispose()

    'Engine 3 Throttle Lever

    Dim reader3 As AnalogMultiChannelReader

    Dim myTask3 As New Task

    myTask3.AIChannels.CreateVoltageChannel("dev1/ai2", "", AITerminalConfiguration.Rse, -10, 10, AIVoltageUnits.Volts)

    myTask3.Control(TaskAction.Verify)

    reader3 = New AnalogMultiChannelReader(myTask3.Stream)

    Dim datainput3 As Double(,)

    datainput3 = reader3.ReadMultiSample(-1)

    Dim voltage3 As Double = datainput3(0, 0)

    lblVoltageENG3.Text = voltage3

    Dim dwOffset3 As Integer

    Dim Wel3 As Short = ((voltage3 / 8.73) * 16384)

    Dim ThrottleToken3 As Integer

    Dim Result3 As Integer

    dwOffset3 = &H9BC

    FSUIPC_Write(dwOffset3, Wel3, ThrottleToken3, Result3

    myTask3.Dispose()

    'Elevator Position Control

    Dim reader4 As AnalogMultiChannelReader

    Dim myTask4 As New Task

    myTask4.AIChannels.CreateVoltageChannel("dev1/ai3", "", AITerminalConfiguration.Rse, -10, 10, AIVoltageUnits.Volts)

    myTask4.Control(TaskAction.Verify)

    reader4 = New AnalogMultiChannelReader(myTask4.Stream)

    Dim datainput4 As Double(,)

    datainput4 = reader4.ReadMultiSample(-1)

    Dim voltage4 As Double = datainput4(0, 0)

    lblVoltageElevator.Text = voltage4

    Dim dwOffset4 As Integer

    Dim Wel4 As Short = (((voltage4 - (9 / 2)) / (9 / 2)) * 16384)

    Dim ThrottleToken4 As Integer

    Dim Result4 As Integer

    dwOffset4 = &HBB2

    FSUIPC_Write(dwOffset4, Wel4, ThrottleToken4, Result4)

    myTask4.Dispose()

    FSUIPC_Process(Result1)

    FSUIPC_Process(Result2)

    FSUIPC_Process(Result3)

    FSUIPC_Process(Result4)

    End Sub

    FSUIPC_Close() is called in form_closed

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

    All comments on the programming are more than welcome to impove the loading time.

  4. Hi Pete,

    In mean time we've managed to get most things working. However we have a few questions. We are experiencing delays of +- 3 sec on the commands given, probabely due to unefficient programming.

    Do you have any FSUIPC related tips concerning a more efficient programming? (Note that there is also code included for the acquisition of voltages).

    Second question: We are getting the voltage values in double format, this means a lot of numbers behind the floating point, however, flightsim requires a Short as input, this means we are loosing all numbers behind the floating point. Currently we devide the voltage input by the max voltage input (so this means max = 1) and * 16348. Is there a more interesting way to cope with this problem?

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

    Private Sub Timer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer.Tick

    'Engine 1 Throttle Lever

    Dim reader1 As AnalogMultiChannelReader

    Dim myTask1 As New Task

    myTask1.AIChannels.CreateVoltageChannel("dev1/ai0", "", AITerminalConfiguration.Rse, -10, 10, AIVoltageUnits.Volts)

    myTask1.Control(TaskAction.Verify)

    reader1 = New AnalogMultiChannelReader(myTask1.Stream)

    Dim datainput1 As Double(,)

    datainput1 = reader1.ReadMultiSample(-1)

    Dim voltage1 As Double = datainput1(0, 0)

    lblVoltageENG1.Text = voltage1

    Dim dwOffset1 As Integer

    Dim Wel1 As Short = ((voltage1 / 8.73) * 16384)

    Dim ThrottleToken1 As Integer

    Dim Result1 As Integer

    dwOffset1 = &H88C

    FSUIPC_Write(dwOffset1, Wel1, ThrottleToken1, Result1)

    myTask1.Dispose()

    'Engine 2 Throttle Lever

    Dim reader2 As AnalogMultiChannelReader

    Dim myTask2 As New Task

    myTask2.AIChannels.CreateVoltageChannel("dev1/ai1", "", AITerminalConfiguration.Rse, -10, 10, AIVoltageUnits.Volts)

    myTask2.Control(TaskAction.Verify)

    reader2 = New AnalogMultiChannelReader(myTask2.Stream)

    Dim datainput2 As Double(,)

    datainput2 = reader2.ReadMultiSample(-1)

    Dim voltage2 As Double = datainput2(0, 0)

    lblVoltageENG2.Text = voltage2

    Dim dwOffset2 As Integer

    Dim Wel2 As Short = ((voltage2 / 8.73) * 16384)

    Dim ThrottleToken2 As Integer

    Dim Result2 As Integer

    dwOffset2 = &H924

    FSUIPC_Write(dwOffset2, Wel2, ThrottleToken2, Result2)

    myTask2.Dispose()

    'Engine 3 Throttle Lever

    Dim reader3 As AnalogMultiChannelReader

    Dim myTask3 As New Task

    myTask3.AIChannels.CreateVoltageChannel("dev1/ai2", "", AITerminalConfiguration.Rse, -10, 10, AIVoltageUnits.Volts)

    myTask3.Control(TaskAction.Verify)

    reader3 = New AnalogMultiChannelReader(myTask3.Stream)

    Dim datainput3 As Double(,)

    datainput3 = reader3.ReadMultiSample(-1)

    Dim voltage3 As Double = datainput3(0, 0)

    lblVoltageENG3.Text = voltage3

    Dim dwOffset3 As Integer

    Dim Wel3 As Short = ((voltage3 / 8.73) * 16384)

    Dim ThrottleToken3 As Integer

    Dim Result3 As Integer

    dwOffset3 = &H9BC

    FSUIPC_Write(dwOffset3, Wel3, ThrottleToken3, Result3

    myTask3.Dispose()

    'Elevator Position Control

    Dim reader4 As AnalogMultiChannelReader

    Dim myTask4 As New Task

    myTask4.AIChannels.CreateVoltageChannel("dev1/ai3", "", AITerminalConfiguration.Rse, -10, 10, AIVoltageUnits.Volts)

    myTask4.Control(TaskAction.Verify)

    reader4 = New AnalogMultiChannelReader(myTask4.Stream)

    Dim datainput4 As Double(,)

    datainput4 = reader4.ReadMultiSample(-1)

    Dim voltage4 As Double = datainput4(0, 0)

    lblVoltageElevator.Text = voltage4

    Dim dwOffset4 As Integer

    Dim Wel4 As Short = (((voltage4 - (9 / 2)) / (9 / 2)) * 16384)

    Dim ThrottleToken4 As Integer

    Dim Result4 As Integer

    dwOffset4 = &HBB2

    FSUIPC_Write(dwOffset4, Wel4, ThrottleToken4, Result4)

    myTask4.Dispose()

    FSUIPC_Process(Result1)

    FSUIPC_Process(Result2)

    FSUIPC_Process(Result3)

    FSUIPC_Process(Result4)

    End Sub

    FSUIPC_Close() is called in form_closed

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

    All comments on the programming are more than welcome to impove the loading time.

  5. Hi again,

    I checked the logs, it seems that it wrote only 1 byte (8 bits) (so that explains why 64 works as I can have any number between 0 and 255). The variable is an integer or S16 (16 bits) so i'am missing one byte.

    Here is a brief overview of all VB.NET variables: http://en.wikibooks.org/wiki/Visual_Basic_.NET/Variables#Short

    The problem is that it's not clear to me how to specify the size in the FSUIPC_Write sentence.

    Possibility N°1

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

    Using Short --> Short: 16 bits (2 bytes), stores integer values from -32,768 to 32,767. It seems perfectly suited.

    Code:

    Private Sub Button4_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click

    Dim dwOffset As Integer

    Dim Param As Short

    Dim ThrottleToken As Integer

    Dim Result As Integer

    If FSUIPC_Open(SIM_ANY, Result) = True Then

    dwOffset = &H88C

    Param = 245

    FSUIPC_Write(dwOffset, Param, ThrottleToken, Result)

    FSUIPC_Process(Result)

    FSUIPC_Close()

    End If

    End Sub

    It works perfectly, however it has an overflow for Param values > 255. The log files show a change from 0x0 to 0xF5 for the offset 088C.

    15664344 Monitor IPC:088C (S16) = 0x0

    15667759 Monitor IPC:088C (S16) = 0xF5

    Log:

    16909715 WRITE0 [P3728] (failed, read-only!) 330A, 4 bytes: 02 00 00 00

    16909815 WRITE0 [P3728] (failed, read-only!) 330A, 4 bytes: 02 00 00 00

    16909916 WRITE0 [P3728] 088C, 2 bytes: F5 00

    16915053 WRITE0 [P3728] (failed, read-only!) 330A, 4 bytes: 02 00 00 00

    16915153 WRITE0 [P3728] 088C, 2 bytes: F5 00

    I don't kow what the 330A offset does here, i never called it. The 08C offset now works with 2 bytes, however, it still had an overflow for values greater than 255. For example 256 in hex this would mean 100 (255= FF).

    The VB.NET debugging gives nothing.

  6. How can we pass this size in a vb.net FSUIPC_Write statement?

    There are only 2 possibilities in the SDK:

    - FSUIPC_Write (ByVal dwOffset as Integer, ByVal Param As Integer, ByRef Token As Integer, ByRef dwResult as Integer) As Boolean

    - FSUIPC_Write (ByVal dwOffset as Integer, ByVal dwSize As Integer, ByVal Param As Byte(), ByRef Token As Integer, ByRef dwResult as Integer) As Boolean

    I'am currently using the first possibility, without the size tag. However when I use the second one, what do I have to fill in 'ByVal Param As Byte()' ? Example?

  7. Hi All,

    I am trying to make the throttle lever ENG 1 working using VB.NET. I wrote following code and it works, however...

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

    (088C) -> Between -16384 and 16384

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

    Private Sub Button4_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click

    Dim Result As Integer

    If FSUIPC_Open(SIM_ANY, Result) = True Then

    Dim ThrottleToken As Integer

    Dim ThrottleValue As Integer = TbTH1.Value

    Label1.Text =TbTH1.Value

    FSUIPC_Write(&H88C, 64, ThrottleToken, Result)

    FSUIPC_Process(Result)

    FSUIPC_Close()

    End If

    End Sub

    When you push Button4 on the form the throttles are advanced a little bit. However when I try to replace the '64' in

    FSUIPC_Write(&H88C, 64, ThrottleToken, Result) to '8000' FSUIPC_Write(&H88C, 8000, ThrottleToken, Result), I'am getting following message : Arithmetic operation resulted in an overflow

    This is probabely because I use wrong variables. We want to try out the throttle by using a slider on a form. Does anyone has any idea how to avoid the overflow?

    In the future We will replace the number with a voltage value.

  8. I did'nt know it was an illegal key.

    Our final work is to convert a Cockpit Procedure Trainer (B727) (ex-Sabena Technics) into a non-motion flight simulator using Microsoft Flight Simulator.

    As I/O hardware we are using Data Aquisition Hardware of National Instruments (USB-6008 Student Edition). Using VB.NET we will try to couple the voltage outputs to MSFS using the fsuipc.dll. We already managed to load the voltages into VB.NET application.

    That's is more or less...

    How can we arrange this time-limited key?

  9. Hi,

    We are trying the same thing.

    Using Data Aquisition Hardware (DAQ) from National Instruments we are trying to find a way to pass the voltage values to FSUIPC, directly if possible. If not using Visual Basic.

    However we do not have sufficient knowledge of LabView to know how we can pass the voltage values to visual basic.

    Do you have any idea how to do that, or do you have any other knowledge that can help us?

    It's for a school final work by the way.

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