PDA

View Full Version : What's going wrong in my SIOC code?



MicroHellas
08-21-2008, 12:29 PM
Hello,

Could you please someone point to my error on the following code? Gears Up/Down work fine, but I'm not able to make the led to light:roll:



// *****************************************************************************
// * Config_SIOC ver 3.5 - By Manolo Velez - www.opencockpits.com
// *****************************************************************************
// * FileName : pilot_console.txt
// * Date : 21/8/2008



Var 0300, Value 0 // Gear Initialization
{
&GEAR = 16383
}

Var 0301, name GEAR, Link FSUIPC_INOUT, Offset $0BE8, Length 4, Value 16383

Var 0305, name GEAR_LIGHT, Link IOCARD_OUT, Output 27

Var 0306, name GEARS_SWITCH, Link IOCARD_SW, Input 34
{
IF &GEARS_SWITCH = 1
{
&GEAR = 16383
&GEAR_LIGHT = 1
}
ELSE
{
&GEAR = 0
&GEAR_LIGHT = 0
}
}


Thank you
Maria

kiek
08-21-2008, 04:05 PM
Hello Maria,

There is nothing wrong with your program. It works over here... Are you sure that you are using a valid output? Have you checked the led with Controlador?

Of course you could improve your code a little bit by:
* using FSUIPC_OUT instead of FSUIPC_INOUT (since you are not using the value coming from FSUIPC);
* making the type of switch used more explicit by adding Type I (default);
* by initialising variable &GEAR only once, now you as well initialise in Value 0 and by adding initial value to the GEAR variable. You can leave out one of the two.

But like I said before, even without these improvements it should work...

Here is an even better program, that will also lit the led when you move the Gear in your panel:

Var 301 name GEAR Link FSUIPC_INOUT Offset $0BE8 Length 4 Value 16383
{
IF &GEAR = 16383
{
&GEAR_LIGHT = 1
}
ELSE
{
&GEAR_LIGHT = 0
}
}

Var 305 name GEAR_LIGHT Link IOCARD_OUT Output 27

Var 306 name GEARS_SWITCH Link IOCARD_SW Input 34 Type I
{
IF &GEARS_SWITCH = 1
{
&GEAR = 16383
}
ELSE
{
&GEAR = 0
}
}


regards,
Nico Kaan
http://www.lekseecon.nl

MicroHellas
08-22-2008, 01:14 AM
Hello Nico,

Thank you so much. By the chance my congratulations for the contents of your site. I've been there many times reading your SIOC articles. Could you please allow me a childish question (don't forget that I'm blond too;) ). Is this lekseecon only about B767?:roll: If not could you please point me to an article where I can get a global idea about it?


Have you checked the led with Controlador?
That's another pitty story. I don't know how to check it. I found a good tutorial for it, but it covers only instructions for inputs, so I was able to check only them. Don't know how to check outputs, displays etc.

Opencockpits sure they've great products but, sorry to say, from my experiance they've zero support. Even if I placed already 3 orders, spending around 1,000 Euros, they're replying only to my pre-sales questions and never to my support questions. Also their forums look like died. Only few posts have been replied there among dozens of others waiting a reply. Finally, for some cards (eg encoders cards) there is no manual, so I don't know (for example) where I must connect the 3pins of an encoder while their input is for 4 pins.

Thank you again
Maria

MicroHellas
08-22-2008, 01:23 AM
Var 306 name GEARS_SWITCH Link IOCARD_SW Input 34 Type I


Where I can find a refference for the available types? I needed them when firstly I used the graphics interface for coding.

Maria

kiek
08-22-2008, 04:00 AM
Where I can find a refference for the available types? I needed them when firstly I used the graphics interface for coding.

Maria
You can find (all) that information in the Help menu of the Config_Sioc.exe tool.

Nico

kiek
08-22-2008, 04:07 AM
Is this lekseecon only about B767?:roll:


Yes, because the Level-D 767 is shipped with a Sofware Development Kit (SDK). It's the only Flight Sim addon that offers this facility.


Don't know how to check outputs, displays etc.


