Results 1 to 7 of 7

Thread: SIOC Code

  1. #1
    75+ Posting Member
    Join Date
    Dec 2006
    Location
    USA
    Posts
    127
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    SIOC Code

    Hello,

    I have built a MCP using opencockpits I/O card and it works using the simple I/O software, But I have read that a much more flexible way to go is writing my own SIOC code. Opencockpits has several examples of how to set up a MCP ( with SIOC), but they all seem to have some bugs.

    Nico has a great examples of how to set up a MCP correclty using SIOC and the Level-D 767, but this panel is not compatable with project magenta, So I cannot use these offsets and code....*sigh*.

    In the mean time, I have been reading & re-reading reading examples of this code writing, but have not been able to put my arms fully around it yet.


    So, If anybody has any SIOC code for fs2004 MCP I would love if I could take a look at it.


    Polmer

  2. #2
    Executive Vice President, MyCockpit


    Matt Olieman's Avatar
    Join Date
    Oct 2005
    Location
    Ocala, FL USA
    Posts
    2,884
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Smile Me too

    I'd be interested too. I've been on a long sabbatical from building and never got to use my I/O cards.

    So any information related to I/O cards (simplified) would be helpfully for me to

  3. #3
    75+ Posting Member
    Join Date
    Dec 2006
    Location
    USA
    Posts
    127
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Ok,

    Here is an example of some SIOC code that will show how to get the Heading of an MCP to both read and write. you can use your mouse to change heading and it will change the 7 segment display, or you can use the encoder and i will show up in the FS panel. Same with the switch and LED read out. This is based off oc Nico's Level D 767 code but I have changed the offsets to work with any generic fsX or fs2004 panel.

    I am using the Opencockpit I/O card, along with the latest version of SIOC.



    // *****************************************************************************
    // * Config_SIOC ver 3.3 - By Manolo Vélez - www.opencockpits.com
    // *****************************************************************************
    // * FileName : Heading Example.txt
    // * Date : 12/16/2006
    ///Tom Koresch

    /// here is an example of how to get both read and write capabilities using heading as an example. Based off of Nico's example code. Thanks //Nico!



    Var 0001, name X_HDG, Link FSUIPC_INOUT, Offset $07CC, Length 2
    {
    L0 = DIV &X_HDG ,182
    IF &HDG <> L0
    {
    &HDG = L0
    }
    }

    Var 0002, name HDG
    {
    CALL &OutHDG
    }

    Var 0003, name OutHDG, Link SUBRUTINE
    {
    &D_HDG = &HDG
    L0 = &HDG * 182
    IF &X_HDG <> L0
    {
    &X_HDG = L0
    }
    }

    Var 0004, name RO_HDG, Link IOCARD_ENCODER, Input 6, Aceleration 4, Type 2
    {
    L0 = &RO_HDG // * -1 turning right should be plus
    &HDG = ROTATE 0 ,359 ,L0
    }

    Var 0005, name D_HDG, Link IOCARD_DISPLAY, Digit 0, Numbers 3

    Var 0006, Link FSUIPC_INOUT, Offset $07C8, Length 4
    {
    IF V0006 = 1
    {
    V0007 = 1
    }
    ELSE
    {
    V0007 = 0
    }
    }

    Var 0007, Link IOCARD_OUT, Output 15 // Heading LED

    Var 0008, Link IOCARD_SW, Input 15, Type P // Heading Swich
    {
    IF V0008 = 1
    {
    V0006 = 1
    }
    ELSE
    {
    V0006 = 0
    }
    }





    Tom

  4. #4
    1000+ Poster - Fantastic Contributor Bob Reed's Avatar
    Join Date
    Oct 2005
    Location
    Holley, New York U.S.A.
    Posts
    1,776
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Thumbs up

    Ya know..... I hate to throw this out there but I can not help it... This looks (I am not implying anything here other then I have seen this or very close myself) like EPIC code! Looks like these cards are VERY powerful indeed. I know there is not much (if ya know how) you can not do with EPIC and these look simaler. VERY NICE!!!!!!
    Bob Reed

  5. #5
    75+ Posting Member
    Join Date
    Dec 2006
    Location
    USA
    Posts
    127
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Well,

    I have heard great things about the epIC card, but dont know anything about what the code looks like, but I will say this......The combination of the flexible software and relatively inexpensive I/O ( opencockpits) card make this appealing to the budget constrained builder ( like me).

    Tom

  6. #6
    75+ Posting Member
    Join Date
    Dec 2006
    Location
    USA
    Posts
    127
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    I have noticed some fluttering and delay with the initial code displayed above,
    and after some improvements, have got it to work much better...but with a catch.

    For some reason, default fs2004 panels & FSX panels act differently to this (read and write). Since I am still running fs2004 ( dont have the system to run fsx), I was interested is getting it to work smoothly in that enviroment.

    The meat of the change is that it uses the equation; 65536/359, rather than 65536/360.

    I am very new to writing code, but here is a messy version I got to work with Default fs2004 panels, in Sync and no fluttering;



    Code for Default fs2004 heading with read and write capabilites;
    =========================================================

    Var 0600, Link IOCARD_DISPLAY, Digit 0, Numbers 3

    Var 0500, Link IOCARD_ENCODER, Input 6, Aceleration 6, Type 2
    {
    L0 = V0500 * 1
    V0900 = ROTATE 0 ,359 ,L0
    }

    Var 0005, Link FSUIPC_OUT, Offset $07CC, Length 2

    Var 0305, Link SUBRUTINE
    {
    V0600 = V0900
    L0 = V0900 * 182.55153203
    IF V0005 <> L0
    {
    V0005 = L0
    }
    }

    Var 0800, Link FSUIPC_IN, Offset $07CC, Length 2
    {
    L0 = V0800 / 182.55153203
    L0 = L0
    IF V0900 <> L0
    {
    V0900 = L0
    }
    }

    Var 0900 // 900
    {
    CALL V0305
    }




    For FSX, this code both Read and writes
    =====================================================================
    Var 0600, Link IOCARD_DISPLAY, Digit 0, Numbers 3

    Var 0500, Link IOCARD_ENCODER, Input 6, Aceleration 6, Type 2
    {
    L0 = V0500 * 1
    V0900 = ROTATE 1 ,360 ,L0
    }

    Var 0005, Link FSUIPC_OUT, Offset $07CC, Length 2

    Var 0305, Link SUBRUTINE
    {
    V0600 = V0900
    L0 = V0900 * 182.0444444
    IF V0005 <> L0
    {
    V0005 = L0
    }
    }

    Var 0800, Link FSUIPC_IN, Offset $07CC, Length 2
    {
    L0 = V0800 / 182.0444444
    L0 = L0
    IF V0900 <> L0
    {
    V0900 = L0
    }
    }

    Var 0900 // 900
    {
    CALL V0305
    }




    This same code can be modified to work with course as well.


    Polmer

  7. #7
    Executive Vice President, MyCockpit


    Matt Olieman's Avatar
    Join Date
    Oct 2005
    Location
    Ocala, FL USA
    Posts
    2,884
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Excellent info... thanks for the code This is very helpful.

Similar Threads

  1. SIOC Elevator Pot Code
    By tomenglish2000 in forum OpenCockpits General Discussion
    Replies: 0
    Last Post: 09-28-2009, 06:26 AM
  2. What's going wrong in my SIOC code?
    By MicroHellas in forum I/O Interfacing Hardware and Software
    Replies: 11
    Last Post: 08-22-2008, 06:55 AM
  3. SIOC Code for MCP, MIP, and TQ updated
    By BoeingNG in forum OpenCockpits General Discussion
    Replies: 3
    Last Post: 08-10-2008, 05:53 PM
  4. Sixpack SIOC code
    By dcutugno in forum PMSystems
    Replies: 0
    Last Post: 12-16-2007, 04:55 PM
  5. ALT , FLT LDG, Displays and ENC SIOC code
    By dcutugno in forum PMSystems
    Replies: 0
    Last Post: 12-10-2007, 07:10 PM