PDA

View Full Version : PM MCP SIOC Script



MortenHa
01-21-2009, 06:33 AM
Hi fellow simbuilders!

Been searching the forum both here and at OC for a PM MCP&EFIS Script. So far no luck :(.

There's a script bundled with the SIOC installation, but it is in spanish.

Could anyone point me in the right direction?

Thanx in advance :)


Morten

MortenHa
01-27-2009, 03:44 PM
If you take the easy way out, you'll learn nothing. Case in point:

I took the bull by the horns, and started deciphering Manolo Vélez MCP2.TXT that comes with the SIOC package. Even though he made it back in 2004 using 1.95 Beta version. The script is good by any programming standard, and I like the way he thinks (got some progamming skills).

But Im running in to some contradicting lines of code. Look at this

line 32:

Var 0001, Link FSUIPC_IN, Offset $04E6, Length 2, Type 1 // VS de entrada

This variable declaration statement contains a parameter that shouldn't be there right?

Being linked as FSUIPC_IN, the "Type 1" parameter seem out of place?

I thought that the Type modifier is only used with IOCARD_ hw link statements?

Looking at the PM offset , it's a read from current V/S value, makes no sense.
Manolo must have made a mistake here, the script compiles either way.

Any thoughts?

I could ask him, but it might an interesting thread:D

I'll post the script with comments in in english when I'm done:)

Kennair
01-27-2009, 06:55 PM
Hi Morten,

I did this translating saga for most of Manolo's scripts just to make it a little more intelligible. Easy to do but just takes time.

As for the errant "Type 1" entry in your script, I've checked the same file in my SIOC directory but it doesn't contain this error. Manolo is a very clever man and I'm sure very thorough so are you sure this wasn't accidentally added by someone else? Never the less your assumption is correct, it shouldn't be there.

EDIT: Sorry I just read your post more carefully and see you mention the MCP2.txt file which indeed does contain this error. There is also a file in the directoryt called MCP.txt which has this entry removed. Not sure what Manolo would have been intending with these two files?

Ken.

kiek
01-28-2009, 04:00 AM
Var 0001, Link FSUIPC_IN, Offset $04E6, Length 2, Type 1 // VS de entrada

This variable declaration statement contains a parameter that shouldn't be there right? Being linked as FSUIPC_IN, the "Type 1" parameter seem out of place?

No, this Attribute - Value pair (not a parameter ;-) ) is perfectly allright. (and otherwise the config-sioc compiler would have complained about it). It means that SIOC will interpret the FSUIPC offset as a signed integer. If you omit Type 1 it will assume unsigned (default).

http://www.lekseecon.nl/howto.html#readFSUIPC

regards,
Nico Kaan

MortenHa
02-07-2009, 12:42 PM
Thanx Nico!
It makes total sense. But I can't remember it mentioned in any of the SIOC literature! Except yours of course.

By the way, I remember you from the Opencockpits forum several years ago. Your postings at the time showed a keen interest in the SIOC language.

You have come a long way since then:) You are now a SIOC guru! Cudos.

MrRoper
02-13-2009, 06:09 PM
here is a good mcp script modified by myself

It has a few tweaks, the course, heading and altitude rotaries use a timer mechanism to allow fast changes

and I use different offsets for hdg and latitude reads, so that they work properly when LNAV and VNAV is selected..hope it helps :)


// *****************************************************************************
// * Config_SIOC ver 3.41 - By Manolo Vélez - www.opencockpits.com
// *****************************************************************************
// * FileName : sioc.txt Versión 1.1
// * Date : 29/06/2007
// * COnfiguración para MCP opencockpits para 738 PMDG por
// * Xavier Baca VAE403 y Vicente Barrón VAE401 (airexplorer.aeria.org)
// * Se debe modificar sioc.ini en el KEYBOARD EMULATOR MODULE
// * y configurar la assignación de teclas en el PMDG
// * Adaptación del original de DeMadagascar

// __________________________________________________________________
// Inicialización variables
//____________________________________________________________________


Var 0001, name keys, Link KEYS // variable transfert emulateur clavier ( SIOC.INI)

Var 0002, name MEMHDG, Value 0

