IOCards step by step            

 

                                                          By Claude Kieffer   http://www.simucockpit.com

                                                                                                    Translate : José Olliver

 

 

 


 

 

In this tutorial

 We will see:

 

 

1 - Master card assembly
2 - USB
card assembly
3 -
Other IOCards cards
4 -
Connections
5 -
First setup
6 -
First program
7 -
A basic Flaps handle
8 –
A seven positions flaps handle
9 -
« Bit to bit » Variables 
10 -
How to light on a LED
11 -
How add Axis
12 -
Rotary Encoders
13 -
Displays Digits

14 - Final words

 



The IOCards design is a group of electronic cards whose objective is to manage the cockpit functions: to control the Flight Simulator by means of switches, buttons, rotary encoders, etc... to show in the displays the frequencies that are used in flight and the automatic pilot's parameters, control of servo-motors, step by step motors, keyboard emulator, etc... 

IOCards is a non commercial design. It development was possible thanks to Manuel Vélez,  el main designer. 

You can make the order of the IOcards cards in kit, or mounted and tested, in Opencockpits web site . All cards are sold to cost price without lucre... 

This tutorial non dispensation the mandatory reading of the annexes that you can download from Opencockpits web site. Mainly the annexed I and II

My intention in this tutorial is of proposing a focus different from that of the Annexes. We will try to highlight more the practical aspect that the theoretical and to approach the complex phases step by step. All that with many very detailed examples. Undoubtedly sometimes they will be able to have the impression that the explanations are very elementary or repetitive. But keep in mind that alone it is those here "first steps" with the IOCards. Not all the possibilities of this system will be approached here. We will limit ourselves to the essential thing. 

What I want is that a beginner that doesn't understand anything of electronic and still less than computer programming it can carry out without failure a project with the IOCards. 


 

 

Alone it was possible to do this tutorial with the support, the help and the advice of Guy Boullu, Jean Claude Pinardon and Jean Pierre Lalanne that are three excellent French manufacturers of cockpits. I thank them very much.

 

 


 

 

1 – Master card assembly

 

The Master card is the "heard" of the IOCards system. It provides inputs, that can be connected to any type of switches, and also outputs for to connect Leds or to show information in the displays.

Alone the Master card could work if it was connected to the parallel port of the computer. This is even possible... to the condition that their computer still takes that port type. The truth is that the parallel port goes being more and more scarce since the printers take all the USB. Today is better to connect the Master card in the USB port. For that an additional card is needed but it is worthwhile for quantity of reasons.

 




 

 

 

 

 

First... We unpackage the components



 
The circuit card of the Master: It have components drawing.



Start soldering the small components: the 72 1N4148 diodes, the 9 resistors 6,8 Kohm (Blue, Gray, red)
  They should not apply the welder more than a second on each welding to avoid an excess of heat in the component. 
They have to avoid the too thick weldings so much because they can cause short circuits if they join the neighboring hints, as the too fine weldings because it won't be made the contact correctly between the component and the track. 



Check that all black lines of the diodes are always with the due placement. The resistances don't have special care when placement, but but it is worth to place them of the side that allows to read the code of their colors.



Later, We solder the sockets of the ICs. We must keep in mind that Opencockpits doesn't provide them because they are not indispensable but it is highly recommended to get them. Care with the position of the semicircular notch. This drawn in the printed circuit. We will weld only two pins of the socket and we will check that you fits correctly on the printed circuit before welding the other ones.



For I finish we will weld the biggest components: the connectors. Let us notice the position of the one it reduces of the connectors of 40 pines. The position of the pines 1, 2, 39 and 40 this colored one on the printed circuit. Remember well that once placed the connector can no longer be seen. 

 


 




 

2 – USB card assembly

 

 

 

 

Of course, for the assembly of the USB card will follow the same phases exactly that for the Master. 
The printed circuit is of excellent quality. As that of the Master.

 

 

We will begin welding the small components: the resistors, the condensers, and then the socket of ICs. Remember that the condenser C1 that give it for 220 nF (or 0,2 µF) in the nomenclature this proportionate one for O,1 µF. The correct value is this last one (0.1).



The LED diode is weld (¡ Take care with the position ! In the oposite position don´t light on) If the LED has a notch, this should place on the side of the USB. The connectors are already placed.

 





The USB Expansion card is finished             
 

 

 

 


 

 

 

3 – Others IOCards cards

 

 

 

 

 

