MobiFlight Community Support

Welcome to the forum for MobiFlight! Feel free to reach out to the community in case you have questions, issues or just want to share great ideas or details about your latest home cockpit project.

You like MobiFlight? Donate via PayPal and support the MobiFlight development. Thanks! 

icon
Avatar
sisoffi
Posts: 50
Hi at all,
I took in hand an old project that I had, and to continue with a subsequent cockpit step after succesfully implement all mobifglith system for the Overhead
MIP and MCP panel, that is to interface real instruments of md80.

I'm starting from the speed indicator which unfortunately has been cannibalized in hte past from prior owner and used with sioc and leobodnar cards.
I wanted to try to standardize everything with mobiflight so in the meantime I ask in general:

the instrument has DC motors and potentiometer axes that manage the motor signal.
There are outputs that were handled through SIOC outputs cards.

In your opinion, with the now known event IDs of the maddog is it possible to re-interface the instrument?

DCmotor?
Axes of potentiometers and outputs?
I am attaching the script that was in use with sioc.






// *****************************************************************************
// * Config_SIOC ver 3.7B1 - By 3dO - www.opencockpits.com
// *****************************************************************************
// * FileName : G_AirspeedIndicator.txt
// * Date : 06/08/2010

Var 0000, Value 0
{
&MotorControls = TIMER 999 ,0 ,5
&ASObj_C = 4
&SBObj_C = 144
&BPObj_C = 3952
&D_MACH_H = 0
&D_MACH_T = 0
&D_MACH_U = 0
&AS_FlagAS_C = 0
&AS_FlagM_C = 0
}

// -------------------Motors and pots -----------------------

Var 2006, name ASMotor_C, static, Link USB_DCMOTOR, Device 0, Output 3 // motor control (0-127) 0=Left, +128 = Rig
Var 2007, name ASAd_C, static, Link FSUIPC_IN, Offset $66D0, Length 4
{
CALL &ASControl_C
}
Var 2010, name SBMotor_C, static, Link USB_DCMOTOR, Device 0, Output 1 // motor control (0-127) 0=Left, +128 = Rig
Var 2011, name SBAd_C, static, Link FSUIPC_IN, Offset $66D8, Length 4
{
CALL &SBControl_C
}
Var 2014, name BPMotor_C, static, Link USB_DCMOTOR, Device 0, Output 2 // motor control (0-127) 0=Left, +128 = Rig
Var 2015, name BPAd_C, static, Link FSUIPC_IN, Offset $66D4, Length 4
{
CALL &BPControl_C
}


// ------------ Captain and FO Airspeed needle -------------------------


Var 9002, name ASscale_C, Link SUBRUTINE
{
IF &ASI_Fail = 1
{
L1 = 4
}
ELSE
{
L0 = &AirSpd
L2 = L0
IF L0 < 30 // First sector
{
L1 = 4 // pot 4
}
ELSE
{
L2 = L0
IF L0 <= 60 // Second sector
{
L1 = L2 / 0.9375 // pot 68
L1 = L1 + 4
L1 = ROUND L1
}
ELSE
{
L2 = L0 - 60
IF L0 <= 70 // Third sector
{
L1 = L2 / 0.14925 // pot 135
L1 = L1 + 68
L1 = ROUND L1
}
ELSE
{
L2 = L0 - 70
IF L0 <= 160 // Fourth Sector
{
L1 = L2 / 0.06475 // pot 1525
L1 = L1 + 135
L1 = ROUND L1
}
ELSE
{
L2 = L0 - 160
IF L0 <= 250 // Fifth Sector
{
L1 = L2 / 0.0641 // pot 2929
L1 = L1 + 1525
L1 = ROUND L1
}
ELSE
{
L2 = L0 - 250
IF L0 <= 350 // Sixth Sector
{
L1 = L2 / 0.19763 // pot 3435
L1 = L1 + 2929
L1 = ROUND L1
}
ELSE
{
L2 = L0 - 350
IF L0 <= 450 // Seventh Sector
{
L1 = L2 / 0.20161 // pot 3931
L1 = L1 + 3435
L1 = ROUND L1
}
ELSE // Out of range
{
IF L0 > 450 // Fourth Sector
{
L1 = 3935
}
}
}
}
}
}
}
}
}
&ASObj_C = L1
}

