Results 1 to 5 of 5
-
09-03-2008, 04:56 PM #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?
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
-
09-04-2008, 05:45 AM #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
-
Post Thanks / Like - 1 Thanks, 0 Likes, 0 Dislikes
jmig thanked for this post
-
09-04-2008, 07:33 AM #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.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
-
09-04-2008, 07:57 AM #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".Boeing Skunk Works
Remember...140, 250, and REALLY FAST!
We don't need no stinkin' ETOPS!
Powered by FS9 & BOEING
-
09-04-2008, 08:07 AM #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
Similar Threads
-
Question for experts regarding OC MCP
By barkay in forum OpenCockpits General DiscussionReplies: 7Last Post: 09-24-2011, 04:31 PM -
Some initial questions - Could you offer some answers please experts!
By darrenw in forum Where to Start Building a Home CockpitReplies: 4Last Post: 02-22-2011, 04:57 PM -
Sioc / PM
By mpl330 in forum OpenCockpits General DiscussionReplies: 6Last Post: 02-07-2010, 01:26 PM -
Probably a stupid question for PM experts
By barkay in forum PM Boeing GCReplies: 5Last Post: 11-26-2008, 10:59 AM -
N1 SET and SPD REF - SIOC
By paoloj in forum OpenCockpits General DiscussionReplies: 0Last Post: 10-28-2008, 04:23 AM