Var 0003, name IAS, Link FSUIPC_IN, Offset $02BC, Length 4

Var 0004, name MACH, Link FSUIPC_IN, Offset $11C6, Length 2

Var 0005, name MEMALT, Value 10000


// __________________________________________________________________
// Salidas IOCARD Leds
//____________________________________________________________________


Var 0010, name FDLEFTled, Link IOCARD_OUT, Output 39

Var 0011, name ATled, Link IOCARD_OUT, Output 22

Var 0012, name N1led, Link IOCARD_OUT, Output 21

Var 0013, name SPEEDled, Link IOCARD_OUT, Output 23

Var 0014, name LVLCHGled, Link IOCARD_OUT, Output 24

Var 0015, name HDGled, Link IOCARD_OUT, Output 26

Var 0016, name VNAVled, Link IOCARD_OUT, Output 25

Var 0017, name LNAVled, Link IOCARD_OUT, Output 29

Var 0018, name VORLOCled, Link IOCARD_OUT, Output 28

Var 0019, name APPled, Link IOCARD_OUT, Output 27

Var 0020, name ALTHOLDled, Link IOCARD_OUT, Output 30

Var 0021, name VSled, Link IOCARD_OUT, Output 31

Var 0022, name CMDAled, Link IOCARD_OUT, Output 33

Var 0023, name CMDBled, Link IOCARD_OUT, Output 35

Var 0024, name CWSAled, Link IOCARD_OUT, Output 32

Var 0025, name CWSBled, Link IOCARD_OUT, Output 34

Var 0026, name VSminus, Link IOCARD_OUT, Output 45

Var 0027, name IASpoint, Link IOCARD_OUT, Output 20


// __________________________________________________________________
// Salidas IOCARD Displays
//___________________________________________________________________

Var 0030, name CRSLEFTdisplay, Link IOCARD_DISPLAY, Digit 0, Numbers 3

Var 0031, name IASdisplay, Link IOCARD_DISPLAY, Digit 3, Numbers 3

Var 0032, name HDGdisplay, Link IOCARD_DISPLAY, Digit 6, Numbers 3

Var 0033, name ALTdisplay, Link IOCARD_DISPLAY, Digit 9, Numbers 5

Var 0034, name VSdisplay, Link IOCARD_DISPLAY, Digit 14, Numbers 5

Var 0035, name CRSRdisplay, Link IOCARD_DISPLAY, Digit 19, Numbers 3

// __________________________________________________________________
// Entradas FSUIPC del MCP B737-800 PMDG ( Infos Leds )
//___________________________________________________________________


Var 0040, name MCPstatus, Link FSUIPC_IN, Offset $62BC, Length 4
{
&FDLEFTled = TESTBIT &MCPstatus ,12
&ATled = TESTBIT &MCPstatus ,14
&N1led = TESTBIT &MCPstatus ,15
&SPEEDled = TESTBIT &MCPstatus ,16
&VNAVled = TESTBIT &MCPstatus ,18
&LVLCHGled = TESTBIT &MCPstatus ,17
&HDGled = TESTBIT &MCPstatus ,22
&LNAVled = TESTBIT &MCPstatus ,19
&VORLOCled = TESTBIT &MCPstatus ,20
&APPled = TESTBIT &MCPstatus ,21
&ALTHOLDled = TESTBIT &MCPstatus ,23
&VSled = TESTBIT &MCPstatus ,24
&CMDAled = TESTBIT &MCPstatus ,8
&CMDBled = TESTBIT &MCPstatus ,9
&CWSAled = TESTBIT &MCPstatus ,25
&CWSBled = TESTBIT &MCPstatus ,26
CALL &HDGaff
CALL &IASaff
CALL &ALTaff
CALL &VSaff
}
Var 0041, name SPDINTV, Link FSUIPC_IN, offset $62C0, Length 1
{
CALL &IASaff
}

Var 0042, name COstatus, Link FSUIPC_IN, offset $621e, Length 2
{
CALL &IASaff
}

// __________________________________________________________________
// Entradas FSUIPC del MCP B737-800 PMDG ( Infos Displays )
//___________________________________________________________________

