PDA

View Full Version : OC assignments



gspannelljr
03-03-2014, 07:33 PM
I finally got my oc cards to work, my usb and master are both working fine in the sioc screen. I loaded my first script, an on/off switch command for the battery master switch. The assigned terminal responds to the command in sioc. I don't know how to assign the switch in FSX. When I go to the switch assignments in fsx, the usb/master does not show as an option. I have installed fsupic and it shows active in the sioc screen. What have I missed?

kiek
03-04-2014, 06:48 AM
What have I missed? You miss a link with FSX! Note that Switch assignments in FSX is only available for buttons at Joysticks. The USB expansion card is not a JoyStick... You can communicatie with FSX by using FSUIPC offsets. Here is an example of how to write to an FSUIPC offset (http://www.lekseecon.nl/howto.html#writeFSUIPC) from SIOC. You also have to find a suitable offset. This is dependent on your aircraft and how it is supported. I suggest to start with switch (landing) lights or something like that, most aircrafts support that.Nico

gspannelljr
03-04-2014, 08:26 AM
Great,now I am starting to understand! Thanks!!!

iwik
03-04-2014, 03:51 PM
Can not emphasize enough how useful Nico's site and his howto's are.
Just study the simple scripts and build from there.
Les

gspannelljr
03-05-2014, 08:45 PM
Ok, I found the variable I want to use, 3102, which is the master battery. I just don't understand where do I insert the variable, Ie, where do I insert the command? In Sioc? Please be patient, I am not a progamer....Yet!!!! But I'm learning. Can you suggest anything I can study to better understand the basics? Perhaps a book on C++? Thanks Again!

iwik
03-06-2014, 12:56 AM
Some understanding of basic programming is required,
Like IF Else And Or statements.
Do a Google search and the descriptions will help greatly.
Go onto O/C forum under Sioc examples and you will a better idea of completed scripts.
Here is a simple example of Battery switch



Var 0015, Link IOCARD_SW, Input 16, Type I // Battery Switch
{
V0007 = V0015
}
Var 0007, Link FSUIPC_OUT, Offset $3102, Length 1 // Battery

Les

gspannelljr
03-06-2014, 08:56 AM
I Understand the need for the script as well as how to define one. I just don't know where to insert it. Do I put it in the sioc script file?

fordgt40
03-06-2014, 11:36 AM
Not certain what you are not understanding.

If you want to have a switch hooked up to OC hardware eg a battery switch as above, and then pass that info to FSX then you need the following

A script like the one above by Iwik (though change the switch input number to match your hardware) That script can be standalone or included within another script. However, your sioc.ini file must be given the name of the script that has the battery switch code included within it. You can do that either by editing the sioc.ini file as advised on another thread, or presumably by using config_devices, however, I do not use that utility.

You will also need to have installed FSUIPC

mike1342
03-06-2014, 11:58 AM
I Understand the need for the script as well as how to define one. I just don't know where to insert it. Do I put it in the sioc script file?

as an offer
if you load and are happy to use teamviewer9 (standard helpdesk software - free) plus a side channel for speech - i am happy to spend some time putting your 1st script together and showing you where all the bits go as shown below
Mike

gspannelljr
03-06-2014, 01:07 PM
That's what I needed, what file to put it in. the sioc ini file. Ill let you know how it goes.
BTW, I never got a reply from you on my last question in our previous thread in order to clarify my understanding of what you were suggesting. I do appreciate your help.
Thanks!

fordgt40
03-06-2014, 01:43 PM
To be clear and avoid any misunderstanding the sioc.ini file only contains system information and parameters that can be changed by the user - not script files. As advised in an earlier post in a different thread, there is a line in sioc.ini that points to your script file. That file eg mytest.txt (or whatever you call it) must contain your battery switch code. If your sioc.ini file is not amended (directly or via config_devices) to point to your script file then it will not work

I am not aware of any question from you in a previous thread remaining unanswered :(

kiek
03-06-2014, 01:49 PM
Perhaps a book on C++?
Certainly not, C++ is 100 times more complex then SIOC. Even the programming language BASIC is more complex then SIOC.
Just some basic knowledge of programming is required, such as IF THEN ELSE statements, Expressions, Variables, Subroutines, Integer and Boolean values.

Nico

gspannelljr
03-06-2014, 02:31 PM
I apologize if there was a misunderstanding. Where is the sioc.ini file located? I cant find it. all I can find is the following.a folder in program files for I/o cards, a sub folder sioc,a sub folder scripts, and then a whole lot of txt files below that folder. Please tell how to find it, then I can do exactly as you have described.

kiek
03-06-2014, 02:54 PM
The sioc.ini file is in the SIOC folder.... (unless you have deleted it..., if so i'd recommend to reinstall sioc)

Nico

iwik
03-06-2014, 04:04 PM
On a normal sioc install. It should be under Program Files or Program Files(x86)/Iocards/Sioc then you should see a list of txt files and other files in Alphabetical order. So Sioc.ini should be
way down the list.
What operating system are you using.
Les

gspannelljr
03-06-2014, 07:14 PM
Well that's odd, I do not have a file labled sioc.ini. I do have one labled sioc.ini.bak. I tried to open it but my pc does not have the ablity to open a bac. file. So I figured my ini file was missing. I uninstalled, restarted my pc, then resinstalled. Now I don't even have the sioc.inii.bak file. I am using windows 7. I installed sioc v46b1 that I got from the oc website. Do I need to try an older version if any of you still have it?

gspannelljr
03-06-2014, 07:27 PM
there is a tab on the console labled edit INI. Can I use that? I downloaded the iocards programing manual. None of the screen shots match what I see. I think I have a brand new version, that is different that the one you guys are using, that's why nothing is making sense. What do you think? If any of you have the older version, email it to me and Ill install it instead. gspannelljr@yahoo.com

gspannelljr
03-06-2014, 08:28 PM
Sorry for all the notes guys, but Im typing as I try stuff. Ok, I just made a lot of progress. I figured out how to take the script Les sent me and compile it into sioc. The compiler said it compiled ok. I checked the iocp console, both scripts showed up in positions one and two. When I grounded pin 16, they both changed states to ones. I then loaded FSX, Cessna 172. While triggering pin 16, nothing changes, battery, nothing. What did I miss? I feel I am so close!

iwik
03-06-2014, 08:30 PM
Yes you can use Tab edit ini. That was added later to make your job easier.
The sioc.ini.bak was your SIOC.ini backed up by some means. I am not sure what
caused this to be backed up. A new install will generate a new sioc.ini.
In win7 you may have to look at the description alongside the files called sioc to find the
sioc.ini. Description should be Configuration.
You wont see Sioc.ini if your operating system is not configured to read all files in Folders.
Don't worry about that, it wont cause any harm.
Just use the edit ini tab to make the needed changes to your file.
Let us know hoe you go.
Les
P.S If you ever need to read a .bak file, just remove the .bak
extension.

iwik
03-06-2014, 08:48 PM
Please ignore last post, looks like we crossed paths.
Have you got FSUIPC loaded in FSX.
Les

gspannelljr
03-07-2014, 08:28 PM
yes, I downloaded and installed fsuipc. My console shows fsuipc linked to fsx.

iwik
03-07-2014, 09:49 PM
Go to your edit ini tab.
Look for a group of lines like this in the section called English


[MASTER=3,6,1,252]
[MASTER=0,4,1,0]
[MASTER=0,12,1,0]
[MASTER=0,16,1,0]

REMOVE THE [ ] from line 2 and save.

It looks like with the latest version they do not have by default in the ini file
defined as 1 MasterCard with usb expansion.

Old versions by default you did not have to set.

Please check to make sure your ini file has been set up for the above.
Les

gspannelljr
03-09-2014, 11:17 AM
Well darn, I tried to do what you said. The way I understand it is, the examples in the brackets are not read by the program, right? By removing the bracket you make that setting active? I did as you suggested but it said I was not allowed to make the changes to the file. I went to the folder propertied, and allowed all users to make changeds to all files in sioc. It STILL would not let me save. I then copied the file to another folder, changed it, then swapped it with the one in sioc. It reverted my changed file back to the original setting. I then retyped the command below the list, It still would not let me save. So, Im a bit lost how to do this now!

gspannelljr
03-09-2014, 11:44 AM
Good news and bad......... I had an idea,I copied the ini file to another location, then saved it to the sico directory.It allowed me to do that therefor making the needed changes. I figured out It would not let me remove the file and modify it but It would let me overwrite it. I then mades sure all my settings had not changed, The IOCP console still shows the correct response when I trigger pin 16, still shows the link to fsuipc. I then launched fsx and guess what? It STILL does not respond to the switch input!!!! ARGH!!!!! Something Is still not right, obviously. I appreciate you guys hanging with me and sorting this out! Thanks!!!!

gspannelljr
03-09-2014, 01:27 PM
yahoo!! I did it!! I did some more reading in the help file, found what was missing.The last digit in the config had to be the device number produced by the pc. Mine was 38. I replaced the last digit, 0, with a 38 and reloaded fsx. Now the battery switch changed states as commanded. Wow, I sure hope it gets easier from here! ;)!!!

iwik
03-09-2014, 02:15 PM
Well done. Yes reading up is what you have to do. Be warned, there is still plenty of
traps. So start searching the net and read. Best advice I can give you.
Les

gspannelljr
03-09-2014, 02:34 PM
Thanks Les. I know what you mean. Even though I'm no programmer, I can sort of understand what needs to happen. I really appreciate how you and the others are able to help me sort this out. I am happy to help you or another any time! Now I can really start putting this together. I'm stoked!

iwik
03-09-2014, 03:21 PM
Like me im no programmer just a plodder. There are plenty of examples out there. Able to do most anyone would
need in either a GA plane or an airliner.
Enjoy the journey, there will be frustrations but keep at it and you will be rewarded, I was.
I'm indebted to this community, Nico and David's some of the main stayers. As stated earlier Nico's site
is excellent once you get the hang of the basics.
Les

fordgt40
03-09-2014, 05:48 PM
Glenn

Glad you got there - well done.
SIOC is both very powerful and demanding. I regularly get caught out by some of the traps, you will also encounter them :p
Keep reading and studying the info on Nico`s site and most importantly read all the documentation

Keep at it

David

gspannelljr
03-09-2014, 06:10 PM
Thanks guys. Good thing I love a challenge! I am now working on my starter switch, it has off, left, right, both, start postions. I am having a hard time figuring out how to define its postion. Ie, fsx uses address $0892 with 0 as off, 1 as left, 2 as right, and so on. Since I have an ordinary encoder, I am trying to figure out where to define the encoder position, or switches " value" (o, 1, 2, etc) in the script. Is that possible in a switch script? I was using this script as a start point. Var 1 Link IOCARD_SW Input 23 Type I //startersw
Var 2 Link IOCARD_SW Input 24 Type I
Var 3 Link IOCARD_SW Input 25 Type I

fordgt40
03-09-2014, 06:32 PM
Glenn

You say you are using an "encoder" so not a switch?

A switch is easy to programme for your example, but an encoder, which increments or decrements is not easy at all. To be honest you should use a rotary switch.

David

gspannelljr
03-09-2014, 07:09 PM
you know, I have a hard time with the definitions of the different encoders. To Me, a rotory switch, with one common terminal, with multiple out puts that are switch individually, is a rotary switch. that is what I have. Term one is common, then the next 4 are turned on individually. So can I use this switch or do I need a different one?

fordgt40
03-10-2014, 05:14 AM
The component you describe is a rotary switch which is precisely what you need - not an encoder.
Now define each switch position as a variable and if it is "on" then send the corresponding value to the fsuips offset. I am assuming that you have wired up the switch contacts to your "input" board :)
Nico`s site has examples

David

gspannelljr
03-11-2014, 07:10 PM
How do I write the script to reflect the specific value (0,1,2,3,4)? You wrote to "send the corresponding value to the fsuips offset" and I can't figure out how to define the value in the script. I have looked all over nico's site and the help files but can't seem to find anything on that. Yes, I have wiried it up in sequential terminals on my master boards input.

kiek
03-12-2014, 04:07 AM
How do I write the script to reflect the specific value (0,1,2,3,4)?
It goes like this:


Var 1 Link IOCARD_SW Input 23 Type I // off position of rotary switch
{
IF v1 = 1
{
&Starter = 0
}
}
Var 2 Link IOCARD_SW Input 24 Type I // left position of rotary switch
{
IF v2 = 1
{
&Starter = 1
}
}
// and so on ...
Var 10 name Starter Link FSUIPC_OUT Offset $0892 Length 1 // Starter offset

Nico

gspannelljr
03-12-2014, 08:38 PM
outstanding! Thanks, I got it, so using "name starter link" ties all those variables together that are named "starter". That I did not know. a very useful command. Thanks so much Nico. Now my GA sim starts, the throttle, mixture, and axis are all working. I can actually fly, sort of...... I am now working on my gauges too. I am using air coil, steam type gauges. I thnk I will use the dc motors card, put a resistor in to drop the voltage, and use that to drive my gauges. What do you think? Glenn

kiek
03-13-2014, 09:47 AM
Congratulations with the steps you made.

About your new question: please start a new thread while you're drifting off topic.

Nico