Results 1 to 5 of 5
-
03-15-2011, 01:05 AM #1
- Join Date
- Feb 2006
- Location
- N/A
- Posts
- 458
SIOC Code for Elevator Trim, OC USBDCMotors, Project Magenta
Has anyone setup the elevator trim wheel using SIOC, OC USBDC Motors Card and Project Magenta? If so, would you mind sharing your SIOC code please?
Thank you
-
03-15-2011, 05:24 AM #2
- Join Date
- Jul 2013
- Posts
- 917
Re: SIOC Code for Elevator Trim, OC USBDCMotors, Project Magenta
Hi
Here is an example that I had in my "library". Thanks and credits to Manolo Velez and Herman Hummer. Do not know if it works, but should give you a start
David
Code:// ***************************************************************************** // * Config_SIOC ver 3.5 - By Manolo Vélez - www.opencockpits.com // ***************************************************************************** // // * Editor: Hermann Hummer www.simhard.eu.tt // // * FileName : Motorized_Throttle_1.385.txt // * Date : 8.3.2008 // * PM + PSS Airbus updated // * some variables shiftet // * manual Trim enabled when all AP of PM are disengaged // * Subroutine for motor movement starts every 50ms now // * Some improvements for AP: eg. when APP is active then V/S is set to -2000 // * PMDG variables changed esp. ALT-HOLD and SPEED-HOLD // * Pause modus is now dedected, so levers and trim stops in pause mode // * FeelThereAirbus with relais to connect levers to game port // * 2nd Mastercard and some inputs added for EFIS // * FSX Compatibility: Disconnect both LeverPotentiometers from FS when AP is on // * Variables for AIR-File different in FS9 and FSX // * Some improvements for LevelD FS9 & FSX // * FeelThere Airbus and FeelThere Boeing are recognised as different planes now // * VNAV sets IAS for LevelD // * Standard-AP OFF switches to Trim by Hand (eg. for FeelThere Airbus) // * LeverStart for FSX: Var 12 & 13 changed Why different to FS9 ???? FSUIPC ?? Var 1000, Value 0 // Initialisation { &Lever_Elevator = TIMER 999 , 0,5 // Subroutine for Lever and Elevator Motors starts every 50ms } Var 0004, name V1_385 // Version number Var 0000, name lever2_motor // Motor control Var 0001, name lever1_motor, value 1 // starts program Var 0002, name elevator_motor // Motor control // for FeelThereAirbus only Var 0003, name Relais // Relais switches from upper to lower printed board // The following variables depend on the used Potentiometers // You must check these values by using IOCPConsole for each Potentiometer // 1)for 100 percent thrust: 'LeverX_upper' 2)idle: 'LeverX_idle' 3)reverser: 'LeverX_lower'. // In this case the potentiometer values are the following: Var 0100, name Lever1_upper, Value 121 // Upper potentiometer value of Lever1 Var 0101, name Lever2_upper, Value 124 // Upper potentiometer value of Lever2 Var 0102, name Lever1_idle, Value 23 // Idle potentiometer value of Lever1 Var 0103, name Lever2_idle, Value 24 // Idle potentiometer value of Lever2 Var 0104, name Lever1_lower, Value 6 // Lower potentiometer value of Lever1 Var 0105, name Lever2_lower, Value 6 // Lower potentiometer value of Lever2 // Airbus only: Var 0106, name Lever1_CL, Value 65 // CL potentiometer value of Lever1 Var 0107, name Lever2_CL, Value 68 // CL potentiometer value of Lever2 Var 0108, name Lever1_FLX, Value 90 // FLX potentiometer value of Lever1 Var 0109, name Lever2_FLX, Value 93 // FLX potentiometer value of Lever2 Var 0014, name dead_area1 // to avoid jitter, we define a 'dead area' for the potentiometers Var 0015, name break_dist1 // how many points we need for break the motors to zero Var 0016, name current_break1 // we can define a break current for the motor Var 0017, name current_run1 // Speed for motor when running Var 0034, name dead_area2 Var 0035, name break_dist2 Var 0036, name current_break2 Var 0037, name current_run2 Var 0041, name dead_area3, Value 8 Var 0042, name break_dist3, Value 30 Var 0043, name current_break3, Value 40 Var 0044, name current_run3, Value 50 // Speed for motor when big difference Var 0110, name Lever1_factor // Distance FS / PointPot Var 0111, name Lever2_factor // Apply Distance_Pot to Distance FS Var 0112, name Pot1_factor // Distance Pot / PointPot Var 0113, name Pot2_factor // Apply Distance_Pot to Distance Lever Var 0038, name Flusi, Link FSUIPC_IN, Offset $3308, Length 2 // what Flusi-version is in use? { &dead_area1 = 5 // to avoid jitter, we define a 'dead area' for the potentiometers &break_dist1 = 20 // how many points we need for break the motors to zero ¤t_break1 = 50 // we can define a break current for the motor ¤t_run1 = 70 // Speed for motor when running &dead_area2 = 5 &break_dist2 = 20 ¤t_break2 = 50 ¤t_run2 = 70 } Var 0005, name Leverdiscon, Link FSUIPC_OUT, Offset $310A, Length 1 // Disconnect both LeverPotentiometers from FS Var 0045, name Lever1_from_FS, Link FSUIPC_OUT, Offset $3330, Length 2 Var 0046, name Lever2_from_FS, Link FSUIPC_OUT, Offset $3332, Length 2 Var 0060, name CL_PSS Var 0061, name FLX_PSS Var 0062, name TOGA_PSS // read the first four letters of the name of the airplane form AIR-file // to see if it is a standard- or non-standard plane Var 0140, name AIRFILE1, Link FSUIPC_IN, Offset $3c09, Length 1 // 1st letter of Airplane name in FS9 Var 0141, name AIRFILE2, Link FSUIPC_IN, Offset $3c0a, Length 1 // 2nd letter of Airplane name Var 0142, name AIRFILE3, Link FSUIPC_IN, Offset $3c0b, Length 1 // 3rd letter of Airplane name Var 0143, name AIRFILE4, Link FSUIPC_IN, Offset $3c0c, Length 1 // 4th letter of Airplane name Var 0144, name AIRFILE5, Link FSUIPC_IN, Offset $3c0d, Length 1 // 5th letter of Airplane name Var 0145, name AIRFILE6, Link FSUIPC_IN, Offset $3d00, Length 1 // 1st letter of Airplane name in FSX Var 0146, name AIRFILE7, Link FSUIPC_IN, Offset $3d01, Length 1 // 2nd letter of Airplane name Var 0147, name AIRFILE8, Link FSUIPC_IN, Offset $3d02, Length 1 // 3rd letter of Airplane name Var 0148, name AIRFILE9, Link FSUIPC_IN, Offset $3d03, Length 1 // 4th letter of Airplane name Var 0149, name AIRFILE10, Link FSUIPC_IN, Offset $3d04, Length 1 // 5th letter of Airplane name Var 0150, name AIRFILE11, Link FSUIPC_IN, Offset $3d05, Length 1 // 6th letter of Airplane name Var 0151, name AIRFILE12, Link FSUIPC_IN, Offset $3d06, Length 1 // 7th letter of Airplane name Var 0152, name AIRFILE13, Link FSUIPC_IN, Offset $3d07, Length 1 // 8th letter of Airplane name Var 0153, name AIRFILE14, Link FSUIPC_IN, Offset $3d08, Length 1 // 8th letter of Airplane name Var 0154, name AIRFILE15, Link FSUIPC_IN, Offset $3d09, Length 1 // 10th letter of Airplane name Var 0155, name AIRFILE16, Link FSUIPC_IN, Offset $3d0a, Length 1 // 11thletter of Airplane name Var 0156, name AIRFILE17, Link FSUIPC_IN, Offset $3d0b, Length 1 // 12letter of Airplane name Var 0157, name AIRFILE18, Link FSUIPC_IN, Offset $3d0c, Length 1 // 13thletter of Airplane name Var 0158, name AIRFILE19, Link FSUIPC_IN, Offset $3d0d, Length 1 // 14th letter of Airplane name Var 0159, name AIRFILE20, Link FSUIPC_IN, Offset $3d0e, Length 1 // 15thletter of Airplane name Var 0160, name AIRFILE21, Link FSUIPC_IN, Offset $3d0f, Length 1 // 16th letter of Airplane name // Variables for LevelD Var 0081, name IAS_Lvld Var 0082, name VS_Lvld Var 0083, name ALT_Lvld Var 0084, name APP_Lvld Var 0085, name N1_Lvld Var 0086, name SPD_Lvld Var 0087, name VNAV_Lvld // Variables for PM Var 0070, name IAS_PM Var 0071, name VS_PM Var 0072, name ALT_PM Var 0073, name APP_PM Var 0074, name N1_PM Var 0075, name SPD_PM Var 0076, name AT_PM Var 0077, name AP_L_PM Var 0078, name AP_C_PM Var 0079, name AP_R_PM Var 0114, name LOC_PM Var 0115, name LNAV_PM Var 0116, name VNAV_PM Var 0117, name HDG_PM Var 0118, name FLCH_PM Var 0119, name MACH_PM // Standard- or Non-Standard Planes? Var 0057, name PMDG // PMDG Var 0056, name LVLD // LevelD Var 0058, name PSS // PSS Airbus Var 0059, name PF // Project Fokker Var 0054, name Std // Standard Plane Var 0055, name PM // Project Magenta Var 0063, name FeelThere // FeelThere Airbus Var 0064, name APL_Lvld // Autopilot L LevelD Var 0065, name APC_Lvld // Autopilot C LevelD Var 0066, name APR_Lvld // Autopilot R LevelD Var 0067, name FLCH_Lvld // FlightLevelChange LevelD // LevelD: read MPC status from FSCONV 5.5. // Thanks to Nico Kaan for his great work! // www.nicokaan.nl Var 0092, name LvlD_Flg, Link FSUIPC_IN, Offset $8BAC, Length 4 { &APL_Lvld = TESTBIT &LvlD_Flg, 2 &APC_Lvld = TESTBIT &LvlD_Flg, 3 &APR_Lvld = TESTBIT &LvlD_Flg, 4 &VNAV_Lvld = TESTBIT &LvlD_Flg, 9 &FLCH_Lvld = TESTBIT &LvlD_Flg, 10 &VS_Lvld = TESTBIT &LvlD_Flg, 12 &ALT_Lvld = TESTBIT &LvlD_Flg, 13 &APP_Lvld = TESTBIT &LvlD_Flg, 15 &N1_Lvld = TESTBIT &LvlD_Flg, 17 &SPD_Lvld = TESTBIT &LvlD_Flg, 18 } Var 0095, name PMDG_Flg, Link FSUIPC_IN, Offset $62BC, Length 4 { // &VS_PMDG = TESTBIT &PMDG_Flg, 24 // &ALT_PMDG = TESTBIT &PMDG_Flg, 23 &APP_PMDG = TESTBIT &PMDG_Flg, 21 // &N1_PMDG = TESTBIT &PMDG_Flg, 15 // &SPD_PMDG = TESTBIT &PMDG_Flg, 16 // &CMD_A_PMDG = TESTBIT &PMDG_Flg, 8 &CMD_B_PMDG = TESTBIT &PMDG_Flg, 9 // &CWS_A_PMDG = TESTBIT &PMDG_Flg, 25 // &CWS_B_PMDG = TESTBIT &PMDG_Flg, 26 } // *** For ProjectMagenta Users: Var 0080, name PM_Flg, Link FSUIPC_IN, Offset $04F0, Length 2 { &IAS_PM = TESTBIT &PM_Flg, 9 &VS_PM = TESTBIT &PM_Flg, 2 &ALT_PM = TESTBIT &PM_Flg, 3 &APP_PM = TESTBIT &PM_Flg, 4 &N1_PM = TESTBIT &PM_Flg, 10 &SPD_PM = TESTBIT &PM_Flg, 9 &AT_PM = TESTBIT &PM_Flg, 11 &AP_L_PM = TESTBIT &PM_Flg, 0 &AP_C_PM = TESTBIT &PM_Flg, 1 &AP_R_PM = TESTBIT &PM_Flg, 13 &LOC_PM = TESTBIT &PM_Flg, 5 &LNAV_PM = TESTBIT &PM_Flg, 6 &VNAV_PM = TESTBIT &PM_Flg, 14 &HDG_PM = TESTBIT &PM_Flg, 7 &FLCH_PM = TESTBIT &PM_Flg, 8 &MACH_PM = TESTBIT &PM_Flg, 15 } // Variables for PMDG // Thanks for the Offset List to shadow.sp@gmx.net, http://members.chello.at/spatat/pmdg.htm Var 0091, name IAS_PMDG, Link FSUIPC_IN, Offset $621E, Length 2 // PMDG:is IAS_HOLD active? 0=arm,1=speed,2=n1 Var 0088, name ALT_PMDG, Link FSUIPC_IN, Offset $622A, Length 2 // PMDG: is ALT hold active? Values from 1 to 9 Var 0089, name AP_PMDG, Link FSUIPC_IN, Offset $6226, Length 2 // PMDG: is AP active 0=off,256=cws,512=cmd Var 0090, name VS_PMDG, Link FSUIPC_IN, Offset $6230, Length 2 // PMDG: is V/S active? Var 0093, name APP_PMDG Var 0094, name CMD_B_PMDG // Var 0097, name N1_PMDG Var 0098, name SPD_PMDG Var 0047, name IAS // is IAS_HOLD active? Var 0049, name ALT_hold // ist ALT_HOLD active? Var 0050, name APP // Autopilot APP-mode Var 0051, name N1 // Autopilot N1-mode Var 0052, name SPD // Autopilot Speed-hold-mode Var 0053, name VS // Autopilot V/S-mode // Variables for Standard Planes Var 0019, name Pause, Link FSUIPC_IN, Offset $0262, Length 2 // is Pause mode active? Var 0021, name ALT_STD, Link FSUIPC_IN, Offset $07D0, Length 4 // Standard planes: AutoPilot ALT hold active? Var 0022, name IAS_STD, Link FSUIPC_IN, Offset $07DC, Length 4 // Standard planes: is IAS_HOLD active? Var 0029, name APP_STD, Link FSUIPC_IN, Offset $07FC, Length 4 // is Glideslope hold active?(GS and APP exchanged!!) Var 0030, name TOGA, Link FSUIPC_IN, Offset $080C, Length 4 // is TO/GA switch active? Var 0048, name MACH, Link FSUIPC_IN, Offset $07E4, Length 4 // is MACH_HOLD active? Var 0039, name AP, Link FSUIPC_IN, Offset $07BC, Length 4 // is AutoPilot MasterSwitch active? Att: not in PSS & PM!! Var 0040, name GS, Link FSUIPC_IN, Offset $0800, Length 4 // is ApproachMode active? (GS and APP exchanged!!) Var 0020, name Trim_to_FS, Link FSUIPC_OUT, Offset $0BC0, Length 2 // Send value of PitchTrim to FS Var 0023, name Lever2_to_FS, Link FSUIPC_OUT, Offset $0932, Length 2 // Send value of Lever2 to FS Var 0024, name Lever1_to_FS, Link FSUIPC_OUT, Offset $089A, Length 2 // Send value of Lever1 to FS // Var 0023, name Lever2_to_FS, Link FSUIPC_OUT, Offset $3332, Length 2 // Send value of Lever2 to FS // Var 0024, name Lever1_to_FS, Link FSUIPC_OUT, Offset $3330, Length 2 // Send value of Lever1 to FS Var 0031, name EngineNumbers, Link FSUIPC_IN, Offset $0AEC, Length 2 // how many engines has the plane? Var 0032, name Lever3_to_FS, Link FSUIPC_OUT, Offset $09CA, Length 2 // Send value of Lever3 to FS Var 0033, name Lever4_to_FS, Link FSUIPC_OUT, Offset $0A62, Length 2 // Send value of Lever4 to FS Var 0097, name LEVER_START // Motor for levers should start Var 0096, name ELEV_START // Motor for elevator trim should start Var 0068, name lever2_diff // difference where the Lever2 is and where it should be Var 0069, name lever1_diff // difference where the Lever1 is and where it should be Var 0027, name corr_Trim_pos // Where ElevTrim should be (corrected to potentiometer values) Var 0028, name trim_diff // difference where the Trim is and where it should be Var 0013, Link FSUIPC_IN, name L1_target, Offset $088c, Length 2 // FSX: Where Lever1 should be // Var 0123, Link FSUIPC_IN, name L1_target_9, Offset $089a, Length 2 // FS9: Where Lever1 should be // Var 0013, Link FSUIPC_IN, name L1_target, Offset $3330, Length 2 // Where Lever1 should be { // becouse the potentiometer differ in value, we align the potentiometer value to the leverlength L0 = &Lever1_upper - &Lever1_idle // Upper Potentiomer Value - Idle Potentiomer Value L1 = 12800 / L0 // Distance Pot = 128 * 100 becouse in SIOC are no decimal values possible &Pot1_factor = L1 L0 = &Lever1_Pot - &Lever1_idle // Corrected value from Pot to FS L1 = L0 * &Pot1_factor // apply length lever to pot L1 = L1 / 100 // same as above, becouse of no decimal value possible L2 = &L1_target / 128 &Lever1_diff = L1 - L2 // where the lever is and where it should be IF &LEVER_START = 1 // A/T is on { IF &Flusi = 8 { &Leverdiscon = 192 // Disconnect both LeverPotentiometers from FS } CALL &MOTOR_LEVER // subroutine for motor motion } } Var 0012, Link FSUIPC_IN, name L2_target, Offset $0924, Length 2 // FSX: Where Lever2 should be // Var 0122, Link FSUIPC_IN, name L2_target_9, Offset $0932, Length 2 // FS9: Where Lever2 should be // Var 0012, Link FSUIPC_IN, name L2_target, Offset $3332, Length 2 // Where Lever2 should be { L0 = &Lever2_upper - &Lever2_idle // Upper Potentiomer Value - Idle Potentiomer Value L1 = 12800 / L0 // Distance Pot = 128 &Pot2_factor = L1 L0 = &Lever2_Pot - &Lever2_idle // Corrected value from Pot to FS L1 = L0 * &Pot2_factor L1 = L1 / 100 L2 = &L2_target / 128 &Lever2_diff = L1 - L2 IF &LEVER_START = 1 // A/T is on { IF &Flusi = 8 { &Leverdiscon = 192 } CALL &MOTOR_LEVER // subroutine for motor2 motion } } Var 0018, Link FSUIPC_IN, name Trim_target, Offset $0BC2, Length 2 // Where Elevator Trim should be { IF &Trim_target > 33000 { L0 = 81918 - &Trim_target // Trim down (49153 .. 65535) L1 = L0 / 128 // 65535 + 16383 = 81918 L1 = TRUNC L1 } ELSE { L0 = 16383 - &Trim_target // Trim up (0 .. 16383) L1 = L0 / 128 L1 = TRUNC L1 } &corr_Trim_pos = L1 &trim_diff = &corr_Trim_pos - &Trim_Pot } Var 0006, name Lever1_Pot, Link USB_ANALOGIC, Input 1, PosL 0, PosC 127, PosR 254 // Lever1 Pot position { L0 = &Lever1_upper - &Lever1_idle // Upper Potentiomer Value - Idle Potentiomer Value L1 = 16383 / L0 // Distance FS = 16383 L1 = TRUNC L1 &Lever1_factor = L1 L0 = &Lever1_Pot - &Lever1_idle // Corrected value from Pot to FS L1 = L0 * &Lever1_factor L1 = TRUNC L1 IF &LEVER_START = 0 // A/T is OFF { &lever1_motor = 0 // motor stops &Leverdiscon = 0 // Connect both LeverPotentiometers to FS IF &EngineNumbers <= 2 // here we look how many engines the plane has { &Lever1_to_FS = L1 // Send Lever1 Position to FS } IF &EngineNumbers = 4 { &Lever1_to_FS = L1 // Send Lever1 Position to FS &Lever2_to_FS = L1 // Send Lever2 Position to FS } } } Var 0007, name Lever2_Pot, Link USB_ANALOGIC, Input 2, PosL 0, PosC 127, PosR 254 // Lever2 Pot position { L0 = &Lever2_upper - &Lever2_idle // Upper Potentiomer Value - Idle Potentiomer Value L1 = 16383 / L0 // Distance FS = 16383 L1 = TRUNC L1 &Lever2_factor = L1 L0 = &Lever2_Pot - &Lever2_idle // Corrected value from Pot to FS L1 = L0 * &Lever2_factor L1 = TRUNC L1 IF &LEVER_START = 0 // A/T is OFF { &lever2_motor = 0 // motor stops &Leverdiscon = 0 // Connect both LeverPotentiometers to FS IF &EngineNumbers <= 2 // here we look how many engines the plane has { &Lever2_to_FS = L1 // Send Lever2 Position to FS } IF &EngineNumbers = 4 { &Lever3_to_FS = L1 // Send Lever3 Position to FS &Lever4_to_FS = L1 // Send Lever4 Position to FS } } } Var 0008, name Trim_Pot, Link USB_ANALOGIC, Input 3, PosL 0, PosC 128, PosR 254 // Trim Potentiometer position { L0 = &Trim_Pot * 128 L1 = 16383 - L0 IF &ELEV_START = 0 // Trimwheel steered by hand { &Trim_to_FS = L1 // send Trimwheel to FS &elevator_motor = 0 // Elevator motor stops } } Var 0120, name Lever_Elevator, Link SUBRUTINE // Subroutine for Lever and Trim Motor movement { // Dedection if Standard- or Non-Standard-Plane &PM = 0 IF &PM_Flg >= 1 { &PM = 1 // PM started } IF &PM = 0 { &PMDG = 0 IF &AIRFILE1 = 80 { IF &AIRFILE2 = 77 { IF &AIRFILE3 = 68 { IF &AIRFILE4 = 71 { &PMDG = 1 // Plane is PMDG } } } } &lvld = 0 IF &Flusi = 7 // FS2004 { IF &AIRFILE1 = 76 // l { IF &AIRFILE2 = 86 // v { IF &AIRFILE3 = 76 // l { IF &AIRFILE4 = 68 // d { &lvld = 1 // Plane is LevelD767 } } } } } IF &Flusi = 8 // FSX { IF &AIRFILE7 = 101 // E { IF &AIRFILE8 = 118 // V { IF &AIRFILE9 = 101 // E { IF &AIRFILE10 = 108 // L { &lvld = 1 // Plane is LevelD767 } } } } } &PSS = 0 IF &AIRFILE1 = 80 // P { IF &AIRFILE2 = 115 // S { IF &AIRFILE3 = 115 // S { IF &AIRFILE4 = 65 // A { &PSS = 1 // Plane is PSS Airbus (PSSA) } } } } &FeelThere = 0 IF &Flusi = 7 // FS2004 { IF &AIRFILE13 = 114 // r { IF &AIRFILE14 = 101 // e { IF &AIRFILE15 = 32 { IF &AIRFILE16 = 65 // A { &FeelThere = 1 // Plane is FeelThere Airbus } } } } } IF &Flusi = 8 // FSX { IF &AIRFILE13 = 114 // r { IF &AIRFILE14 = 101 // e { IF &AIRFILE15 = 32 { IF &AIRFILE16 = 65 // A { &FeelThere = 1 // Plane is FeelThere Airbus } } } } } IF &PMDG = 1 // PMDG Airplane { // &IAS = &IAS_PMDG // &N1 = &N1_PMDG // &ALT_hold = &ALT_STD // AP of PMDG often switches off ALT_HOLD so we use STD instead IF &IAS_PMDG >= 1 { &IAS = 1 } ELSE { &IAS = 0 } &APP = &APP_PMDG // ist APP_PMDG APP &VS = &VS_PMDG IF &ALT_PMDG >= 1 { &ALT_hold = 1 } ELSE { &ALT_hold = 0 } } IF &LVLD = 1 // LevelD Airplane { &IAS = &IAS_Lvld &ALT_hold = &ALT_Lvld &APP = &APP_Lvld &N1 = &N1_Lvld &SPD = &SPD_Lvld &VS = &VS_Lvld &IAS = &VNAV_Lvld } IF &PSS = 1 // PSS Aibus { &IAS = &IAS_STD // In this time all are Standard &ALT_hold = &ALT_STD // but shortly we will find adresses for PSS &APP = &GS // PSS uses GS instead of APP (or vice versa?) } IF &Std = 1 // Standard Airplane { &IAS = &IAS_STD &ALT_hold = &ALT_STD &APP = &APP_STD } } IF &PM = 1 // Project Magenta { &IAS = &IAS_PM &N1 = &N1_PM &SPD = &SPD_PM &ALT_hold = &ALT_STD // MCP often switches here to 0 but it should remain 1 !! So we use STD and not PM &APP = &APP_PM &VS = &VS_PM } &Std = 0 IF &PMDG = 0 { IF &LVLD = 0 { IF &PSS = 0 { IF &PF = 0 { IF &PM = 0 { &Std = 1 // FeelThere in the moment is standard plane } } } } } // Start Relais for FeelThere IF &FeelThere = 1 { &Relais = 120 } ELSE { &Relais = 0 } // now we look if the levermotors should start or stop &LEVER_START = 0 IF &Pause = 0 { IF &PSS = 0 // Airbus has no Motorized Throttles !! { IF &FeelThere = 0 { &LEVER_START = 1 } } } IF &IAS = 0 { IF &MACH = 0 { IF &TOGA = 0 { IF &FLCH_Lvld = 0 // When FLCH is set, LevelD switches SPD to 0, so Throttles would stop { IF &N1 = 0 { IF &SPD = 0 { &LEVER_START = 0 } } } } } } // now we look if the elevator motor should start or stop IF &Pause = 0 { IF &AP = 1 { &ELEV_START = 1 } ELSE { &ELEV_START = 0 } } ELSE { &ELEV_START = 0 } IF &ALT_hold = 0 // ALT hold is on { IF &APP = 0 // APP hold is on { IF &VS = 0 // V/S mode is on { IF &AP_L_PM = 0 // all AP of PM are off { IF &AP_C_PM = 0 { IF &AP_R_PM = 0 { IF &AP_PMDG = 0 // Autopilot PMDG is off { IF &APL_LvlD = 0 // Autopilot LevlD is off { IF &APC_LvlD = 0 { IF &APR_LvlD = 0 // { // IF &AP = 0 // Autopilot Standard is off { &ELEV_START = 0 // Elevator Motor stop } // } } } } } } } } } } IF &ELEV_START = 1 // Elevator Motor should start { CALL &Motor_Elevator // subroutine for motor motion } } Var 0125, name Motor_Lever, Link SUBRUTINE // USB_DC controls motors for Lever1&2 // Motor control 0-127 = left; 129-255 =Right; 0 stops { L0 = &lever1_diff L1 = 0 IF L0 < 0 { L1 = 128 // Motor run direction } L0 = ABS L0 L2 = ¤t_run1 + L1 // Lever1 Motor runs with full current IF L0 <= &break_dist1 { L2 = ¤t_break1 + L1 // Lever1 Motor runs with break current } L0 = ABS L0 IF L0 <= &dead_area1 { L2 = 0 } IF &LEVER_START = 0 { L2 = 0 // Lever1 Motor stops } &lever1_motor = L2 L0 = &lever2_diff L1 = 128 IF L0 < 0 { L1 = 0 } L0 = ABS L0 L2 = ¤t_run2 + L1 // Lever2 Motor runs with full current IF L0 <= &break_dist2 { L2 = ¤t_break2 + L1 // Lever2 Motor runs with break current } L0 = ABS L0 IF L0 <= &dead_area2 { L2 = 0 } IF &LEVER_START = 0 { L2 = 0 // Lever2 Motor stops } &lever2_motor = L2 } Var 0130, name Motor_Elevator, Link SUBRUTINE // USB_DC controls motor for Elevator // Motor control 0-127=left, 128 stops, 129-255=right { L0 = &trim_diff IF &Flusi = 7 // FS2004 { IF L0 < 0 { L1 = 128 } ELSE { L1 = 0 } } IF &Flusi = 8 // FSX { IF L0 > 0 { L1 = 0 } ELSE { L1 = 128 } } L0 = ABS L0 L2 = ¤t_break3 + L1 IF L0 <= &break_dist3 { L2 = ¤t_run3 + L1 } L0 = ABS L0 IF L0 <= &dead_area3 { L2 = 0 } IF &ELEV_START = 0 // Motor Elevator trim stop { L2 = 0 } &elevator_motor = L2 }
-
03-15-2011, 10:47 AM #3
- Join Date
- Dec 2006
- Location
- Israel
- Posts
- 126
Re: SIOC Code for Elevator Trim, OC USBDCMotors, Project Magenta
I used the bit older version of this script with usb OC dcmotors card and Magenta , and can confirm --works
Regards and tnx for updated script--no way to get this one those days
Joseph
-
02-05-2013, 02:39 PM #4
- Join Date
- Jan 2012
- Location
- SPAIN
- Posts
- 3
Re: SIOC Code for Elevator Trim, OC USBDCMotors, Project Magenta
-
02-05-2013, 02:45 PM #5
- Join Date
- Jan 2012
- Location
- SPAIN
- Posts
- 3
Re: SIOC Code for Elevator Trim, OC USBDCMotors, Project Magenta
Hello Joseph.
I use Airbus, Project Magenta, OpenCockpits dcmotorplus and FSX.
I little question: Do you have to erase or change something in this script (related with FS9, PSS, PMDG...)?
Thanks and best regards.
Emilio
Similar Threads
-
B73x Elevator Trim
By shearder in forum Cockpit Parts and Motion PlatformsReplies: 0Last Post: 12-06-2009, 04:08 PM -
SIOC Elevator Pot Code
By tomenglish2000 in forum OpenCockpits General DiscussionReplies: 0Last Post: 09-28-2009, 06:26 AM -
Elevator trim
By hercules in forum PM General Q & AReplies: 0Last Post: 01-26-2009, 01:00 PM -
Working Sioc code for elevator/ Ailerons
By hercules in forum OpenCockpits General DiscussionReplies: 0Last Post: 01-25-2009, 08:28 PM -
Configure MCP of Opencockpits with MCP of Project Magenta and file sioc. Help me.
By paoloj in forum OpenCockpits General DiscussionReplies: 3Last Post: 08-15-2008, 03:29 AM