# Thread: SIOC Experts: What does this mean?

1. ## SIOC Experts: What does this mean?

I found and borrowed some code for using a pot to set rudder trim. The code listed below works. My question is what do the various math steps do. I would like to understand HOW it works, not just copy.

The code is:
Var 0085, Link FSUIPC_OUT, Offset \$2EC0, Length 8, Numbers 2 // inicio scrip rudder trim

Var 0400, Link USB_ANALOGIC, Input 1, PosL 0, PosC 125, PosR 255
{
L0 = V0400 * 155
L0 = L0 - 19530
V0085 = L0 / 1000
L1 = L0 / 1000

I understand the two Variable lines. I understand that L0 is a temp variable.

Why multiply V0400 by 155?

Why subtract 19530 from the result?

Then why divide by 1000?

Can someone help a programing noob understand?

2. Var 0085, Link FSUIPC_OUT, Offset \$2EC0, Length 8, Numbers 2

Var 0400, Link USB_ANALOGIC, Input 1, PosL 0, PosC 125, PosR 255
{
L0 = V0400 * 155
L0 = L0 - 19530
V0085 = L0 / 1000
L1 = L0 / 1000
}

Hopw you understand it with the following explanation :
1) the middle point of the pot should result in 0 so 126 * 155 = 19530 => V0085 will be 0 if the V0400 = 126
(I would probably change this to 125*155=19375 => so V0085 would be 0 at V0400=125)

2) the pot can increase then its value to 255 => V0085 = 19.995
or it can decrease to 0 => V0085 = -19.530

turning of the rudder trim pot will result in a value from -19.530 to 19.995.
Now we have defined here the FSUIPC_OUT to have Numbers 2.
This will make the value be divided by 100 ... so actually the value in the offset will be
-0.19530 to 0.19995
if you convert this to degrees you se a rudder trim deflection between - 11.5 to 11.5 degrees.

in fact , you could rewrite this code and not divide L0 by 1000 to get V0085
but define the fsuipc_output with Numbers = 5

This is a quote form the help file in config_sioc.exe
"Numbers : If we work with 8 bytes FLOAT, this attribute sets the division factor. If we set 1 and FLOAT is 123, the variable will store 12.3."

Greetings Peter Depoortere

3. Thank you Peter. This is JUST what I needed to see. It allows me to understand the inner workings of SIOC.

I have always been a person who wants to understand the "whys" and "wherefore" of things. In this way you can actually the system and figure out what is wrong when it doesn't work according to plan.

I didn't know sioc.exe had a help file. I will have to look it over.

4. I used to drive my math teachers absolutely crazy for that reason.

I never could get a straight answer out of them. I used to do the same to the Boeing instructors when I went through tech school at Chanute too.

Amazing how some can teach subjects but not explain the "why".

5. Jmig,

the help file is the one from CONFIG_SIOC.EXE , not the sioc.exe ...
Anyway, its only when you truly understand an example code that you can start
fiddling yourself. Once you get the basics , and you understand them well you can
try out some variations and new things with it....
Thats my main reason that I dont get started in programming windows (visual C++) ...
so many classes existing and not really seeing how they work and interact ...
Still trying...

Greetz Peter