FSIO and SIOC configuration

SIOC Configuration

SIOC variables and how they relate to hardware input/output

Configuring the inputs

Buttons and Switches

The first 74165 chip in the chain will be numbered 00 and thus it’s A input will be the number 0 input, its B input number 2 etc.

A switch/pushbutton connected to pin A of the second 74165 will be configured in SIOC with:

Var 0020, name FDswitch, Link IOCARD_SW, Device 1,Input 8

The microcode in the PIC does not need to know the number of chips that are connected in the chain. The microcode will read 32 input registers. Empty spots will never change. As long as the order of panel units in the chain does not change, the input number does not changed as additional panel units are connected.

SIOC allows for a Type parameter.

If no type is specified, Type I is assumed.

Type I (default)
This is a normal button or switch. A 1 is send to the variable on push (make contact) and a 0 is sent to the variable on release.

Type P
A value is sent to the variable only at push (make). This value alternates every push. So a 1 will ben sent at a push, the next push will send 0 and so on.
This allows you to implement a switch with a pushbutton.

FSIO implements also Type T

Type T
If Type T is specified FSIO will only sent a push (1) event to the SIOC variable. In order to detect the next push, the SIOC script needs to clear the variable, otherwise nothing happens.

e.g. If your script sets this variable to 1 this means that the button connected to this variable is in fact disabled. Pushing it will not create an event. If the script clears the variable pushing the switch will trigger an event, but blocks further events until cleared.

Type X
This is also special to FSIO. When type X is specified, the button push (switch ON position) will send 0 for push and 1 for release. This is reverse to Type I.


Rotary Encoders

Type F – a special type of input switch is the rotary encoders.  Any 2 consecutive pins can be used for a rotary encoder. The only condition is that both inputs are on the same input chip.

Var 0021, name Rot1, Link IOCARD_ENCODER, Input 4, Device 1,Aceleration 2, Type F

The statement above tells the software that the rotary encoder is connected to inputs 4 and 5 (pins G and H of the first 74165 chip). The rotary encoder is implement as a single variable. The variable will receive +1 or -1 depending on the direction of turn. As SIOC only reacts on changes, IO Control will send that value followed by a 0 to have the variable ready for the next pulse.

There is some more details about Rotary Encoders and Rotary encoder types here.

Addressing the displays

The same addressing is used for the display chips. The first chip in the chain (the one closest to the PIC processor) will connect displays 0 – 8.

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

Var 0031, name IAS_Overspeed, Link IOCARD_DISPLAY, Device 1, Digit 3, Numbers 1 

Var 0032, name IAS, Link IOCARD_DISPLAY, Device 1, Digit 4, Numbers 3

Nothing new here. Note that all displays the above 3 configuration lines are on one (the first) display chip.

Special Codes:

SIOC defines some special codes for special characters.

case “-999999″:  ”    ” (blank, you can specify up to ‘Numbers’ 6 to blank)
case “-999998”:  “-”  (minus sign)
case “-999997”:  “S”
case “-999996”: “T”
case “-999995”: “D”
case “-999994”: “_”  (under score)

FSIO adds another code to this list:

case “-999990”:  “STD”  (make sure to specify ‘Numbers 3’)

Leading 0 or leading blank:

Standard values are displayed with leading 0, so if you specify 5 digits for you altitude an altitude of 300 will be dispayed as 00300. The 737FMC displays the altitude with leading blanks.

The only way to get leading blanks was to make a script where you adres each individual display seperately in a script.

FSIO allows to specify that a certain varialble needs to be displayed with leading blank. As SIOC does not have a provision for that I use the Variable name to indicate leading blanks. If the variable name is followed by “_S_” the number will be displayed leading blanks.

Var 0104, name ALT_S_, Link IOCARD_DISPLAY, Device 10, Digit 8, Numbers 5, // MCP_Altitude ,

LED Indicators

As mentioned before, the same hardware will also be used to connect individual LED´s.

Consider the statement below:

Var 0011, name ATled, Link IOCARD_OUT, Device 1, Output 0

This statement will address a LED connected to DIG0 – SEGA of the first display chip in the chain. This happens to be the same as Segment A of the display in the previous configuration statement. Not very logical to do but I need to make the point. This is part of the flexibility of the design. All segment can be used to connect as an individual LED.

Consider the statement below:

Var 0011, name ATled, Link IOCARD_OUT, Device 1, Output 7

Output 7 is the decimal point of DIG0 of the first MAX2719 in the chain. It is up to the panel designer how to use and connect the various elements that make up a panel.

If you connect 8 LED’s to the second MAX2719 in the chain, these LEDs would be numbered as starting 64, 65 etc.

 Var 0111, name XYZLED, Link IOCARD_OUT, Device 1, Output 64

This gives maximum flexibility.

SIOC does not allow more the 256 LED on IOCARD_OUT

However, there is a limitation within SIOC. SIOC does not accept numbers > 255. With 16 display chips in a chain the 5th MAX7219 connect LED 256. This cannot be configured in SIOC.

Here is the problem in SIOC code:

Var 0035, name ALED1, Link IOCARD_OUT, Device 1, Output 200
Var 0036, name LASTLED1, Link IOCARD_OUT, Device 1, Output 255
Var 0037, name FARLED, Link IOCARD_OUT, Device 1, Output 256

Var 0035 and 0036 are ok, no problem. Var 0037 is not accepted by SIOC, so we get an error on the script. Output 255 is the last LED that SIOC accepts. This is the last segment of the 4th display chip, witch renders the others out of reach.

We can have 16 display chips on the chain. We devide these in 4 quadrants of 4 display chips. So each quadrant has 256 LED’s .

There is no place in SIOC configuration lines that I can use to specify the quadrant however we are free to chose the name of the variable, so we will use part of the Var name to address 1 of 4 quadrants (0,1,2,3).

This is how it is done:

  • The Var name of the output will be extended with ‘_Qn’ (underscore, Q, quadrant number)
  • This sequence must always be at the end of the Variable name.
  • If _Qn is NOT in the last 3 characters of the variable name we assume _Q0. (The LED is on the first 4 display chips.)

Examples:

Var 0034, name LED1, Link IOCARD_OUT, Device 1, Output 255    
Var 0035, name LED2_Q0, Link IOCARD_OUT, Device 1, Output 0
Var 0036, name LED3_Q1, Link IOCARD_OUT, Device 1, Output 0 
Var 0037, name LED4_Q2, Link IOCARD_OUT, Device 1, Output 0
Var 0038, name LED5_Q3, Link IOCARD_OUT, Device 1, Output 0
  • Var 0034 is the last LED on the 4 th Display chip, standard as it is now.
  • Var 0035 is the first LED in the first Display chip, as this is within the first quadrant. (The _Q0 is not needed (for compatibility reasons) as we assume Q0 if no _Qn is present.
  • Var 0036 is the first LED on the second Quadrant, thus the 5th display chip, LED number 256.
  • Var 0037 the first on Quadrant 2, the 8th chip, LED number 512 … etc.

Now we can configure a combination of 1024 LEDs or 128 digits on a single processor card.

So use: IOCARD_OUT, to address a single LED and USE IOCARD_DISPLAY to address 7-Segment display.

As the bcd decoding is done in the microcode ( the internal MAX7219 bcd to 7-segment decode is not used) special characters like: A,  b,  C,  d,  E,  F,  blank, – ,   S  and t are implemented in the microcode.

Lamptest function

In the present code the on board button of the processor card (port B4 used to set the processor in boot mode) is also implemented as an input switch (239 / 0xEF). At the same time, pushing this button sets a lamp test. It will turn all LED and 7 Segments to ON for the duration of the push.
This is OK for test purposes but incompatible with the rest of the design.

We need a function to set the lamptest from the SIOC script. We use the variable name to activate this function. Below is an example of how it is done:

Var 0100, name LAMP_TEST1, IOCARD_OUT, Device 1, Output 0
Var 0101, name LAMP_TEST2, IOCARD_OUT, Device 2, Output 0

Var 0007, name Sw4, Link IOCAR_SW, Device 1, Input 55
 {
 &LAMP_TEST1 = &Sw4
 &LAMP_TEST2 = &Sw4
 }

The variable name should contain ‘LAMP_TEST’ (case sensitive) .
e.g. this would be ok: myLAMP_TEST2

The Output parameter is: don’t care, SIOC needs it.

Display Intensity

Setting the displays intensity.

(1)
Hardware: A potentiometer connected to the CPU will set the display intensity between very dim (0) and maximum bright (15). This is what the MAX7219 chip allows. This potentionmeter will only affect the displays of the chip it is connected to.

Microcode prevents scans of analog ports that are not configured. So in order for the above to work, you need the line below in SIOC.

Var 0210, name Pot, Link IOCARD_ANALOGIC, Device 10, Input 6, PosL 0, PosC 7, PosR 15

This will also send the value (0-15) to SIOC var 0210.

(2)
Software, SIOC
can set the display intensity of a CPU (Device) with the following:

Var 0433, name D_INTENSITY, Link IOCARD_OUT, Device 11, Output 0

The name should contain ‘D_INTENSITY’ case sensitive. You can use other characters to differenciate. e.g. D_INTENSITY_11, etc

The parameter ‘Output 0’ is don’t care, however SIOC needs it.


Device number.

USB devices cannot be recognised by their position/connection on the computer. The first time a processor is connected to the systen, IOControl allows the user to specify a Logical Device number for that processor. This number is stored in EEProm and remains. (can be changed).

Servo

Each FSIO processor card allows you to connect 6 servo’s.

The servo accept values from 0-1023 to position 0-180 degrees. There are some tolerances between servo’s so the actual value you have to send to move it to your 0 and 180degrees position could be different. Some fine tuning and possible calculations have to be done.

To configure these servo’s in SIOC you need to specify as follows:

Var 0601, name SERVO0, Link IOCARD_SERVO, Device 10, Output 0, PosL 0, PosC 512, PosR 1023, Type 1 // SERVO ZERO
  • The name (SERVO0) is your choise.
  • The Device is the devive number of the CPU card with where you connect the servo.
  • Other parameters are SIOC required, most important the 1023 as SIOC will not send a value >1023 to the servo.

The servo accept values from 0-1023 to position 0-180 degrees. There are some tolerances between servo’s so the actual value you have to send to move it to your 0 position could be differen. Some fine tuning and possible calculations have to be done.

Var 0000, Value 0     // INICIALIZA - Initialization
{
  &SERVO0 = 511         // servo-motors to center
}
Var 0601, name SERVO0, Link IOCARD_SERVO, Device 10, Output 0, PosL 0, PosC 512, PosR 1023, Type 1 // SERVO ZERO
Var 0602, Link FSUIPC_IN, Offset $0578, Length 4 // PITCH, *360/(65536*65536) CONVERSION
{
L0 = V0602 * 8.38E-008 // convert to angle
IF L0 > 25 // Limit 25 degree Max.
{
L0 = 25 
}
IF L0 < -25 // Limit -25 degree MAx.
{
L0 = -25 
}
L1 = L0 * 20.32 // Calculate degrees for servo
&SERVO0 = L1 + 511
}

The SIOC script snippet above shows some usage.

I have a little model aircraft on my desk that can pitch up/down by a servo. This script takes the pitch from FSUIPC to Var 602. The value from 602 is then calculated to the pich angle and subsequently to the number to send to servo. L1 is the number of degrees and can be positive or negative. The servo moves to the centre (511 +/- pitch degrees).

Note Var000. This var is activates at the start of SIOC. So any script line you put there is executed. In the above SERVO0 is set to 511, that is the middle position.

Analog

A processor card has 6  + 1 Analog inputs. These inputs are numberd 0 – 6. Anolog 6 connected to the onboards pins where you can connect a potmeter direct. This special analog inputs is captured by the firmware and controls the intesity of the MAX display chips on that processor. Look above chapter “display intensity

The other Analog inputs can be read by sioc the samen way.

var 0210, name ANALOG0, Link IOCARD_ANALOGIC, Device 10, input 0, PosL 0, PosC 128, PosR 511

You know by now: Device and Input number.

Mae sure you have something connected to the input. When an analog input is configured IOContol will enable that input to send to SIOC. An open input causes a lot of noice generating an avalange of inputs to SIOC.

Relay

Each CPU card has 5 TTL outputs that can be used to control any device that accepts TTL (0 – 5volt) input. This can be a relay driver but also a single LED. I can even immagine that with the right driver circuit you can control a motor (possible using 2 outputs).

Configuration in SIOC simple:

Var 0320, name Relay1, Link USB_RELAYS, device 10, Output 5

There is not much to talk about here. To activate the relay make var 320 = 1.

Var 319, name SOMEswitch, Link IOCARD_SW, DEVICE 10, Input 4
{
  &Relay1 = &SOMEswitch
}

The device parameter

If the ‘device’ parameter is not specified ‘device 0’ is default. I suggest however always to use the device statement. Starting with device 1 and leave device 0 for the standard opencockpit devices. (A mix of both hardware systems is no problem).

Each FSIO processor will need a ‘logical’ device number set. I you plug-in a processor board for the first time (after programming the chip) it’s device number is 254. You will have to change that. Click on the label of the processor in the IOControl program. The device number is stored in EEprom, so wil remain set after a reset of power-on.

SIOC Configuration .lst files

Configuration data is given in the SIOC script. Here the (intelligent) connection is made between the cockpit hardware and the FSX/PMDG/ProSim software running your sim. This is why IOControl and PMDGDataEventServer will have to read the SIOCc script.

  • IOControl will now know the relation between SIOC variable and hardware (switches, buttons, indicators, displays etc).
  • PMDGDataEventServer will know what PMDG data is needed and in what SIOC variables Events will be set.

SIOC active configuration is stored in a file with the extension .SSI

My programs will find the active .SSI (script) file by looking in SIOC.INI file for the line “Config=…”.

Most of us create the SSI file by the Edit Script function from the SIOC main screen. This will open the Config_SIOC program. You can create your script here, but it is much more convenient to make a plain text file with the script(.TXT) and then import this file into the Config_SIOC program.

After compilation, store the result as .SSI file.

If you have lots of panels this single source .TXT file gets very large and it will not be easy to maintain.

SIOC offers the possibility to specify a .LST file. The .LST file is a simple text file with lines of paths to several .TXT files. Each of these .TXT files will have part of the full script you need. So you can build special source .TXT files for MCP, EFIS, CDU, Overhead etc. These files are easy to maintain and you can easily add panel functions to it by adding another .TXT file.

BTW: There is a good explanation about SIOC scripting at Nico Kaan site: http://www.lekseecon.nl/howto.html

In case you use this facility you will specify the .LST file in the SIOC.INI file at the line “Config=…”

After start, SIOC will compile all the files listed into the .LST file and, if no errors are found, write a new .SSI file,(with the same filename but with .SSI extension). This is the actual configuration SIOC is going to use.

Until now IOControl nor PMDGDataEventServer were capable of handling a .LST file in the SIOC.INI file. This has changed now in version 9.35.

IOControl.exe Version starting rev 9.35

In the new versions, now for download, IOControl (Vers 9.35) and PMDGDataEventServer(Vers1.1D) will allow you to specify a .LST file in the config= line in SIOC.INI.

The programs will change that name into .SSI and read the .SSI file.

It should be clear that if you make frequent changes to your script(s) you should first start SIOC. Let it complete the compilations (few seconds) and then start IOControl and PMDGDataEventServer. So these programs can pick-up the actual fresh compiled configuration script.

If the programs are already running, you can press L7 on both programs twice. This will reload the SSI file also.

Once your configuration is stable you could specify the SSI file direct in the CONFIG= line of SIOC.INI.

Note: When you use the .LST file SIOC will compile it to a new SSI file. Your assigned Var numbers within the .TXT files will get lost as the compiler re-assigns all the Var numbers into consecutive numbers. In  normal circumstances this will not cause problems. Except when some other program, that does not read the .SSI file connect to IOCP/SIOC server. In that case you would have to change the Var numbers in that other program to reflect the re-assigned Var numbers in your script.

This is particular important for people that use ProSim.

With the ProSim configuration you need to configure SIOC Var numbers. If the SIOC compiler start messing around with the Var numbers, this will not make you happy.
Well, there is a solution for that. If you do not want SIOC compiler to mess around with your carefully assigned Var number, you can specify ‘static’ within the configuration line and SIOC will not change that Var number,

Var 512, name I_E1_MTR, static, Link IOCARD_SW, Device 10, Input 29
Var 513, name I_E1_MINRST, static, Link IOCARD_SW, Device 10, Input 14
Var 514, name I_E1_QNHSTD, static, Link IOCARD_SW, Device 10, Input 26
Var 515, name I_E1_MINRADIO, static, Link IOCARD_SW, Device 10, Input 15

You would only need to add ‘static’ to the variables that you want to connect to ProSim. You would only have to do this for Var statements that have a counterpart in your ProSim configuration, but you might consider doing it for all Var statements. Your choice.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s