Var 0050, name CRSpmdg, Link FSUIPC_IN, Offset $0C4E, Length 2
{
IF &CRSpmdg = 360
{
&CRSLEFTdisplay = 0
}
ELSE
{
&CRSLEFTdisplay = &CRSpmdg
}
}

Var 0051, name IASpmdg, Link FSUIPC_IN, Offset $6220, Length 2
{
CALL &IASaff
}

Var 0052, name hdgpmdg, Link FSUIPC_IN, Offset $62AD, Length 2
{
CALL &HDGaff
}

Var 0053, name ALTpmdg, Link FSUIPC_IN, Offset $62B9, Length 2
{
CALL &ALTaff
}

Var 0054, name VSpmdg, Link FSUIPC_IN, Offset $6230, Length 2
{
CALL &VSaff
}

Var 0055, name CRS2pmdg, Link FSUIPC_IN, Offset $0C4E, Length 2
{
IF &CRS2pmdg = 360
{
&CRSRdisplay = 0
}
ELSE
{
&CRSRdisplay = &CRS2pmdg
}
}


// __________________________________________________________________
// Entradas IOCARD Interruptores & bp (button press)
//___________________________________________________________________


Var 0060, name FDswitch, Link IOCARD_SW, Input 16
{
IF &FDswitch = 1
{
IF &FDLEFTled = 0
{
&keys = 56
&keys = 0
}
}
ELSE
{
IF &FDswitch = 0
{
IF &FDLEFTled = 1
{
&keys = 56
&keys = 0
}
}
}
}

Var 0061, name ATswitch, Link IOCARD_SW, Input 33
{
IF &ATswitch = 1
{
IF &ATled = 0
{
&keys = 44
&keys = 0
}
}
ELSE
{
IF &ATswitch = 0
{
IF &ATled = 1
{
&keys = 44
&keys = 0
}
}
}
}


Var 0062, name N1bp, Link IOCARD_SW, Input 32
{
IF &N1bp = 1
{
&keys = 61
&keys = 0
}
}

Var 0063, name SPEEDbp, Link IOCARD_SW, Input 31
{
IF &SPEEDbp = 1
{
&keys = 51
&keys = 0
}
}

Var 0064, name VNAVbp, Link IOCARD_SW, Input 30
{
IF &VNAVbp = 1
{
&keys = 57
&keys = 0
}
}


Var 0065, name LVLCHGbp, Link IOCARD_SW, Input 29
{
IF &LVLCHGbp = 1
{
&keys = 59
&keys = 0
}
}

Var 0066, name HDGbp, Link IOCARD_SW, Input 28
{
IF &HDGbp = 1
{
&keys = 62
&keys = 0
}
}

Var 0067, name LNAVbp, Link IOCARD_SW, Input 27
{
IF &LNAVbp = 1
{
&keys = 69
&keys = 0
}
}

Var 0068, name VORLOCbp, Link IOCARD_SW, Input 25
{
IF &VORLOCbp = 1
{
&keys = 70
&keys = 0
}
}

Var 0069, name APPbp, Link IOCARD_SW, Input 24
{
IF &APPbp = 1
{
&keys = 63
&keys = 0
}
}

Var 0070, name ALTHOLDbp, Link IOCARD_SW, Input 23
{
IF &ALTHOLDbp = 1
{
&keys = 64
&keys = 0
}
}

Var 0071, name VSbp, Link IOCARD_SW, Input 22
{
IF &VSbp = 1
{
&keys = 58
&keys = 0
}
}

Var 0072, name CMDAbp, Link IOCARD_SW, Input 21
{
IF &CMDAbp = 1
{
&keys = 66
&keys = 0
}
}

Var 0073, name CMDBbp, Link IOCARD_SW, Input 19, Type I
{

&FO_JoyStick64 = CHANGEBIT 0 1
&FO_JoyStick64 = CHANGEBIT 0 0
}

Var 0074, name CWSAbp, Link IOCARD_SW, Input 20
{
IF &CWSAbp = 1
{
&keys = 65
&keys = 0
}
}

Var 0075, name CWSBbp, Link IOCARD_SW, Input 18
{
IF &CWSBbp = 1
{
&keys = 68
&keys = 0
}
}