Var 9004, name ASControl_C, Link SUBRUTINE
{
L0 = &ASObj_C - &ASAd_C
L1 = 0
IF L0 < 0
{
L1 = 128
}
L0 = ABS L0
L2 = &ASVelMax + L1
IF L0 <= &ASAprox9
{
L2 = &ASVel9 + L1
}
IF L0 <= &ASAprox8
{
L2 = &ASVel8 + L1
}
IF L0 <= &ASAprox7
{
L2 = &ASVel7 + L1
}
IF L0 <= &ASAprox6
{
L2 = &ASVel6 + L1
}
IF L0 <= &ASAprox5
{
L2 = &ASVel5 + L1
}
IF L0 <= &ASAprox4
{
L2 = &ASVel4 + L1
}
IF L0 <= &ASAprox3
{
L2 = &ASVel3 + L1
}
IF L0 <= &ASAprox2
{
L2 = &ASVel2 + L1
}
IF L0 <= &ASAprox1
{
L2 = &ASVel1 + L1
}
IF L0 <= &ASAproxSlow
{
L2 = &ASVelMin + L1
}
IF &ASObj_C = &ASAd_C
{
&ASMargen_C = 5
}
IF L0 >= 6
{
&ASMargen_C = 0
}
IF L0 <= &ASMargen_C
{
L2 = 0
}
&ASMotor_C = L2
}

Var 9006, name ASObj_C // objective position
{
CALL &ASControl_C
}
Var 9007, name ASMargen_C, Value 0 // %error
Var 9010, name ASAprox9, Value 270
Var 9011, name ASAprox8, Value 240
Var 9012, name ASAprox7, Value 210
Var 9013, name ASAprox6, Value 180
Var 9014, name ASAprox5, Value 150
Var 9015, name ASAprox4, Value 120
Var 9016, name ASAprox3, Value 90
Var 9017, name ASAprox2, Value 60
Var 9018, name ASAprox1, Value 30
Var 9019, name ASAproxSlow, Value 10
Var 9020, name ASVelMax, Value 30 // Speed for follow objective
Var 9021, name ASVel9, Value 27
Var 9022, name ASVel8, Value 24
Var 9023, name ASVel7, Value 21
Var 9024, name ASVel6, Value 18
Var 9025, name ASVel5, Value 15 // Speed for proximity obj
Var 9026, name ASVel4, Value 12
Var 9027, name ASVel3, Value 9
Var 9028, name ASVel2, Value 6
Var 9029, name ASVel1, Value 4
Var 9030, name ASVelMin, Value 3 // Speed approaching target



// ------------ Captain and FO Speedbug -------------------------

Var 9100, name SpdBug, value 100
Var 9101, name SBug_C, Link SUBRUTINE
{
L0 = &SpdBug
L2 = L0
IF L0 <= 100 // First sector
{
L1 = 144 // pot 144
}
ELSE
{
L2 = L0 - 100
IF L0 <= 250 // Second sector
{
L1 = L2 / 0.27372 // pot 692
L1 = L1 + 144
L1 = ROUND L1
}
ELSE
{
L2 = L0 - 250
IF L0 <= 350 // Third Sector
{
L1 = L2 / 0.80645 // pot 816
L1 = L1 + 692
L1 = ROUND L1
}
ELSE
{
L2 = L0 - 350
IF L0 <= 450 // Third Sector
{
L1 = L2 / 0.89285 // pot 928
L1 = L1 + 816
L1 = ROUND L1
}
ELSE // Out of range
{
IF L0 > 450 // Third Sector
{
L1 = 928
}
}
}
}
}
&SBObj_C = L1
}

Var 9103, name SBControl_C, Link SUBRUTINE
{
L0 = &SBObj_C - &SBAd_C
L1 = 0
IF L0 < 0
{
L1 = 128
}
L0 = ABS L0
L2 = &SBVelMax + L1
IF L0 <= &SBAproxFast
{
L2 = &SBVelFast + L1
}
IF L0 <= &SBAproxSlow
{
L2 = &SBVelMin + L1
}
IF &SBObj_C = &SBAd_C
{
&SBMargen_C = 5
}
IF L0 >= 6
{
&SBMargen_C = 0
}
IF L0 <= &SBMargen_C
{
L2 = 0
}
&SBMotor_C = L2
}

Var 9105, name SBObj_C // objective position
{
CALL &SBControl_C
}
Var 9106, name SBMargen_C, Value 0 // %error
Var 9112, name SBAproxFast, Value 50
Var 9113, name SBAproxSlow, Value 20
Var 9114, name SBVelMax, Value 13 // Speed for follow objective
Var 9115, name SBVelFast, Value 10 // Speed for follow objective
Var 9116, name SBVelMin, Value 7 // Speed for follow objective
Var 9117, name SBVelMaxFO, Value 35 // Speed for follow objective
Var 9118, name SBVelFastFO, Value 28 // Speed for follow objective
Var 9119, name SBVelMinFO, Value 20 // Speed for follow objective



