PDA

View Full Version : SIOC Everything looks good, BUT.....



jmig
08-02-2008, 09:15 PM
not working in FSX.

I have been struggling to learn SIOC. So I pulled the IO Master card and USB card from my cockpit and built a test setup. I have a panel with a series of switches, push buttons, encoder, and axes pot. My goal is to slowly learn to write to each item.

Today I spent hours writing simple code (shown below) to three toggle switches. A master avionics switch, battery switch and generator switch. The txt was complied with no problem by SIOC into a ssi file, which loads fine. The switches show and work in the controller panel. However, not in the game. Nothing, nada. I even changed the offest on the first switch to $0280 (Lights) and couldn't get it to work.

Any ideas?

Code:
Var 0005, name masterSW, Link FSUIPC_OUT, Offset $2E80, Length 4 // Master switch

Var 0006, Link IOCARD_SW, Input 000 Type I // Master switch
{
IF V0006 = 1 // If the switch is on
{
V0005 = SETBIT 2 // Set Bit 2
V0007 = 1 // Turn on the LED
}
ELSE // If the switch is off
{
V0005 = CLEARBIT 2
V0007 = 0 // Turn off the led
}
}

Var 0007, Link IOCARD_OUT, Output 38 // Led Not currently set up ck output #


Var 0008, name batterySW, Link FSUIPC_OUT, Offset $281C, Length 4 // Battery switch

Var 0009, Link IOCARD_SW, Input 001 Type I // Battery switch
{
IF V0009 = 1 // If the switch is on
{
V0008 = SETBIT 2 // Set Bit 2
V0010 = 1 // Turn on the LED
}
ELSE // If the switch is off
{
V0008 = CLEARBIT 2
V0010 = 0 // Turn off the led
}
}

Var 0010, Link IOCARD_OUT, Output 39 // Led Not currently set up ck output #



Var 0011, name GenSW, Link FSUIPC_OUT, Offset $3B78, Length 4 // Generator switch

Var 0012, name Generator Link IOCARD_SW, Input 002 Type I // Generator
{
IF &Generator = 1 // If the switch is on
{
&GenSW = SETBIT 2 // Set Bit 2
V0013 = 1 // Turn on the LED
}
ELSE // If the switch is off
{
&GenSW = CLEARBIT 2
V0013 = 0 // Turn off the led
}
}

Var 0013, Link IOCARD_OUT, Output 40 // Led Not currently set up ck output #

Oter3
08-06-2008, 08:39 AM
Hello.
Not to take a too big bite I will just try to give you a
hint of what to and I have only looked at the first
part of your code.
From FSUIPC Offsets list:
2E80. Master avionics switch (0=Off, 1=On).
Read/Write.
The offset is given value 1 or 0. Bits in the offset is
not changed.
If you write standard SIOC code with above FSUIPC spec it
will work.
The radios and nav. is turned on/off and as ekxample the
B.Baron has a Av.sw in its panel that clearly goes upp and
down!

Regards
Nils

jmig
08-07-2008, 10:19 PM
Hello.
Not to take a too big bite I will just try to give you a
hint of what to and I have only looked at the first
part of your code.
From FSUIPC Offsets list:
2E80. Master avionics switch (0=Off, 1=On).
Read/Write.
The offset is given value 1 or 0. Bits in the offset is
not changed.
If you write standard SIOC code with above FSUIPC spec it
will work.
The radios and nav. is turned on/off and as ekxample the
B.Baron has a Av.sw in its panel that clearly goes upp and
down!

Regards
Nils

Nils - Thanks for responding. I am confused however. What do you mean by "standard SIOC code?" I thought my code was correct? It is from examples given.

I was able to get the switched to work using the IOPC program. But, I would still like to learn and use SIOC.

sas550
08-08-2008, 03:15 AM
Remember to rename the file to "sioc.ssi". Otherwise it won't work.

sas550
08-08-2008, 03:43 AM
Here's my battery code in a simpler way.


Var 0012, name Battery, Link FSUIPC_OUT, Offset $281C, Length 4

Var 0009, name Battery_Master, Link IOCARD_SW, Input 14
{
IF &Battery_Master = 1
{
&Battery = 1
}
ELSE
{
&Battery = 0
}
}

Var 0026, Link IOCARD_OUT, Output 20 // battery_led

{
IF &Battery = 1
{
V0026 = 1
}
ELSE
{
V0026 = 0
}
}

(had to edit some code)

pdpo
08-08-2008, 04:42 AM
Hey Imig,