Var 0076, name APDISCObp, Link IOCARD_SW, Input 15
{
IF &APDISCObp = 1
{
&keys = 26
&keys = 0
}
ELSE
{
&keys = 26
&keys = 0
}
}

Var 0077, name CObp, Link IOCARD_SW, Input 13
{
IF &CObp = 1
{
&keys = 60
&keys = 0
}
}

Var 0078, name FDRswitch, Link IOCARD_SW, Input 14
{
IF &FDRswitch = 1
{
&keys = 73
&keys = 0
}
ELSE
{
&keys = 73
&keys = 0
}
}


// __________________________________________________________________
// Entradas IOCARD Encoders
//___________________________________________________________________

var 9993, name tempCrseft, value 0
var 9994, name LastCsrLtRot, value 0

var 8102, name PlusCrsLeft, Link SUBRUTINE
{
&CRSRdisplay = &PlusCrsLeft
&tempCrseft = &PlusCrsLeft

if &tempCrseft = &LastCsrLtRot
{
&tempCrseft = 0
}
if &PlusCrsLeft > 0
{
&keys = 45
&keys = 0
}
}

var 8103, name MinusCsrLeft, Link SUBRUTINE
{
&tempCrseft = &MinusCsrLeft

if &tempCrseft = &LastCsrLtRot
{
&tempCrseft = 0
}
if &MinusCsrLeft > 0
{
&keys = 46
&keys = 0
}
}

Var 0080, name CRSLEFTrt, Link IOCARD_ENCODER, Input 4, Aceleration 8, Type 2
{

if &CRSLEFTrt > 0
{
IF &tempCrseft = 0
{
&LastCsrLtRot = &CRSLEFTrt
&PlusCrsLeft = 0
&PlusCrsLeft = TIMER &CRSLEFTrt 1 1
}
}
else
{

IF &tempCrseft = 0
{
L1 = &CRSLEFTrt * -1
&LastCsrLtRot = L1
&MinusCsrLeft = 0
&MinusCsrLeft = TIMER L1 1 1
}
}
}

Var 0081, name IASrot, Link IOCARD_ENCODER, Input 0, Aceleration 1, Type 2
{
IF &IASrot = 1
{
&keys = 49
&keys = 0
}
ELSE
{
&keys = 50
&keys = 0
}
}

var 9991, name temphdg, value 0
var 9992, name LastHDGRot, value 0
var 8100, name Plus, Link SUBRUTINE
{
&temphdg = &plus

if &temphdg = &LastHDGRot
{
&temphdg = 0
}
if &plus > 0
{
&KEYS = 47
&KEYS = 0
}
}

var 8101, name Minus, Link SUBRUTINE
{
&temphdg = &Minus

if &temphdg = &LastHDGRot
{
&temphdg = 0
}
if &minus > 0
{
&KEYS = 48
&KEYS = 0
}
}




Var 9082, name HDGrot, Link IOCARD_ENCODER, Input 6, Aceleration 6, Type 2
{

if &HDGrot > 0
{
IF &temphdg = 0
{
&LastHDGRot = &HDGrot
&Plus = 0
&Plus = TIMER &HDGrot 1 1
}
}
else
{

IF &temphdg = 0
{
L1 = &HDGrot * -1
&LastHDGRot = L1
&Minus = 0
&Minus = TIMER L1 1 1
}
}



CALL &HDGaff

}

var 9001, name tempAlt, value 0
var 9002, name LastAlt, value 0

var 8104, name PlusAlt, Link SUBRUTINE
{

&tempAlt = &PlusAlt

if &tempAlt = &LastAlt
{
&tempAlt = 0
}
if &PlusAlt > 0
{
&keys = 53
&keys = 0
}
}

var 8105, name MinusAlt, Link SUBRUTINE
{
&tempAlt = &MinusAlt

if &tempAlt = &LastAlt
{
&tempAlt = 0
}
if &MinusAlt > 0
{
&keys = 52
&keys = 0
}
}


