PDA

View Full Version : Problem with home made MCP



Jerrymc3
06-11-2013, 11:48 AM
I built a B747-400 MCP using Open Cockpits displays and encoders. When I turn the IAS/MAC encoder the V/S display blinks and sometimes changes, the IAS/MAC display doesn't want to increase unless I turn it very slowly. I changed my Mastercard and Display card but apparently that wasn't the problem. I checked continuity on my cables. There must be something in my SIOC code causing the problem but I can't find it. Could someone check my code and see if there is a problem? I copied this file from Manlol Velez and changed the input/output numbers to match mine.

// *****************************************************************************
// * Config_SIOC ver 3.5 - By Manolo Vélez - www.opencockpits.com
// *****************************************************************************
// * FileName : sioc mcp magenta w_bat.txt
// * Date : 14/09/2009



Var 0000, Value 0
{
&COURSE_1_DISP = 360
&COURSE_2_DISP = 360
&HEADING_DISP = 360
&ALTITUDE_DISP = 10000
&MEMALT = 10000
&MCP_BUTTONS_I = SETBIT 23
&PM_IAS = &IAS
&PM_MACH = &MACH
&SPEED_DISP = &IAS
}

Var 0002, name VS_IN, Link FSUIPC_IN, Offset $04E6, Length 2, Type 1
{
&TEMP_VS = &VS_IN
CALL &SHOW_VS
}

Var 0004, name MCP_IND, Link FSUIPC_IN, Offset $051C, Length 2
{
C0 = TESTBIT &MCP_IND ,0
IF C0
{
&VS_DISP = -999999
&VS_SIGN_DISP = -999999
}
ELSE
{
CALL &SHOW_VS
}
}

Var 0006, name MCP_LIGHTS, Link FSUIPC_IN, Offset $04F0, Length 2
{
&VS_LED = TESTBIT &MCP_LIGHTS ,2
&AT_LED = TESTBIT &MCP_LIGHTS ,11
&SPEED_LED = TESTBIT &MCP_LIGHTS ,9
&THR_LED = TESTBIT &MCP_LIGHTS ,10
&ALT_HLD_LED = TESTBIT &MCP_LIGHTS ,3
&APP_LED = TESTBIT &MCP_LIGHTS ,4
&VOR_LOC_LED = TESTBIT &MCP_LIGHTS ,5
&LNAV_LED = TESTBIT &MCP_LIGHTS ,6
&HEADING_LED = TESTBIT &MCP_LIGHTS ,7
&FL_CH_LED = TESTBIT &MCP_LIGHTS ,8
&VNAV_LED = TESTBIT &MCP_LIGHTS ,14
&CMD_1_LED = TESTBIT &MCP_LIGHTS ,0
&CMD_2_LED = TESTBIT &MCP_LIGHTS ,1
C0 = TESTBIT &MCP_LIGHTS ,15
IF C0
{
&PM_MACH = &MACH
&DECIMAL_POINT = 1
CALL &SHOW_SPEED
}
ELSE
{
&PM_IAS = &IAS
&DECIMAL_POINT = 0
CALL &SHOW_SPEED
}
}

Var 0008, name IAS, Link FSUIPC_IN, Offset $04E0, Length 2
{
CALL &SHOW_SPEED
}

Var 0010, name MACH, Link FSUIPC_IN, Offset $04E8, Length 2
{
CALL &SHOW_SPEED
}

Var 0012, name MCP_BUTTONS_I, Link FSUIPC_OUT, Offset $5410, Length 4

Var 0014, name MCP_BUTTONS_II, Link FSUIPC_OUT, Offset $5414, Length 4

Var 0016, name VS_OUT, Link FSUIPC_OUT, Offset $540C, Length 2, Type 1

Var 0018, name MCP_BUTTONS, Link FSUIPC_OUT, Offset $5414, Length 4

Var 0020, name COURSE_1, Link FSUIPC_OUT, Offset $0C4E, Length 2

Var 0022, name HEADING, Link FSUIPC_OUT, Offset $5408, Length 2

Var 0024, name ALTITUDE, Link FSUIPC_OUT, Offset $540A, Length 2

Var 0026, name PM_IAS, Link FSUIPC_OUT, Offset $5406, Length 2

Var 0028, name PM_MACH, Link FSUIPC_OUT, Offset $540E, Length 2

Var 0029, name COURSE_2, Link FSUIPC_OUT, Offset $0C5E, Length 2

Var 0031, name FS_BAT, Link FSUIPC_INOUT, Offset $281C, Length 4
{
IF &FS_BAT = 0
{
&ALTITUDE_DISP = -999999
&COURSE_1_DISP = -999999
&COURSE_2_DISP = -999999
&DECIMAL_POINT = 0
&HEADING_DISP = -999999
&SPEED_DISP = -999999
&VS_DISP = -999999
&VS_SIGN_DISP = -999999
}
ELSE
{
&ALTITUDE_DISP = &MEMALT
&COURSE_1_DISP = &MEMCRS1
&COURSE_2_DISP = &MEMCRS2
&HEADING_DISP = &MEMHDG
CALL &SHOW_SPEED
CALL &SHOW_VS
}
}