The Display II card
(105 x
65 mm)

 

 

 

The keyboard emulator USB Keys
(55 x 60 mm)

 

 

 


 



 

4 - Connections

 

Each people has their method to avoid made a mistake with the multitude of wires that leave the IOCard card. I personally, appeal to plane cables of 40 wires that they go distributed by the whole cockpit. Each panel (as well as that of the landing gear, EFIS, etc.…) it should be independent and easily unmounted. Therefore, the wires of switches, LEDs, displays of each pane,l they will be gathered and connected in a male connector HE10 of 2 x 20 pins (it is very easy to get them in the electronic store). 

My method is the following: the Master card provides the HE10 male connectors J3 and J4. In each one, I connect a plane cable of 40 wires with a female connector. One goes toward the right part of the cockpit and another toward the left. When arriving the plane cable near an I modulate (for example that of the landing gear), It is connected to a HE10 female connector thru a grimp tools. Then as the wires of the landing gear panel are welded in a HE10 male connector because single lack that to connect it to the female connector that there is grimped. Good, keep in mind that alone 10 wires of the plane cable were used for this module. The other ones continue but far, for example until the EFIS that It needs 15 wires. And we continue this way since to grimp several HE10 female connectors is been able to the plane cable. Each female connector corresponds to a panel. 

This way to proceed has several benefit: it is clear wired. It is also this way easier to modify it and to extend it. Let us say that the inconvenience is that there is that grimped the connectors and it is better to have a special tool for it. It can also give to one the waste impression since they take few wires some connectors. But, they are cheap the HE10 connectors. 

With these pictures it is but explicit: 

 



Here We can see a plane cable with 3 female HE10 connectors grimped, the grimped tool, and some spare connectors


A HE10 male connector: here, only the first 9 wires are connected. 

It is never necessary to weld the wires directly on the pins. It is necessary to weld the pins on a piece of printed circuit and then the wires on this circuit.





 


 

 

5 - First Setup

 

Well, We have mounted our cards, and clever the wires. First We will have to check that everything works correctly. For that, We need a power source of 5 V cc. As say in the "Annexed I", page #16, if we want to use as power source one of computer´s. There is but you solve. We should keep in mind that the IOCards cards use a little current. But that of more consumption are the Leds and the displays that can be connected. A Led consumes 10 miliampers approximately, a 7 segments display (alone a "it calculates" to show a frequency for example) it can consume more 10 times. To be comfortable, a feeding of 5Vcc 2 amperes will be enough. 

Care: some power source have a "current of quite" high and that can damage some ICs. To avoid that risk, it is always necessary to use a plug with taking of ground to connect those feedings to the line.   

The "Controller." 

The "Controller" program that forms part of the group of the software IOCards, because as it seems logical, it will be good us to check the correct operation of the Master card and also to locate the inputs and the outputs. It seems interesting to gather the programs and the files in an unique folder, for example in Program Files \ IOCards. 
Before everything, execute the file Controlador.ini that is in IOCards folder. Next they can see what should show us. If some lines are different, modify them: 

[ fichero de configuración para el programa CONTROLADOR ]
[ Configuration file for CONTROLADOR ]

[ Uso de Expansión USB ]
[ Iocard expansion USB ]
USB=yes

[ Múltiples USBs ]
[ Non unique USB ]
MUSB=No

[ Número de periférico para el USB ]
[ USB Device number ]
deviceUSB=2048


[ Número de A/D a usar de la placa de Expansión USB ]
[ A/D used by Iocard Master expansion USB ]
USB_AD=0


[ Puerto donde se encuentra conectada la IOCard Master ]
[ Iocard Master, parallel port address ]
Port=$0378


[ Modo compatible yes/no , necesita cable especial ]
[ Compatibility Mode yes/no, needed special cable ]
FullCompatible=No


[ Utiliza placa de expansión yes/no]
[ Use Expansion card yes/no]
Expansion=no

[ Activar en modo SIMULADOR yes/no]
[ Use simulated card yes/no]
simulator=no

[ Numero de tarjetas Master inter-conectadas ]
[ Number of connected master cards ]
NCards=1


[ Refresco de poll tarjetas Master ]
[ Master cards refresh ]
MasterRefresh=10


[ End of File ]

 

Now, We run the "Controlador" program.. We do a click in the "Comenzar" button: the program display this screen. Only We use at this moment the red box info:




In the upper side "IOCardUSB running" will show. That means that the Master card and the USB Expansion card is working. With the USB port, no longer interests us all that refers to the parallel port and its address. 

Anything should appear in the "Inputs" box. Neither in the white window below. If it leaves some series of numbers in this window, it can mean that there is a short circuit in the inputs of the master card or a faulty connection cable. 

We activate an input now. 

Prepare a piece of plane cable of 40 pins of 30 centimeters. In an end of the cable, put a HE10 female connector 2 x 20. Care with the color thread (the #1) that should be on the side of the a small triangle is recorded in the HE10). The other end of the cable it removes the first 10 wires, remove the plastic cover and connect to a switch among the color wire (#1) and the #10 wire. 
 

 To activate the input #1, connect the HE10 connector in the J3 connector of the master card (below, in the left), and close the switch, immediately will appear the "001" in the box and window below. Perfect! The input #1 works. Leave welded the switch with the wires that it will be necessary later. 
We will check the correct operation of the 8 following inputs now. Keep in mind the practical aspect that we have already commented in the page 15 of the annex I: the physical inputs or pins don't always correspond numerically with the logic inputs.  

Next we expose a diagram with the correspondences:

J3 Connector:

INPUT

002

003

007

006

GND

011

012

016

015

GND

020

021

025

024

GND

029

030

034

033

GND

PIN

2

4

6

8

10

12

14

16

18

20

22

24

26

28

30

32

34

36

38

40

PIN

1

3

5

7

9

11

13

15

17

19

21

23

25

27

29

31

33

35

37

39

INPUT

001

004

008

000

005

010

013

017

009

014

019

022

026

018

023

028

031

035

027

032

J4 Connector:

INPUT

038

039

043

042

GND

047

048

052

051

GND

056

057

061

060

GND

065

066

070

069

GND

PIN

2

4

6

8

10

12

14

16

18

20

22

24

26

28

30

32

34

36

38

40

PIN

1

3

5

7

9

11

13

15

17

19

21

23

25

27

29

31

33

35

37

39

INPUT

037

040

044

036

041

046

049

053

045

050

055

058

062

054

059

064

067

071

063

068

As they can already see it, the inputs go for groups of 9. The first input takes the number 000. In total, the two connectors J3 and J4 provide 72 inputs. They are activated when join one of the pins of oneself group with the ground pin (GND) of the same group. 

We have discovered that the input #001 was activated when join with a switch the pin 1 with the pin 10 of the J3 connector. Equally, the input #009 was activated joining the #17 and #20 pins, etc... 

Now we can test them the #000 thru #008 joining the wires of our plane cable with the #10 wire of GND. 

If everything works, that is to say if each input this located correctly in the white window the rest it also worked 

Of course anything prevents us us to make the same thing with the connector J4. 

At the moment alone we will make this with the Controller.

 

 

 


 



 

6 - First program

 

Config IOCard

As same of the "Controller", ConfigIOCard has a configuration file called: ConfigIOCard.ini

This file es very import and it should show us the following thing. Change it if necesary:

[ fichero de configuración para el programa IOCARD ]
[ Configuration file for IOCARD ]


[ Uso de Expansión USB ]
[ Iocard Master expansion USB ]
USB=yes

[ Múltiples USBs ]
[ Non unique USB ]
MUSB=No

[ Número de periférico para el USB ]
[ USB Device number ]
deviceUSB=2048

[ Número de A/D a usar de la placa de Expansión USB ]
[ A/D used by Iocard Master expansion USB ]
USB_AD=0


[ Numero de tarjetas Master inter-conectadas ]
[ Number of connected master cards ]
NCards=1


[ Utiliza placa de expansión yes/no]
[ Use Expansion card yes/no]
Expansion=No


[ Activar en modo SIMULADOR yes/no]
[ Use simulated card yes/no]
simulator=no


[ Refresco de FSUIPC ]
[ FSUIPC refresh ]
FSUipcRefresh=100


[ Desabilitar lectura de las FSUIPC ]
[ FSUIPC disable mode yes/no ]
FSUipcdisable=no


[ Refresco de poll tarjetas Master ]
[ Master cards refresh ]
MasterRefresh=10


[ Desabilitar protocolo IOCP ]
[ IOCP disable mode yes/no ]
IOCPdisable=yes

[ Dirección IP local para el protocolo IOCP (UDP) ]
[ IP address for IOC protocol (UDP) ]
ioc_ip=127.0.0.1


[ Puerto local para el protocolo IOCP (UDP) ]
[ port for IOC protocol (UDP) ]
ioc_port=8090


[ Nombre y localización del fichero de configuración ]
[ Name and path of Config file ]
ConfigFile=.\iocard.dat


[ Nombre exacto de la ventana donde se enviarán las teclas ]
[ Name of window for key send ]
[window = "Project Magenta Glass Cockpit - Build 396" ]

window = "a.txt - Bloc de notas"


[ End of File ]

La first screen is the following:

This program is that we use to create all the programming instructions that we will use. 

We will go slowly. We will think about a first very modest objective: to select the control of the landing gearn. Nothing else. 

For their internal operation, the Flight Simulator uses "variables". All the functions of the simulator, and not alone those that are about the flight, refer to a variable. Peter Dowson has been able to crumble the code of Flight Simulator and it has taken out the list of those variables. This way, a software just as IOCard can negotiate them and for mediation of FSUIPC they will be been able to send to SFC. Alone they are given an address… AND there they go!  

The variables list of Flight Simulator goes included in the IOCards documentation, in the annex IV, and also in the Peter Downson web. There are hundreds (the annex IV consist of 43 pages), but calm because if we leave aside the variables that are about the meteorological service, geographical coordinates, or physical characteristics of an airplane, what composes a booth is really quite less important.

 Variables or equivalent of the keyboard ? 

Many functions of Flight Simulator has an equivalent defined in the keyboard. That is to say that to press a key caused the same thing that if we send a variable. To press in the "G" key of the keyboard or with the emulate card it will have as effect of retracting the gear in the same way that if we send the corresponding variable. Then why it interests to use IOCards? 

The first is that there are many controls that they don't have equivalent in the keyboard.  

Then, many functions need to give us a confirmation: when we move the landing gear to down, it have in transit and when it has left, they light to confirm it. That information that we need cannot negotiate it the emulative cards. 
Neither, of course, they can to show us information of numeric data, such as the frequencies, altitude with the A/P, etc. 

We will already see soon that there is a very important difference among controlling by a toggle switch, or a key of the keyboard, or a ON/OFF switch. This last one sends an instruction and it remains in a position. It is the fact of putting it in another position that will annul the previous action. And this cannot negotiate it the keyboard. If one had tried at some time to control the landing lights with toggle switch. 

However for such instructions as closing the FS (CTRL+ C) or setting the altimeter (B) etc... An emulate card of keyboard was so effective. 

 

We return to Config IOCards.

In the "Variables" folder, We can see the following columns : 


NAME : here we will put the name that we want to give to the first VARIABLE. For the landing gear, we will call it for example GEAR. This name will assign to an address and from now one will be able to only use to define the function to retract or extend the landing gear, and anything. For that reason it is important to choose a sufficiently representative name. For example, if We call to a variable BRAKE, it is certain that we don't go that is after a little time if it is the left Brake, of the right or of the control of parking brake. 

In the NAMES column, we will put GEAR for example. We have just defined a name of VARIABLE.

DIRECCIÓN : The address that We should use for the variable that We have defined provides it to us Peter Dowson in the list of FSUIPC offsets (Annex IV). We cannot put the one that want, We have to remit ourselves to the defined ones in the FSUIPC. In the list, We can see "Gear Control". Because that it is the one that We need.

We have to remit ourselves to the address 0BE8. But still lack something: We have whenever the prefix sign "$" to each address. Then in the column ADDRESS, we will put: $0BE8 

LENGTH : it is the number of "bytes" that has each variable (that is to say the name of "words" of 8 bits). We trust Peter's word Dowson and We will put the longitude that gives us and that in this case for the landing gear will be 4. 

At the moment We will leave aside the two following columns: 

Then We have:

Because not this wrong for start ! 

For our landing gear control, We will use a switch "normal" of type micro-switch, with a Closed position and an Opened position. We make a click in the SW-NORMAL folder. 

NAME : We don't should mistake with the previous NAME. Here We will give a name to the landing gear switch and not to the variable of the gear. For example We will take GEAR_SW, or INTER_TREN. 

INPUT : We put the input number of Master card on which We will connect the landing gear switch. It can be the first one, that takes the number 0, or the input #1. Let us put the #1 for example. 

VARIABLE : Here We find the name of the VARIABLE that We have defined in the previous folder. It is not necessary to change it. We had chosen GEAR, because We will put GEAR in that column. Council: to avoid errors when rewrite us the name of the variable, because it would be cause for not being recognized, make a double click in the Variable column. Then, the list of the variables that We have already used will come out and alone We will have to choose. 

VALOR_ON AND VALOR_OFF: this part is interesting. Here We have to indicate that value should take the variable when the switch is closed (Valor_ON/Key) and when is open (Valor_OFF/Key). We have several options, according to the control type. We will already see then some examples. For the landing gear, the simplest solution is putting ON=1 and OFF=0, then switch closed = landing gear down and switch open = landing gear up. Nothing else. The program understands what means 0 and 1 perfectly.  

Good, We can make this in a different way. Notice again in the offset line of Peter's Dowson offsets : And that we see? 

Gear Control: 0=UP, 16383=Down.


It is another way to arrive to the same result, because in fact We don't know it, but when We retract the landing gear with OFF=0, the variable herself, it takes the value 0. AND surprisingly, when the landing gear is down, with ON=1, that variable "Gear" it takes the value 16383. Then We would putting 1 in the Valor_ON column and 0 in the Valor_OFF column, to put 16383 in the first one and 0 in second. It would happen exactly the same thing. 

When having defined a variable and a control by means of a switch, We have just programmed the first input of the master card.  

Now We have to make two very important things:   

  The Config IOCard program have received the informations of an important file, the ". dat". This is the file to the one that the main program, IOCard.exe, it will refer to know which is our programming. But before, it is necessary to record it, because at the moment, like they can see it IOCard it arrives of the window of Config, it calls himself "sin_nombre.dat". We execute File/Save then like and we save that new "file.dat" with a name anyone, aeris.dat or... mi_avión.dat. This new file.dat stays together with the other ones that We gave as examples, in the IOCard folder. 

Very important: We should inform to IOCard.exe that is with this file. dat that should act. For We execute it again the file ConfigIOCard: when arriving to the the last lines of this file this the following group of lines: 

[ Nombre y localización del fichero de configuración ]
[ Name and path of Config file ]
ConfigFile=.\iocard.dat

Edit the last line and write

ConfigFile=.\aeris.dat

(o ConfigFile=.\mi_avion.dat)

From now IOCard knows that it is that configuration file to which will have to refer. Observe that “\ before it names him of your file it means that the file.dat is inside the same folder that We have left IOCard.exe.

Only that to execute the Flight Simulator, and IOCard.exe whose window should indicate us that it has found among other things FS2004 and FSUIPC. IOCard minimize in the taskbar.

 
Load an airplane with retractile landing gear, as the 737. The wires 1 and 10 of the J3 connector soldiers remain in the switch of the first tests that We made. Close the switch and then they will hear a sound. That is to remember that it doesn't retract the landing gear of an airplane when this in the hint... Perfect, already work! 

In four phases: define a variable, define an input, record a file. dat and configure ConfigIOcard for that “. dat” We have programmed the first function of the IOCard system.

A example way, now they can program the battery switch. The variable address is $3102, the longitude 1 and logically the Valor_ON will be 1, and the Valor_OFF will be 0. They will have noticed that when We execute the ConfigIOCard program, it shows us a blank page, open the file.dat that We want to use in File/Open. AND don't forget save it every time that modifies something! 

The programming of the battery switch is specially conclusive: it is much more realistic to control it with a switch that with the keyboard or with push buttons.  

Now, we add the parking brake control ($0BC8)

 
Comment 1: some functions demand to activate a push button - and not a toggle switch. For example for the function SLEW (displacement, Y Key). Pressing is activated and pressing again is disabled. IOCard is informed putting a P like "Pulse" in the TYPE column of SW_NORMAL. Make a test with $05DC that is the SLEW address. 

Comment 2: When We modify something in the file ConfigIocard, it is always necessary to safeguard that file with File \ to Keep. But if this being also executed IOCard.exe, so that they are effective the modifications, it is necessary to make click in RELOAD. 

Comment 3: The window of beginning of IOCards sometimes indicates us errors, and the program cannot be executed. The most frequent errors are: 

“it is not a whole value”: IOCards closes with EXIT, execute it again and don't make click in the button to RELOAD, but in START.

We can have "erroneous Variable in Exit lines". That happens mainly when an or several programming lines have been open with ADD, but dropshots in blank. Suppress the empty boxes, IOCards execute again and everything will return to the normality.