DVA3901
Captain, MD-88
Joined on January 10 2007
Northeastern United States
15 legs, 24.9 hours
3 legs,
3.0 hours ACARS
|
Posted onPost created on
January 19 2007 15:49 ET by Garry Shtofmakher
|
I am not an expert on this. But I thought it might be useful to give some very very basic examples on how to get started with SIOC. Questions and comments are of course welcome, I might very well overlook something or perhaps this is just unclear and hard to understand. So ask. Lets try to help each other with this
SIOC Tutorial
Very simple SIOC tutorial. Stuff between 3 dashes ("---") are example code.Everything works via *variables*.A variable can be:* a FSUIPC offset (1): --- Var 2, Link FSUIPC_OUT, Offset $0BE8, Length 4 // 0/16383 ---* a IOCards switch (2): --- Var 3, Link IOCARD_SW, Input 89 // Landing gear switch ---* a IOCards LED output (3) --- Var 4, Link IOCARD_OUT, Output 15 // "Gear in transit" LED ---There can be more (stepper, ac motors etc, but they are outside the scope of this simple tutorial.What was the hardest thing for me to understand at first, was the fact that this sioc code is never "run" from beginningto the end. Instead, it consists of several small snippets:--- Var 3, Link IOCARD_SW, Input 89 // Landing gear switch { ** Hi! I'm a snippet of code! ** }---Basically what this means, is: We have a variable "V3" (yes, its silly to call them by number instead of a real name, but this is how it is now) - and there is a corresponding piece of code, enclosed in culy brackets after the variable. This is the very simplest SIOC program.Whenever the value of V3 changes, and it can happen when we toggle the switch that is connected to iocards input 89, the code inside the brackets is being run. Whatever you put in a line after two slashes ("// blah blah") is regarded as "comment" and is ignored by SIOC - you should put some comments there as to what does what etc.. to make it easier to remember what the code does.For most things, it can be as simple as this:---// ** Pitot Heat ** Var 2, Link FSUIPC_OUT, Offset $029c, Length 1 // Pitot Heat Var 3, Link IOCARD_SW, Input 88 // Pitot heat switch { V2 = V3 } ---A switch variable can be zero (switch is off) or 1 (switch is on) - and the FSUIPC pitot heat offset $029c, according to the "fsuipc for programmers" reference doc also varies from 0 (pitot heat off) to 1 (pitot heat on). Thus our goal can be accomplished very easily: Offset should have the same value as the switch. In other words: V2 = V3.This is just a very simple example, but it shows the basic idea. More complex things can naturally be created.---Var 7, Link IOCARD_OUT, Output 17 // GREEN led for RIGHT main landing gear// RIGHT landing gear position, when 0, gear is up, when 16383, gear is down Var 8, Link FSUIPC_IN, Offset $0BF0, Length 4 { IF V8 = 16383 { V7 = 1 } ELSE { V7 = 0 } } ---So.. if you have done any programming, IF .. ELSE is familiar to you. Basically, we check whether variable 8 is 16383 (which, according to the document, means "right main landing gear is down"). Again, ourcode is run *when the fsuipc offset value changes*, ie, when the gear moves, in this case.We also have an iocards led (output) defined as variable 7, and V8 is the FSUIPC offset we monitor (FSUIPC IN). Whenever V8 is 16383 it means gear is down and we can light up the green led (V7 = 1). In every other case (ELSE) gear is not down and locked, thus we must turn the green led OFF (V7 = 0)Hopefully this clears up the very basic syntax and structure of how SIOC works. I can add more later, and if you have questions, lets try to answer them. Of course remember that in the iocards forum, on www.opencockpits.com there is a LOT of SIOC example code in the SIOC forum.
//Tuomas
References:
(1) - see www.schiratti.com/dowson.html and the FSUIPC SDK, it has a document called "FSUIPC for Programmers.doc" - it lists all the offsets you need and their lengths and what values they might get.
(2,3) IOCARDS variables can be switches or leds, the number corresponds to the physical pin number of the switch. This can be figured out via CONTROLADOR.EXE, part of IOCards software.
Garry ShtofmakherCaptain, MD-88
|
|
DVA2253
Senior Captain, DC-8-61
COMM
Joined on April 01 2005
Everett 250 Club
Online Century Club
Eight Century Club
DVA Ten-Year Anniversary
"I'd rather be flying!" Church Hill, TN USA
862 legs, 1,344.5 hours
108 legs,
165.2 hours online 299 legs,
485.1 hours ACARS
|
Posted onPost created on
January 19 2007 15:51 ET by George Lewis
|
DVA3419
Captain, MD-88
Joined on July 31 2006
DVA Fifteen-Year Anniversary
"Propellers keep you kewl!" Newark, DE
67 legs, 89.6 hours
61 legs,
82.8 hours ACARS
|
Posted onPost created on
January 20 2007 08:37 ET by Norm Hare
|