Var 0083, name ALTrot, Link IOCARD_ENCODER, Input 2, Aceleration 3, Type 2
{
if &ALTrot > 0
{
IF &tempAlt = 0
{
&LastAlt = &ALTrot
&PlusAlt = 0
&PlusAlt = TIMER &ALTrot 1 1
}
}
else
{

IF &tempAlt = 0
{
L1 = &ALTrot * -1
&LastAlt = L1
&MinusAlt = 0
&MinusAlt = TIMER L1 1 1
}
}




CALL &ALTaff

}

Var 0084, name VSrot, Link IOCARD_ENCODER, Input 11, Aceleration 1, Type 2
{
IF &VSrot = 1
{
&keys = 54
&keys = 0
}
ELSE
{
&keys = 55
&keys = 0
}
}
Var 0999 name FO_JoyStick64 Link FSUIPC_OUT Offset $3340 Length 4
Var 0085, name CRSRIGHTrot, Link IOCARD_ENCODER, Input 9, Aceleration 1, Type 2
{

IF &CRSRIGHTrot = 1
{
&FO_JoyStick64 = CHANGEBIT 0 1
&FO_JoyStick64 = CHANGEBIT 0 0
&VORLOCled = &CRSRIGHTrot
}
}


//__________________________________________________________________
// Rutinas de visulaización
//__________________________________________________________________

Var 9999, name VSaff, Link SUBRUTINE
{
IF &VSled = 1
{
IF &VSpmdg < 60000
{
&VSdisplay = &VSpmdg
&VSminus = 0
}
ELSE
{
L0 = &VSpmdg - 65536
&VSdisplay = L0
&VSminus = 1
}
}
ELSE
{
&VSdisplay = -999999
&VSminus = 0
}
}

Var 9998, name IASaff, Link SUBRUTINE
{
C0 = &SPDINTV = 21
C0 = C0 AND &VNAVled
IF C0
{
&IASdisplay = -999999
}
ELSE
{
IF &COstatus < 4
{
&IASdisplay = &IASpmdg
&IASpoint = 0
}
ELSE
{
L0 = &IASpmdg / &IAS
L0 = L0 * 12800
L0 = L0 * &MACH
&IASdisplay = L0 / 20480
&IASpoint = 1
}

}
}

Var 9997, name HDGaff, Link SUBRUTINE
{

IF &HDGpmdg = 360
{
&MEMHDG = 0
}
ELSE
{
&MEMHDG = &HDGpmdg
}

&HDGdisplay = &MEMHDG
}

Var 9996, name ALTaff, Link SUBRUTINE
{

&MEMALT = &ALTpmdg
&ALTdisplay = &MEMALT
}

kiek
02-14-2009, 02:55 AM
But I can't remember it mentioned in any of the SIOC literature!
You can find (all) that information in the Help menu of config_sioc.exe...

MortenHa
02-15-2009, 06:27 AM
Thanx Nico and MrRoper

I'll will take a closer look at your code, and I will probably shamelessly steal whatever we find uselful:D.

I promised to post our final script for the MCP, tested on our system, it works!

But, it's too long to be posted. 7000 characters over budget.

So I'll send as an attachment to the post

dogtanian
02-17-2009, 05:54 PM
Hi guys

This is good work but there is an fault with the VS input code.

The VS increments in 50ft increments at rates below 1000fpm, after which it changes to 100ft increments.

Therefore you can't really use hardwired 00 in VS, maybe the last 0 only!

This is important because when flying a non-precision approach using VS, 100fpm increments are too coarse. I did have a properly working version in my own MCP script, but I don't have access to it as I write this post. I modified something from Niko's website in any case so you should be able to find a way to do it.

Regards

Darrin

MortenHa
02-18-2009, 12:18 PM
Hi Darrin!

Da*m! I had no idea that the VS in a 737 was configured that way!
And I'm pretty sure there's nothing we can do about it (haven't spoken to my father, he's the one doing all the hw soldering). The 7-seg must come consecutively and that probably means the we have to re-solder most of the 7-seg. on the MCP. I don't think my father is up for that :-(.

Well, this means that we have a custom 737-700 flightdeck. Slightly less advanced than the regular ones.

Company procedure:
non-precicion approaches must be flown manually below 1500ft.

Regards
Morten

PS: Darrin do you have any idea what is wrong with our QNH (BARO Rotary encoder) code in the thread PM EFIS SIOC Script?