Results 11 to 14 of 14
Thread: Help with SIOC please?
-
11-19-2009, 05:10 PM #11
- Join Date
- Nov 2008
- Location
- Belgium
- Posts
- 20
Re: Help with SIOC please?
Yes, you can continue in the same file. Just start a new line of code.
Best thing to do is divide your complete list of code in sections so you can always find a certain section in case of trouble. Just add some comment in your code. At this moment you don't need it because it's still a small program but if you start programming your complete cockpit, then there will be lot more lines of code and it will be difficult to find something.
You can add comment in your code this way:
// here you can put comment.
So you start with two slashes a space and then your comment.
Don't forget the space after the two slashes or your program will not run.
Gert.
-
11-19-2009, 05:11 PM #12
- Join Date
- Aug 2009
- Location
- Somerset UK
- Posts
- 25
Re: Help with SIOC please?
Hello Jake,
A new section of code in the same file should do the trick.
I am not an expert by the way, I am trying to learn SIOC myself.
Good luck,
Peter.
-
11-19-2009, 06:35 PM #13
Re: Help with SIOC please?
Thanks again to both of you.
For my sim Im using PMDG 747-400 thats the only thing I can use until PSX.
But as you know PMDG is hard to interface, but I learned the other day that using mouse macro switches can be assigned to the key board. It worked for me, but I wanted a real switch to work with pmdg so thats why I set out with SIOC.
just after you guys told me how to set up SIOC I got a push button to make the speed selector come on, on pmdg. This is the code for it:
Bearing in mind the button is in input 27 on my master I/O card.
Var 1 Link IOCARD_SW Input 027 Type I
{
&FO_JoyStick64 = CHANGEBIT 0 v1 // toggle bit 0 of joystick 64
}
Var 2 name FO_JoyStick64 Link FSUIPC_OUT Offset $3340 Length 4
Basically when I push the button it tells FSUIPC that bit 0 of a virtual joystick has been pushed or changed etc, so when I go on FSUIPC I can push the button, it will recognise it and then I can set that button to send the key action that switches on the speed selector,,, I think hahah.
Sooo then I wanted a switch to turn on the A/T this was the hardest part for me, I had some help on how to rite the previous code form tutorials etc, but now i had to think it out myself. So I put a 2 terminal toggle switch (SPST) in input 001 of the master card and wrote the following code under the other one:
Var 3 Link IOCARD_SW Input 001 Type I
{
&CO_JoyStick64 = CHANGEBIT 1 v3 // toggle bit 1 of joystick 64
}
Var 4 name CO_JoyStick64 Link FSUIPC_OUT Offset $3340 Length 4
This "sort" of worked, meaning that I had to switch the switch on then off then back on again for it to turn back off the A/T, this totally confused me and took me about an hour to figure lol. I tried many ways to fix this but eventually I realised to try a 3 terminal switch (DPDT), but I did not know how to write the code for this so I sat an puzzled, and then it came to me.
To make the DPDT switch work obviously I need to inouts and the common ground, so I used input 001 and 002. I thought If i could get input 001 to toggle bit 1 of joystick 64 to turn on the A/T then I could get input 002 to toggle bit 1 of joystick 64 also, so this ment either way I switched it, bit 1 is being toggled (thats what DPDT's are for anyway haha) so now I flick the switch and it turms on the A/T and flick it again and it turns of the A/T success!!! Heres the program for it all including the speed selector at the beggining:
Var 1 Link IOCARD_SW Input 027 Type I
{
&FO_JoyStick64 = CHANGEBIT 0 v1 // toggle bit 0 of joystick 64
}
Var 2 name FO_JoyStick64 Link FSUIPC_OUT Offset $3340 Length 4
Var 3 Link IOCARD_SW Input 001 Type I
{
&CO_JoyStick64 = CHANGEBIT 1 v3 // toggle bit 1 of joystick 64
}
Var 4 name CO_JoyStick64 Link FSUIPC_OUT Offset $3340 Length 4
Var 5 Link IOCARD_SW Input 002 Type I
{
&DO_JoyStick64 = CHANGEBIT 1 v5 // toggle bit 1 of joystick64
}
Var 6 name DO_JoyStick64 Link FSUIPC_OUT Offset $3340 Length 4
I know most of you know how to do this, but for anyother builders who dont, I hope this helps, kind of hard to explain but i tried to simplify it as much as possible.
Regards and thanks again,
Jake.
Oh, and btw the reason for the, FO_JoyStick, CO_JoyStick and DO_JoyStick having FO,CO and DO is just because it would not let me have them all called FO which make sense cause they cant all be the same thing.Last edited by Jake 747 400; 11-19-2009 at 06:39 PM.
Boeing 744everjakes747sim.webs.com
-
11-20-2009, 07:00 PM #14
- Join Date
- Apr 2009
- Location
- Toronto
- Posts
- 125
Re: Help with SIOC please?
Hello, Jake.
Not sure it's good etiquette for me to jump in here; but, too late now, so here are my comments.
.... using mouse macro switches can be assigned to the key board....
Var 1 Link IOCARD_SW Input 027 Type I
{
&FO_JoyStick64 = CHANGEBIT 0 v1 // toggle bit 0 of joystick 64
}
Var 2 name FO_JoyStick64 Link FSUIPC_OUT Offset $3340 Length 4
Again, save some cycles. You're using a pushbutton; define it as "Type P" , for pushbutton, and "TOGGLE" the virtual button:
Var 1 Link IOCARD_SW Input 027 Type P
{
&FO_JoyStick64 = TOGGLE 0 // toggle bit 0 of joystick 64
}
.
.
This "sort" of worked, meaning that I had to switch the switch on then off then back on again for it to turn back off the A/T ....
.
.
Look at the FSUIPC Options and Settings page for Buttons + Switches.
You can perform one operation when the button is pressed and another (or repeat the same one) when the button is released. Use your SPST and one Master Card input and map its on-off action to your FSUIPC on-off operations. Again, if you're using mouse macros, no need to use up keystrokes.
The SIOC script becomes:
-----------------------------------------------------------------
Var 1 Link IOCARD_SW Input 027 Type P
{
&JoyStick64 = TOGGLE 0 // toggle bit 0 of Joystick 64
}
Var 2 Link IOCARD_SW Input 001 Type I
{
&JoyStick64 = CHANGEBIT 1 V2 // set/reset bit 1 of Joystick 64
}
Var 10 name JoyStick64 Link FSUIPC_OUT Offset $3340 Length 4
-----------------------------------------------------------------
.
Var 4 name CO_JoyStick64 Link FSUIPC_OUT Offset $3340 Length 4
.
Var 6 name DO_JoyStick64 Link FSUIPC_OUT Offset $3340 Length 4
These were redundant. Define one variabe for the offset and use that throughout your script.
Jim
Similar Threads
-
Sioc / PM
By mpl330 in forum OpenCockpits General DiscussionReplies: 6Last Post: 02-07-2010, 01:26 PM -
Where can I get SIOC, please?
By Jake 747 400 in forum General Builder Questions All Aircraft TypesReplies: 1Last Post: 11-18-2009, 06:10 PM -
SIOC Help
By CessnaGuy in forum I/O Interfacing and HardwareReplies: 5Last Post: 10-25-2009, 10:00 AM -
SIOC for MIP?
By HondaCop in forum I/O Interfacing Hardware and SoftwareReplies: 17Last Post: 07-21-2009, 07:48 AM -
N1 SET and SPD REF - SIOC
By paoloj in forum OpenCockpits General DiscussionReplies: 0Last Post: 10-28-2008, 04:23 AM