Results 1 to 10 of 27
-
08-02-2008, 09:15 PM #1
SIOC Everything looks good, BUT.....
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 #John
System:
ASUS P5Q SE/R
Intel Q9550 O/C to 3.4 GHz
4 GB 1066 DDR2 RAM
300 GB WD 10,000 RPM Raptor SATA Drive
GeForce 8800 GT 512 KB RAM
Matrox TH2Go with three 19" Sumsung 940 BX
IR Track 4
-
08-06-2008, 08:39 AM #2
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
-
08-07-2008, 10:19 PM #3John
System:
ASUS P5Q SE/R
Intel Q9550 O/C to 3.4 GHz
4 GB 1066 DDR2 RAM
300 GB WD 10,000 RPM Raptor SATA Drive
GeForce 8800 GT 512 KB RAM
Matrox TH2Go with three 19" Sumsung 940 BX
IR Track 4
-
08-08-2008, 03:15 AM #4
Remember to rename the file to "sioc.ssi". Otherwise it won't work.
-
08-08-2008, 03:43 AM #5
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)
-
Post Thanks / Like - 1 Thanks, 0 Likes, 0 Dislikesjmig thanked for this post
-
08-08-2008, 04:42 AM #6
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
-
08-08-2008, 06:48 AM #7
.... it all looks well, but.
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
-
08-08-2008, 10:53 AM #8
- Join Date
- Feb 2008
- Location
- Canada
- Posts
- 19
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.)
-
08-10-2008, 08:37 AM #9
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.
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.John
System:
ASUS P5Q SE/R
Intel Q9550 O/C to 3.4 GHz
4 GB 1066 DDR2 RAM
300 GB WD 10,000 RPM Raptor SATA Drive
GeForce 8800 GT 512 KB RAM
Matrox TH2Go with three 19" Sumsung 940 BX
IR Track 4
-
08-10-2008, 08:54 AM #10
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.Boeing Skunk Works
Remember...140, 250, and REALLY FAST!
We don't need no stinkin' ETOPS!
Powered by FS9 & BOEING
Similar Threads
-
Any good sioc script ?
By 737NGPilot in forum PM Boeing FMC/CDUReplies: 2Last Post: 07-15-2010, 06:50 AM -
Good MCP for 737-800?
By HondaCop in forum I/O Interfacing Hardware and SoftwareReplies: 8Last Post: 07-17-2009, 05:09 AM -
Good Day All
By DarylL in forum Welcome to MyCockpit New here? Introduce Yourself!Replies: 2Last Post: 12-06-2008, 05:13 PM -
good day
By 747sim in forum Welcome to MyCockpit New here? Introduce Yourself!Replies: 22Last Post: 08-06-2008, 08:29 PM -
Is FSX any good???
By Simran737 in forum General Builder Questions All Aircraft TypesReplies: 11Last Post: 01-06-2008, 11:15 PM
KIDS TEEN 9year GIRL DAUGHTER WEBSITE: OPEN IN AN ANONYMOUS BROWSER (the link does not work in...
Offsets for Trottle