I find also something strange in your code. Your are setting and clearing bits in offset 2e80 but this is defined as only output. SIOC needs the input value too to be able to set or clear a bit so I think you should define offset 2e80 as FSUIPC_INOUT.
Just my two cents.
If you wanna use 2e80 as output to fsuipc only then you need to write a value to it... like
if V0006 = 1
{
V0005 = 1
}
else
{
V0005 = 0
}

Just my two cents.....

Greetings Peter Depoortere

Oter3
08-08-2008, 06:48 AM
Hei,
I did not meen to make you confused.
Stamdard code was not the right word, what I ment was: start with basic code and implement the setbit, clearbit functions later. They can be tricky!
Now it looks like it's well explained above.
Good luck.
Nils

wanderer
08-08-2008, 10:53 AM
not working in FSX.
V0005 = SETBIT 2 // Set Bit 2
V0005 = CLEARBIT 2


I'm not sure whether this will help but here are a couple of observations:

1) Looking at the 28th Release of FSUIPC SDK, the variables you're trying to alter (e.g. $2E80) are listed as simply 1 and 0 where only BIT 0 is used. No other bits are used (so you don't need to attempt to alter a SPECIFIC bit at this time). But in YOUR code, you're attempting to alter BIT 2. (Try changing your code to "SETBIT 0", etc or to a simple ASSIGNMENT as in the examples from the other replies.)

2) At the beginning of the FSUIPC programmers' guide, it says to refer to the "FSUIPC4 Offsets Status" document for use with FSX. And in the latter document, many FSX variables have little or no support yet so caution is advised. (Do your testing first using FS2004 if that is an option for you.)

jmig
08-10-2008, 08:37 AM
I want to thank each and everyone who replied to my post. I want to especially thank sas550 for the code example.

My problem is that I grew up before computers :) I have never been comfortable with programming and have always used previous written code and modified it to meet my limited needs. With SIOC I have found it difficult because of the lack of simple examples.

Most examples I have found either give you one snippet of code, such as, send a 0 or 1 to a FSUIPC offset. Or, turn on the LED. Or, they have a complete setup for an autopilot or EFIC.

One isn't enough for me with my brain that struggles to understand this stuff and the other just confuses me. What I need are complete examples to flip a switch and tell FSX to raise the gear and maybe turn on the LED. another that allows me to say, use an encoder to set the altimeter baro setting.

That is why I hope sas505's code snippet will help me. It seems complete. I know SIOC will someday help me. I will get this. But, building the cockpit was easy compared to trying to write code. :roll:

Thanks again fellows. I have to leave later this morning for a week or so. When I return, I will try out your advice and code.

Michael Carter
08-10-2008, 08:54 AM
I'm with you. Developers think we're born with this knowledge or somehow absorb it through osmosis.

The most sophisticated item in the house when I grew up was the Space Command for the Zenith television.

jmig
08-10-2008, 09:10 AM
I'm with you. Developers think we're born with this knowledge or somehow absorb it through osmosis.

The most sophisticated item in the house when I grew up was the Space Command for the Zenith television.

:-D I don't know why this stuff seems so darn hard? It is like my brain refuses to learn. Give me hard ware any day. i will never be a software engineer.

Oh the positive side...they say an active brain helps keep you young. Shoot, with this stuff, I should live to be 100.

Michael Carter
08-10-2008, 09:17 AM
I think it's because it's not a tangible item like hardware. There's nothing to touch or see or hold in your hand.

Just a bunch of gibberish on a computer screen that you hope will do something if it's all perfectly, meticulously, in the correct sequence with the correct characters.

kiek
08-10-2008, 01:27 PM
I think it's because it's not a tangible item like hardware. There's nothing to touch or see or hold in your hand.

Just a bunch of gibberish on a computer screen that you hope will do something if it's all perfectly, meticulously, in the correct sequence with the correct characters.

No, it is because programming computers is a profession...

Don't expect you can just learn it by doing. It needs proper education and training.

SIOC is a tool for programmers. If you have no programming skills at all, don't use it.

More info about programming in SIOC can be found here:
http://www.lekseecon.nl/howto.html (http://www.lekseecon.nl/howto.html)

regards,
Nico Kaan

jmig
08-10-2008, 04:27 PM
No, it is because programming computers is a profession...

Don't expect you can just learn it by doing. It needs proper education and training.

SIOC is a tool for programmers. If you have no programming skills at all, don't use it.

More info about programming in SIOC can be found here:
http://www.lekseecon.nl/howto.html (http://www.lekseecon.nl/howto.html)

regards,
Nico Kaan

Ahhh, Nico. Then why people familiar with the language, even you, have often spoke about how easy it is? You once said that if at all possible use it over IOPC because it can do so much more.