// ------------ Captain and FO Barber Pole needle -------------------------


Var 9202, name BPScale_C, Link SUBRUTINE
{
IF &ASI_Fail = 1
{
L1 = 3296
}
ELSE
{
L0 = &BarPol
L2 = L0
IF L0 <= 255 // First sector
{
L1 = 3296
}
ELSE
{
L2 = L0 - 255
IF L0 <= 360 // Second sector
{
L1 = L2 / 0.16 // pot 3952
L1 = L1 + 3296
L1 = ROUND L1
}
ELSE // Out of range
{
IF L0 > 360 // Third Sector
{
L1 = 3952
}
}
}
}
&BPObj_C = L1
}

Var 9204, name BPControl_C, Link SUBRUTINE
{
L0 = &BPObj_C - &BPAd_C
L1 = 0
IF L0 < 0
{
L1 = 126
}
L0 = ABS L0
L2 = &BPVelMax + L1
IF L0 <= &BPAproxFast
{
L2 = &BPVelSlow + L1
}
IF L0 <= &BPAproxSlow
{
L2 = &BPVelMin + L1
}
IF &BPObj_C = &BPAd_C
{
&BPMargen_C = 10
}
IF L0 >= 11
{
&BPMargen_C = 0
}
IF L0 <= &BPMargen_C
{
L2 = 0
}
&BPMotor_C = L2
}


Var 9206, name BPObj_C // objective position
{
CALL &BPControl_C
}
Var 9207, name BPMargen_C, Value 0 // %error
Var 9211, name BPAproxFast, Value 40
Var 9212, name BPAproxSlow, Value 20 // Proximity Value
Var 9213, name BPVelMax, Value 16 // Speed for follow objective
Var 9214, name BPVelSlow, Value 11
Var 9218, name BPVelMin, Value 6 // Speed approaching target


// ------------ Captain and FO Mach drums -------------------------


Var 667, static, name MachN
{
L0 = &MachN
&D_MACH_U = MOD L0 ,10 // Mach Units Number
L0 = DIV L0 ,10
&D_MACH_T = MOD L0 ,10 // Mach Tenth Number
L0 = DIV L0 ,10
&D_MACH_H = MOD L0 ,10 // Mach Hundreds Number
CALL &InstrFlags
}

Var 9302, name D_MACH_H, Link SUBRUTINE
{
IF &ASI_Fail = 1
{
&C_Mach_H_0 = 0
&C_Mach_H_4 = 0
&C_Mach_H_5 = 0
&C_Mach_H_6 = 0
&C_Mach_H_7 = 0
&C_Mach_H_8 = 0
&C_Mach_H_9 = 0
}
ELSE
{
IF &MachN < 400
{
&C_Mach_H_0 = 0
&C_Mach_H_4 = 0
&C_Mach_H_5 = 0
&C_Mach_H_6 = 0
&C_Mach_H_7 = 0
&C_Mach_H_8 = 0
&C_Mach_H_9 = 0
}
ELSE
{
IF &D_MACH_H = 0
{
&C_Mach_H_0 = 1
}
ELSE
{
&C_Mach_H_0 = 0
}
IF &D_MACH_H = 4
{
&C_Mach_H_4 = 1
}
ELSE
{
&C_Mach_H_4 = 0
}
IF &D_MACH_H = 5
{
&C_Mach_H_5 = 1
}
ELSE
{
&C_Mach_H_5 = 0
}
IF &D_MACH_H = 6
{
&C_Mach_H_6 = 1
}
ELSE
{
&C_Mach_H_6 = 0
}
IF &D_MACH_H = 7
{
&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= 0
}
}
}
}



Var 9400, name C_Mach_H_0, Link IOCARD_OUT, Device 7, Output 0
Var 9404, name C_Mach_H_4, Link IOCARD_OUT, Device 7, Output 4
Var 9405, name C_Mach_H_5, Link IOCARD_OUT, Device 7, Output 5
Var 9406, name C_Mach_H_6, Link IOCARD_OUT, Device 7, Output 6
Var 9407, name C_Mach_H_7, Link IOCARD_OUT, Device 7, Output 7
Var 9408, name C_Mach_H_8, Link IOCARD_OUT, Device 7, Output 8
Var 9409, name C_Mach_H_9, Link IOCARD_OUT, Device 7, Output 9