Var 0032, name AT_SW, Link IOCARD_SW, Input 11
{
IF &AT_SW = 1
{
&MCP_BUTTONS_I = TOGGLE 19
}
ELSE
{
&MCP_BUTTONS_I = TOGGLE 20
}
}

Var 0034, name FD_CP_SW, Link IOCARD_SW, Input 15
{
IF &FD_CP_SW = 1
{
&MCP_BUTTONS_II = TOGGLE 5
}
ELSE
{
&MCP_BUTTONS_II = TOGGLE 6
}
}

Var 0036, name VS_SW, Link IOCARD_SW, Input 9, Type P
{
&MCP_BUTTONS = CHANGEBIT 11 ,&VS_SW
}

Var 0038, name SPEED_SW, Link IOCARD_SW, Input 13, Type P
{
&MCP_BUTTONS_I = CHANGEBIT 22 ,&SPEED_SW
}

Var 0039, name SPD_MAC_SEL, Link IOCARD_SW, Input 68, Type P
{
&MCP_BUTTONS_I = CHANGEBIT 23 ,&SPD_MAC_SEL
}

Var 0040, name THR_SW, Link IOCARD_SW, Input 14, Type P
{
&MCP_BUTTONS_I = CHANGEBIT 21 ,&THR_SW
}

Var 0042, name FL_CH_SW, Link IOCARD_SW, Input 16, Type P
{
&MCP_BUTTONS_I = CHANGEBIT 24 ,&FL_CH_SW
}

Var 0044, name HEADING_SW, Link IOCARD_SW, Input 26, Type P
{
&MCP_BUTTONS_I = CHANGEBIT 25 ,&HEADING_SW
}

Var 0045, name HEADING_SEL, Link IOCARD_SW, Input 57, Type P
{
&MCP_BUTTONS_I = CHANGEBIT 11 ,&HEADING_SEL
}


Var 0046, name ALT_HOLD_SW, Link IOCARD_SW, Input 10, Type P
{
&MCP_BUTTONS_I = CHANGEBIT 30 ,&ALT_HOLD_SW
}

Var 0047, name ALT_HOLD_SEL, Link IOCARD_SW, Input 62, Type P
{
&MCP_BUTTONS_I = CHANGEBIT 12 ,&ALT_HOLD_SW
}

Var 0048, name APP_SW, Link IOCARD_SW, Input 21, Type P
{
&MCP_BUTTONS_I = CHANGEBIT 29 ,&APP_SW
}

Var 0050, name VOR_LOC_SW, Link IOCARD_SW, Input 22, Type P
{
&MCP_BUTTONS_I = CHANGEBIT 28 ,&VOR_LOC_SW
}

Var 0052, name LNAV_SW, Link IOCARD_SW, Input 12, Type P
{
&MCP_BUTTONS_I = CHANGEBIT 27 ,&LNAV_SW
}

Var 0054, name VNAV_SW, Link IOCARD_SW, Input 17, Type P
{
&MCP_BUTTONS_I = CHANGEBIT 26 ,&VNAV_SW
}

Var 0056, name DISENGAGE_SW, Link IOCARD_SW, Input 27
{
IF &DISENGAGE_SW = 1
{
&MCP_BUTTONS = TOGGLE 8
}
ELSE
{
&MCP_BUTTONS = TOGGLE 9
}
}

Var 0058, name CMD_1_SW, Link IOCARD_SW, Input 20, Type P
{
&MCP_BUTTONS = CHANGEBIT 0 ,&CMD_1_SW
}

Var 0060, name CMD_2_SW, Link IOCARD_SW, Input 19, Type P
{
&MCP_BUTTONS = CHANGEBIT 1 ,&CMD_2_SW
}

Var 0062, name CO_SW, Link IOCARD_SW, Input 13, Type P
{
&MCP_BUTTONS_I = CHANGEBIT 23 ,&CO_SW
}

Var 0064, name FD_FO_SW, Link IOCARD_SW, Input 14
{
IF &FD_FO_SW = 1
{
&MCP_BUTTONS_I = TOGGLE 17
}
ELSE
{
&MCP_BUTTONS_I = TOGGLE 18
}
}

Var 0066, name VS_ENC, Link IOCARD_ENCODER, Input 54, Aceleration 4, Type 2
{
L0 = &VS_ENC * 100
&TEMP_VS = ROTATE -9000 ,9000 ,L0
&VS_OUT = &TEMP_VS
}

Var 0068, name COURSE_1_ENC, Link IOCARD_ENCODER, Input 102, Aceleration 4, Type 2
{
L0 = &COURSE_1_ENC * -1
&COURSE_1_DISP = ROTATE 0 ,359 ,L0
&MEMCRS1 = ROTATE 0 ,359 ,L0
}

Var 0070, name SPEED_ENC, Link IOCARD_ENCODER, Input 51, Aceleration 4, Type 2
{
L0 = &SPEED_ENC * -1
C0 = TESTBIT &MCP_LIGHTS ,15
IF C0
{
&PM_MACH = LIMIT 25 ,95 ,L0
}
ELSE
{
&PM_IAS = LIMIT 0 ,340 ,L0
}
}