I will learn enough to do what I need it to do. The problem is getting started. Getting a few bits of code to run so I can understand. It will happen. I will just keep working at it until I get it working.

Paid too much money for all those cards to stop new. LOL

Thanks for all you help, BTW.

Michael Carter
08-10-2008, 04:48 PM
No, it is because programming computers is a profession...

Don't expect you can just learn it by doing. It needs proper education and training.

SIOC is a tool for programmers. If you have no programming skills at all, don't use it.

More info about programming in SIOC can be found here:
http://www.lekseecon.nl/howto.html (http://www.lekseecon.nl/howto.html)

regards,
Nico Kaan

Then I will leave programming to the professionals and stick to building.

kiek
08-10-2008, 05:15 PM
Ahhh, Nico. Then why people familiar with the language, even you, have often spoke about how easy it is? You once said that if at all possible use it over IOPC because it can do so much more.

Well if you have followed my website(-s) you should know that I have always said that you need some basic skills in programming... Ofcourse I like to encourage people and to help them with examples.

In my previous post I respond to Boeing Skunk Works statement:

"Just a bunch of gibberish on a computer screen that you hope will do something if it's all perfectly, meticulously, in the correct sequence with the correct characters."

If you see it like this, then there is not much hope ... ;-)

Nico

Michael Carter
08-10-2008, 05:29 PM
Well if you have followed my website(-s) you should know that I have always said that you need some basic skills in programming... Ofcourse I like to encourage people and to help them with examples.

In my previous post I respond to Boeing Skunk Works statement:

"Just a bunch of gibberish on a computer screen that you hope will do something if it's all perfectly, meticulously, in the correct sequence with the correct characters."

If you see it like this, then there is not much hope ... ;-)

Nico

That is exactly the way anyone would see a foreign language who did not understand it or took any courses in it.

It was difficult enough for me to learn German using real letters, words, and phrases when I took those courses. To see something in front of you that looks like programming with no frame of reference for what any of it means, then yes it is just jibberish.

At least with most Western foreign languages there is an inkling of familiarity with what you are looking at.

Why is it that no one has developed a programming language that understands plain english? Or even plain German for that matter.

"When I throw switch #1, Landing lights illuminate."
"When I throw Switch #10, Heading Hold is engaged and HDG HLD illuminates."

Etc., etc.

kiek
08-10-2008, 05:42 PM
Why is it that no one has developed a programming language that understands plain english? Or even plain German for that matter.

The problem is that natural languagues are too ambiguous to be used to program a computer (at least the things we call a computer these days).

BoeingNG
08-10-2008, 06:02 PM
Hi Guys,

Without stepping on Kiek's toes, I am happy to assist anyone with SIOC issues if you can wait a few days. I agree with the posts here that sometimes it is difficlult to grasp if you are new to programming.

Evan as a programmer in my early IT days, I found the initial SIOC learning a bit strange, but I have it cracked now. Kiek is still the main man in the SIOC world, I am just lending a hand.

Best regards,
John

jmig
08-10-2008, 08:31 PM
Hi Guys,

Without stepping on Kiek's toes, I am happy to assist anyone with SIOC issues if you can wait a few days. I agree with the posts here that sometimes it is difficlult to grasp if you are new to programming.

Evan as a programmer in my early IT days, I found the initial SIOC learning a bit strange, but I have it cracked now. Kiek is still the main man in the SIOC world, I am just lending a hand.

Best regards,
John

I will gladly accept any and all assistance from you John, Nico, or anyone else. I understand the logic of the event driven language. It is the details that are tripping me up.

I have read every tutorial, PP Presentation I have found. I have struggled through the Babel translated English (Which is much easier for me to read than the native Spanish :) ). I thought I HAD a handle on it when I attempted to do the test coding for the three switches. Guess I was wrong.

The problem is that when things don't work as expected I don't know enough to figure out the problem.

I am like a sim only pilot who finds himself solo in a real airplane in the clouds. When vertigo sets n, I can't find the pause button. :shock:

paulj
08-11-2008, 02:06 AM
You are definately not alone John, I too am trying to work out SIOC and I have had some programming tutition.
My trouble is that it was sometime ago on some other programming language
and as I've been retired now for going on 5 years I've forgotten a lot of what I used to know.
The old saying "Use it or lose it" certainly applies in my case.:D

cheers

Paul

kiek
08-11-2008, 03:09 AM
Well if you have followed my website(-s) you should know that I have always said that you need some basic skills in programming... Ofcourse I like to encourage people and to help them with examples.


