PDA

View Full Version : SIOC Help



CessnaGuy
10-25-2009, 06:57 AM
Can someone please help me understand this little piece of SIOC code as I have ordered an opencockpits servo card to control 3 of 4 of my engine instruments for my Cessna.

Here is the code for a vertical speed instrument which will work in the same way as an engine instrument:

Var 0010, Link FSUIPC_IN, Offset $02C8, Length 4, Type 1 // Vertical Speed
{
L0 = V0010 * 0.7895 // FSUIPC conversion
L1 = L0 * 0.085166 // 12000 FPM = 1022 positions
L2 = 511 - L1 // Center
IF L2 > 1022 // Upper limit
{
L2 = 1022
}
IF L2 < 1 // Lower Limit
{
L2 = 1
}
V0000 = L2
}
Var 0000 // Servo Motor


First Line: Communicates with FSUIPC, names the offset which is the vertical speed indicator...

When it states LENGTH does that mean the number of movements (and it will move between these movements)....

So a vertical speed indicator has 4 movements... from the centre up 2... and from the center down 2.

What does the ''Type 1 // Vertical Speed'' mean? Is this strictly just a name only?

The rest of the code confuses me, as I don't know what the characters are supposed to represent.


As you can see its pretty crazy inside my head trying to understand, if I only know what the characters were such as L2 = 1, V0000 = L2 etc etc etc...

I just cant wait to get some gauges working!

Can anyone put me out of my misery?

Thank you very much.

Alex

fordgt40
10-25-2009, 07:28 AM
Alex

Have you read the unfriendly manual for SIOC, available on their website? To answer your questions:

LENGTH relates to how FSUIPC stores the data information ie 1, 2 or 4 bytes in length. SIOC needs to know how much data to read from FSUIPC

The TYPE argument is not needed here, it generally is used to define the TYPE of switch or encoder that is related to the variable.

The remainder of the code is converting the data format of FSUIPC Vertical Speed into 1022 positions that are then sent to the servo ie 0 is no movement, 511 is mid scale deflection and 1022 is full scale movement. The lines with commented upper or lower limits are there to trap any resultant figures that are greater or less than the servo`s ability to move eg over 1022 or less than 0, in which case the values are reset to the maximum/minimum that the servo can respond to.

Regards

David

CessnaGuy
10-25-2009, 08:08 AM
Thanks David...

I am a complete newbie to SIOC and have been dreading this since I first took glimpse of the idea of building my own gauges. The sooner I learn this the better.

It makes perfectly good sense how you have explained it, and looking at the vertical speed SIOC it really does make sence, as I know generally what it all means now...

I may have a go at building the vertical speed instrument and see how I get on...

Cheers a bunch pal...

Alex

fordgt40
10-25-2009, 08:33 AM
Alex

Glad to help. As you are building your own instrument, you might find this article on Ian Sissons site useful.

http://www.737ng.co.uk/djb/brake_pressure_gauge.pdf

Also, I have just noticed that the SIOC code in your first post is incorrect, as it does not have a variable assigned to the servo motor eg

var 0022, name VSI_SERVO, Link USB_SERVOS, Output 1, POSL 1, POSC 511, POSR 1022

You may also need a device number, dependent on the number of devices in use.

Good luck and don`t hesitate to ask again when further down the course!

Regards

David

CessnaGuy
10-25-2009, 09:19 AM
Thanks David....

I see that Ian has used gears, for the vertical speed I was thinking of directly attaching the pointer to the server arm, would this not be the case? Do you need gears, or are gears just to make movement easier because of the position of the servo?

Thanks a bunch.

Much appreciated....

Alex

fordgt40
10-25-2009, 10:00 AM
Alex

Most servos have a rotation limit of circa 180deg. If that suits your ASI gauge face then ok, if not, then you will need gearing to extend the servo rotation to match the sweep of the gauge face

Regards

David