PDA

View Full Version : HELP, i am totally lost with SOIC



Jasmckee
07-06-2010, 02:41 AM
hi GUys,

i am looking at soic, reading all the articles i can find, and still cannot get my head around how to program this. i have got encoders, switches and such to confirgure to run the mindstar g1000 software, but i cannot get m head around how i should be writing the code for soic.

any kind soul care to help out??

thanks

Jason

pdpo
07-06-2010, 03:21 AM
Hi there,

SIOC is not that difficult ... the documentation is not that good but the site of Niko Kaan (Kiek) is a good starting point with many small parts of SIOC code which you can try out and modify and then learn by trying.
The catch of SIOC lies in the fact that the SIOC script you need to write is actually only an input to the sioc program itself which works in the background.
So when you define a variable as FSUIPC_IN type, then the SIOC program will start reading every X ms this offset and if the value of this offset changes from the previous value known to the SIOC program itself then the body of the script attached to the variable is executed.
This behavior is also valid for IOCARD_INPUT type of vars but here the SIOC reads every 10ms the hardware and if an input changes value (from 1 to 0 or from 0 to 1) then the body attached to this input variable in the script is executed.
Same is applicable for the normal variables which have no input (no fsuipc/no hardware input), only when they change value the script attached to it is executed. So when an fsuipc offset changes and in the body of that fsuipc variable you change the value of several normal variables, then this creates a avalance effect since each variable change causes executing of a script (if its defined of course).
Ones you understand this concept then its easier to get along with SIOC scripting.
Remind that if no variable changes, no inputs changes, then SIOC will just read continuously the fsuipc offsets and the hardware for changes in the states and only if there are changes in one of those, then some part of the script is invoked.

Greetz Peter

PS: the best way to learn is to try some small script, understand what happens and if that small script doesnt do what you expect it to do, then post this script here and tell what you expect it to do, then we can explain why it behaves the way it does ...

PS : X ms : this value is defined in the SIOC.INI

PS : of course this is only the basic working of SIOC since there is also another function. SIOC itself is also a server for other clients. Clients on other computers can register themselves to some variables or even all variables. Then when a variable changes value its not only executing the attached body to that variable but the server send the variables value also via the network to the clients who have registered to this variable.
But this way of working is of course a little more complicated.

PS : when learning SIOC scripts make use of IOCPconsole program. This program is a client to SIOC (as described above) and it registers itself to the variables you select. When a variable changes value this iocpconsole shows this change and you can easily follow what happens.