Var 0072, name HEADING_ENC, Link IOCARD_ENCODER, Input 60, Aceleration 4, Type 2
{
L0 = &HEADING_ENC * -1
&HEADING_DISP = ROTATE 0 ,359 ,L0
&MEMHDG = ROTATE 0 ,359 ,L0
}

Var 0074, name ALTITUDE_ENC, Link IOCARD_ENCODER, Input 58, Aceleration 4, Type 2
{
L0 = &ALTITUDE_ENC * 100
&ALTITUDE_DISP = LIMIT 0 ,50000 ,L0
&MEMALT = LIMIT 0 ,50000 ,L0
}

Var 0076, name COURSE_2_ENC, Link IOCARD_ENCODER, Input 106, Aceleration 4, Type 2
{
L0 = &COURSE_2_ENC * -1
&COURSE_2_DISP = ROTATE 0 ,359 ,L0
&MEMCRS2 = ROTATE 0 ,359 ,L0
}

Var 0078, name VS_DISP, Link IOCARD_DISPLAY, Digit 6, Numbers 4

Var 0080, name COURSE_1_DISP, Link IOCARD_DISPLAY, Digit 0, Numbers 3
{
&COURSE_1 = &COURSE_1_DISP
}

Var 0082, name SPEED_DISP, Link IOCARD_DISPLAY, Digit 0, Numbers 3

Var 0084, name HEADING_DISP, Link IOCARD_DISPLAY, Digit 3, Numbers 3
{
&HEADING = &HEADING_DISP
}

Var 0086, name ALTITUDE_DISP, Link IOCARD_DISPLAY, Digit 11, Numbers 5
{
&ALTITUDE = &ALTITUDE_DISP / 100
}

Var 0090, name COURSE_2_DISP, Link IOCARD_DISPLAY, Digit 19, Numbers 3
{
&COURSE_2 = &COURSE_2_DISP
}

Var 0094, name VS_SIGN_DISP, Link IOCARD_DISPLAY, Digit 10, Numbers 1

Var 0096, name AT_LED, Link IOCARD_OUT, Output 22

Var 0098, name VS_LED, Link IOCARD_OUT, Output 28

Var 0100, name SPEED_LED, Link IOCARD_OUT, Output 22

Var 0102, name THR_LED, Link IOCARD_OUT, Output 18

Var 0104, name ALT_HLD_LED, Link IOCARD_OUT, Output 44

Var 0106, name APP_LED, Link IOCARD_OUT, Output 20

Var 0108, name VOR_LOC_LED, Link IOCARD_OUT, Output 12

Var 0110, name LNAV_LED, Link IOCARD_OUT, Output 30

Var 0112, name HEADING_LED, Link IOCARD_OUT, Output 16

Var 0114, name FL_CH_LED, Link IOCARD_OUT, Output 14

Var 0116, name VNAV_LED, Link IOCARD_OUT, Output 24

Var 0118, name CMD_1_LED, Link IOCARD_OUT, Output 46

Var 0120, name CMD_2_LED, Link IOCARD_OUT, Output 26

Var 0122, name DECIMAL_POINT, Link IOCARD_OUT, Output 19

Var 0124, name TEMP_VS

Var 0126, name SHOW_VS, Link SUBRUTINE
{
C0 = TESTBIT &MCP_IND ,0
C0 = NOT C0
IF C0
{
IF &TEMP_VS < 0
{
L0 = ABS &TEMP_VS
&VS_SIGN_DISP = -999998
}
ELSE
{
&VS_SIGN_DISP = -999999
L0 = &TEMP_VS
}
&VS_DISP = L0
}
}

Var 0128, name SHOW_SPEED, Link SUBRUTINE
{
C0 = TESTBIT &MCP_LIGHTS ,15
IF C0
{
&DECIMAL_POINT = 1
&SPEED_DISP = &MACH
}
ELSE
{
&DECIMAL_POINT = 0
&SPEED_DISP = &IAS
}
C1 = TESTBIT &MCP_LIGHTS ,14
IF C1
{
&SPEED_DISP = -999999
}
}

Var 0130, name MEMCRS1

Var 0132, name MEMHDG

Var 0134, name MEMALT

Var 0136, name MEMCRS2

fordgt40
06-11-2013, 12:26 PM
There are some errors in your arguments for the iocard_display functions - you have two entries for digit 0. More importantly, are you using Project Magenta software?

EDIT

I see from an earlier post that you are using PM - always best to ask the simple questions first

Are you using the OC encoders in your MCP, if so, I suggest you change your code to "acceleration 1" and see what happens

You also need to recheck your code - a quick scan shows that you have two entries for Output 22

Jerrymc3
06-11-2013, 01:10 PM
Thanks for the quick reply. I have to leave for a couple of hours but I'll let you know what happens.

Jerrymc3
06-11-2013, 08:51 PM
I discovered that my IAS encoder is turning on a couple of outputs so I must have some wires crossed or touching something they shouldn't.