To proove this, here a quote (in French, I'm sorry) from a french website

http://www.simucockpit.com/sioc.htm

SIOC pour Qui? (SIOC for whom?)

Nico Kaan, un utilisateur néerlandais dit "même à des débutants, je recommande d'utiliser SIOC et non pas IOCard de base " Mais il ajoute "il est bien sûr préférable d'avoir quelques notions en programmation informatique, mais de toutes façons, sans ces notions il est préférable de ne pas construire un cockpit..." (Avsim, 14 mars 2006)

(basically it reads: use SIOC instead of the IOCards basic software, but it is certainly to be preferred to have some understanding of computer programming, without these basic skills do not build a cockpit ...)

:-)

But do not let this scare you ;-) if you think you have these basic skills, (maybe you have have written a BASIC program once)?
Some of the basic principles you should understand are, what is a bit, what is a byte, what is an integer, what means signed integer, what is the difference between a variable assignment and a subroutine call, what is an event, what does parallellism (concurrency) imply, and so on ...

Use SIOC in the most simple way, start small, do not use the IOCP protocol but use the FSUIPC IN/OUT links to the Variables in your SIOC program.

Or, if you are building for a Level-D 767 you can use my lekseecon program to connect SIOC to the Level-D. My lekseecon program is using the IOCP protocol internally but that is hidden for you as end user, you can still use SIOC in the simplest way, using my predefined Level-D variables (> 730!) that are implicitly linked to the Level-D.

Hope this makes thing more clear.

Kind Regards,
Nico Kaan

fweinrebe
08-11-2008, 03:17 AM
You all know the saying "A picture says a 1000 words". In programming a good example also says a 1000 words. What make VB and C# so popular, is because there are millions of examples and tutorials available on the Internet.

Vendors and communities need to make descent examples and documentation available for at least the beginner, intermediate and advance user. This will only make their products (compilers) more popular and acceptable by the users.

Cockpit building is all about learning new skills. But programming takes time to learn and develop. I can see no better and fun way to enhance programming skills than through cockpit building.

Programming is as much for hobbyists than it is for the professionals. The only difference is the experience (and education).

BoeingNG
08-14-2008, 08:46 PM
Hi all,

Yes you are all correct I think. Some people don't want to be bogged down with this level of detail though. I think if I didn't have a computer background I would be struggling. Howerver, I have and I do understand programming logic in 3g and 4g langualges.

As far as problem solving is concerned, I thrive on that. I am an IT Business Process Manager so I am in problem solving situations on a daily basis. Having said that, the best way of solving a problem is to break it down into component parts and solve it bit by bit.

My approach to the recent Servo problem I had was to just get it to move at all. Once I did that the next step was to get it to move where I wnated it and gradually I fine tuned it to where it is now.

You have to be patient with these things and take a break. 9 times out of 10 you go back to the problem and solve it with a fresh eye.

When I look at some of the more complete flightdecks, I am filled with respect for the guys that built them and all the hours of frustration they have suffered.

Best regards,
John
www.boeing737ng.co.uk

brianwilliamson
08-14-2008, 09:07 PM
I also agree 100 percent. It would be so much easier for us who are completely dumb as far as programming goes, to give specific examples such as : this switch is a toggle, and switches ON the Gear down, on the flight sim and lights up these 3 green leds that are connected to these pins.
Then an example for the same thing if the switch is a momentary one.etc.,etc.,
I suspect the reason we do not get any help such as this, is that the people who write this stuff know exactlty what to do, and need someone at their side to do the instructions, who is completely ignorant of the way programming works.
Perhaps one day !!.............................
Brian W.

BoeingNG
08-14-2008, 09:38 PM
Brian,

I agree, so I always post my updated code on this forum to try and help you guys. If you need any specific code, let me know and I will endeavour to get an example to you. I don't use PM or LevelD just plain old pmdg 737 because I think it is less complicated and more configurable. I use Opencockpits stuff where I have to and the great BU0836X from Leo Bodnar.

If I didn't have help in the beginning then I would have been really stuck. I have to thank Ian@737ng.co.uk. He has been an inspiration and believes in sharing his experiences with all. Hats off to him I say.

Best regards,
John

kiek
08-15-2008, 02:28 AM
Brian,
I don't use PM or LevelD just plain old pmdg 737 because I think it is less complicated and more configurable. I use Opencockpits stuff where I have to and the great BU0836X from Leo Bodnar.

I'm sorry, but I have to disagree... From an interfacing point of view the Level-D is by far the best configurable aircraft, much easier then the plain old pmdg737.

My 2 cts.

Nico