Var 9410, name C_Mach_T_0, Link IOCARD_OUT, Device 7, Output 10
Var 9411, name C_Mach_T_1, Link IOCARD_OUT, Device 7, Output 11
Var 9412, name C_Mach_T_2, Link IOCARD_OUT, Device 7, Output 12
Var 9413, name C_Mach_T_3, Link IOCARD_OUT, Device 7, Output 13
Var 9414, name C_Mach_T_4, Link IOCARD_OUT, Device 7, Output 14
Var 9415, name C_Mach_T_5, Link IOCARD_OUT, Device 7, Output 15
Var 9416, name C_Mach_T_6, Link IOCARD_OUT, Device 7, Output 16
Var 9417, name C_Mach_T_7, Link IOCARD_OUT, Device 7, Output 17
Var 9418, name C_Mach_T_8, Link IOCARD_OUT, Device 7, Output 18
Var 9419, name C_Mach_T_9, Link IOCARD_OUT, Device 7, Output 19

Var 9420, name C_Mach_U_0, Link IOCARD_OUT, Device 7, Output 20
Var 9421, name C_Mach_U_1, Link IOCARD_OUT, Device 7, Output 21
Var 9422, name C_Mach_U_2, Link IOCARD_OUT, Device 7, Output 22
Var 9423, name C_Mach_U_3, Link IOCARD_OUT, Device 7, Output 23
Var 9424, name C_Mach_U_4, Link IOCARD_OUT, Device 7, Output 24
Var 9425, name C_Mach_U_5, Link IOCARD_OUT, Device 7, Output 25
Var 9426, name C_Mach_U_6, Link IOCARD_OUT, Device 7, Output 26
Var 9427, name C_Mach_U_7, Link IOCARD_OUT, Device 7, Output 27
Var 9428, name C_Mach_U_8, Link IOCARD_OUT, Device 7, Output 28
Var 9429, name C_Mach_U_9, Link IOCARD_OUT, Device 7, Output 29

Var 9460, name AS_FlagAS_C, Link IOCARD_OUT, Device 7, Output 31
Var 9461, name AS_FlagM_C, Link IOCARD_OUT, Device 7, Output 30

Var 9200, static, name ASI_Fail, Link FSUIPC_INOUT, Offset $0B65, Length 1 // ASI fail
{
CALL &ASScale_C
CALL &BPScale_C
CALL &D_Mach_H
CALL &D_Mach_T
CALL &D_Mach_U
IF &ASI_Fail = 1
{
&AS_FlagAS_C = 0
&AS_FlagM_C = 0
}
ELSE
{
CALL &InstrFlags
CALL &MachN
}
}

Var 9215, static, name Airspd_Offst, link FSUIPC_IN, Offset $02BC, Length 4
{
L0 = &Airspd_Offst
L1 = L0 / 128
L1 = ROUND L1
&AirSpd = L1
}

Var 9216, name AirSpd
{
CALL &ASscale_C
}

Var 9276, name BarPole_Offst, link FSUIPC_IN, Offset $02C4, Length 4
{
L0 = &BarPole_Offst
L1 = L0 / 128
L1 = ROUND L1
&BarPol = L1
}

Var 9217, static, name BarPol
{
CALL &BPscale_C
}

Var 9277, name MotorControls, Link SUBRUTINE
{
C0 = &FSPause = 0
C1 = &FSinMenu = 0
IF C0 AND C1
{
CALL &ASControl_C
CALL &SBControl_C
CALL &BPControl_C
}
ELSE
{
&ASMotor_C = 0
&SBMotor_C = 0
&BPMotor_C = 0
}
}


Var 9278, name InstrFlags, Link SUBRUTINE
{
IF &ASI_Fail = 0
{
&AS_FlagAS_C = CHANGEBIT 0, &Bat
IF &MachN >= 400
{
&AS_FlagM_C = CHANGEBIT 0, &Bat
}
ELSE
{
&AS_FlagM_C = 0
}
}
CALL &ASI_Fail
CALL &MachN
}

Var 9279 name Bat, Link FSUIPC_IN, Offset $281C, Length 4

Var 9280, name FSPause, Link FSUIPC_IN, Offset $0264, Length 2
{
CALL &MotorControls
}

Var 9281, name FSinMenu, Link FSUIPC_IN, Offset $3365, Length 1
{
CALL &MotorControls
}
2020-01-07 16:57
icon