Just fill in an output number and 'tick' it ON...


Finally, for some cards (eg encoders cards) there is no manual, so I don't know (for example) where I must connect the 3pins of an encoder while their input is for 4 pins.
Maria

I would not use encoder cards. Use grey type encoders, you can connect these encoders directly to two consecutive logical inputs of the Master card.

Nico

dnoize
08-22-2008, 04:47 AM
Finally, for some cards (eg encoders cards) there is no manual, so I don't know (for example) where I must connect the 3pins of an encoder while their input is for 4 pins.




http://www.andare-ing.com/uploads/encoders2_schema.gif


if you use single encoders i suggest you use the ones they sell. dead cheap and can be directly connected to the mastercard (without the encoder card).

If you use dual concentrics (so far i havent found dual concentrics that work directly on the master card) then use this schematic for the encoder card.
Pin 4 (+5v) is only needed for optical encoders.

Stef

MicroHellas
08-22-2008, 05:06 AM
if you use single encoders i suggest you use the ones they sell. dead cheap and can be directly connected to the mastercard (without the encoder card).


Thank you Stefane;)

Yes, I'm using using their encoders and rotary switches that I bought from them. But as I've seen they've 3 pins while the mastercard has 2 pins. Same applies for potentiometers? How I can connect them to mastercard?

Maria

pdpo
08-22-2008, 05:30 AM
Maria,

the optical encoders (CTS288 type, like OC sell) have three pins and you should look on them like follows :
pin 1 : (right pin) switch 1
pin 2 : (middle pin) ground
pin 3 : (left pin) switch 2

now you connect the ground pin to a ground of an input group on the mastercard
and you connect the two other pins to two consecutive inputs of that input group
depending from which side you look at the rotary you will swap the two outer pins
but this doesnt make much difference. The only thing you will notice is that the
turn direction will change in the software. I mean ... when turning right the value
you receive in the SIOC will be positive or negative. Swapping the 2 inputs will change
this.

Thats it....

Greetz Peter

dnoize
08-22-2008, 05:37 AM
its been ages since ive used opencockpit cards so i hope i stll remember correctly (if not, nico please jump in :-) )

the rotary encoders they sell are grey type. you can connect them directly to the master card and should use consecutive inputs.
In each input group there is 1 commone ground.

from their manual:


ANNEX II. Programming and Configuration
Page 20 of 56
Manual Version 1.1
Software Version 1.7
03/10/03
In TIPO (type) we will write the following values depending
on the type of rotary switch that we are using:
- Blank if we are using a rotary switch.
- 1 if we are using 2 phased out digital encoders. They need
an additional circuit (available at Annex III) and use two
inputs instead three.
- 2 if we are using 2 bits Gray type encoders. They don't
need additional circuits.



If i remember well you cant connect potentiometers to the mastercard.
They have the usbaxes card for that. Also some of their other cards like the usb servos card have some analog inputs for potentiometers.

Stef

dnoize
08-22-2008, 05:39 AM
Maria,

the optical encoders (CTS288 type, like OC sell) have three pins and you should look on them like follows :



Just to rule out any confusion: these encoders are NOT optical !!

Other than that totally correct. you just beat me to the post Peter ;-)

Stef

pdpo
08-22-2008, 06:55 AM
Stef,

your right ... those are not optical...

concerning the pots, also the USB expansion card allows 4 analogue inputs.
same there, you got three pins, the outers are connected on each side of the
resistor film and the middle pin is connected to the slider.
So in order to connect to the usb expansion, just connect the two outer pins (GND and +5V)
to the outer pins of the potmeter and the middle pin connect to the slider.
If you swap the two outer pins of the potmeter you will get the effect that the resistance will swap. To be sure the pin connections of a potmeter you better test them out with a multimeter. Between the two outer pins you should measure the full resistance of the potmeter which does not change when turning the slider.
Some potmeters also provide more then three pins and here you need to chek for sure because some of those have 2 pins which are direct connected to eachother and if you would connect those two pins to the 2 outer pins ( 5V and GND) on the card then you would create a short circuit which might damage the card.

Greetz Peter