Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1
    75+ Posting Member MortenHa's Avatar
    Join Date
    Apr 2007
    Location
    Norway, Vardø
    Posts
    77
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    PM EFIS SIOC Script

    Hi folks!
    Now that the MCP is ready to go,next step is to get the EFIS panels online!

    We have run into numerous problems with the code, but I'll only present one problem at a time:

    Here's part of the script, dealing with the BARO rotary encoders

    Code:
    // PM FSUIPC write offset for QNH Capt.
    //-------------------------------------
    // DEPENDENCIES:
    // RE_E1_PRES
    // 
    // USE:
    // This PM offset holds the barometric pressure for setting QNH 
    // on the Captain side. Controlled with the rotary encoder variable
    // RE_E1_PRES
    //
    //**************************************************************   
    Var 0066 name F_E1_PRES, Link FSUIPC_OUT , Offset $0330, Length 2
    
    // PM FSUIPC write offset for QNH F/O
    //-----------------------------------
    // DEPENDENCIES:
    // RE_E2_PRES
    // 
    // USE:
    // This PM offset holds the barometric pressure for setting QNH 
    // on the First Officer side. Controlled with the rotary encoder variable
    // RE_E2_PRES
    //
    //**************************************************************   
    Var 0067 name F_E2_PRES, Link FSUIPC_OUT , Offset $552E, Length 2
    
    // IO ROTARY-ENCODER Link Set QNH Capt.
    //-------------------------------------
    // DEPENDENCIES:
    // None 
    // 
    // USE:
    // Rotary encoder used to change FSUIPC Offset $0330 (&F_E1_PRES)
    // controlling the QNH setting
    //
    // CODE:
    // The value is modified to:
    // - Change the sign because the value increments/decrements in reverse
    // - Multiply by 16 to show HPa
    //
    //****************************************************************************   
    Var 0306 name RE_E1_PRES, Link IOCARD_ENCODER , Input 54, Aceleration 6, Type 2
    {
        L0 = &RE_E1_PRES * -16  // Rotary turns the wrong way, multiply by 16 and store in locvar L0
        &F_E1_PRES = ROTATE 960, 1050, L0 
    
    }
    
    // IO ROTARY-ENCODER Link Set QNH F/O
    //-----------------------------------
    // DEPENDENCIES:
    // None 
    // 
    // USE:
    // Rotary encoder used to change PM FSUIPC Offset $552E (&F_E2_PRES)
    // controlling the QNH setting
    //
    // CODE:
    // The value is modified to:
    // - Change the sign because the value increments/decrements in reverse
    // - Multiply by 16 to show HPa
    //
    //****************************************************************************   
    Var 0308 name RE_E2_PRES, Link IOCARD_ENCODER , Input 126, Aceleration 6, Type 2
    {
        L0 = &RE_E2_PRES * -16 // Rotary turns the wrong way, multiply by 16 and store in locvar L0
        &F_E2_PRES = ROTATE 960, 1050, L0 
    }
    
    The statements:
    L0 = &RE_E1_PRES * -16 // Rotary turns the wrong way, multiply by 16 and store in locvar L0
    &F_E1_PRES = ROTATE 960, 1050, L0

    It doesn't work as expected. Changing the sign in value L0 is to get the rotary to turn the "right way"

    And it is multiplied by 16 as per definition found in the FSUIPC offset table.

    The ROTATE statement does not work correctly either.

    Anyone any clue?

    Morten & Lasse

  2. #2
    500+ This must be a daytime job



    Join Date
    Jul 2013
    Posts
    917
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Morten

    You do not explain what outputs you are getting, however, I assume that you are using the Opencockpits CTS288 encoder or a similar compatible one? There are many encoders, including some of the Alps ones that are not compatible.

    Regards

    David

  3. #3
    75+ Posting Member MortenHa's Avatar
    Join Date
    Apr 2007
    Location
    Norway, Vardø
    Posts
    77
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Oops David!

    I don't know the brand, but it is a grey encoder!, type 2.

    Sorry

    Morten

  4. #4
    500+ This must be a daytime job



    Join Date
    Jul 2013
    Posts
    917
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Morten

    Opencockpits say that to use a 2 bit gray type encoder on a master card, you need an encoder with 1/4 cycle per detent. Else, you may be able to connect to their encoder card instead of the mastercard. I assume that you have tried changing the acceleration values.

    Regards

    David

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

    Hi Morten

    Sorry without plugging your code into my system I don't know what's wrong with it. I do know that in a real 737 EFIS box, the QNH and MINIMUMS are not done with rotary encoders.

    They are a self-centering spring loaded switch which you turn left to decrement and right to increment. There are also two stages, if you turn it harder in either direction, it goes up/down in 10's rather than single units, and if you hold it for a while it goes faster.

    I know you won't want to modify your hardware, but directly in the FSUIPC module within FS you can assign switches to inc/dec the EFIS values. Niko has an example on his site of using SIOC to mimic joystick buttons to do this and it works well.

    You could do something more sophisticated in SIOC using timers to replicate the working of the real unit.

  6. #6
    500+ This must be a daytime job



    Join Date
    Jul 2013
    Posts
    917
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Morten

    Your SIOC code fragment for the Rotate function seems ok to me. This suggests that your problem lies either in the remainder of your code, or the hardware. You mention that your MCP is working ok, does this have the same encoders?, if so, then perhaps the problem lies within the SIOC code downstream somewhere?

    Regards

    David

  7. #7
    25+ Posting Member Oter3's Avatar
    Join Date
    Mar 2007
    Location
    Norway
    Posts
    31
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Qnh setting in PMagenta Efis

    This code was publised by Opencockpits in 2008,
    it works in my P.Magneta an OC hardware.
    (text is simplified)
    ///Var xx, name E_BARO, Link IOCARD_ENCODER, Input xx, Aceleration 1, Type 2, Device x
    L0 = &E_BARO * -1
    &SUB_BAR = &SUB_BAR + L0
    Var xx, name SUB_BAR, link SUBRUTINE
    L0 = &SUB_BAR * 16
    &FS_QNH = L0
    FS_QNH, Link FSUIPC_OUT, Offset $0330, Length 2 // FS_QNH_MB
    FS2_QNH, Link FSUIPC_OUT, Offset $552E, Length 2 // FS_QNH_MB FO////
    Regards
    Nils

  8. #8
    75+ Posting Member MortenHa's Avatar
    Join Date
    Apr 2007
    Location
    Norway, Vardø
    Posts
    77
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Hi David and Nils !

    David:
    I have attached the code, if you have time, take a look at it

    Nils:
    Hmmm! The code seems to do exactly the same as my code. I don't know if SIOC handles complex expressions like: A = (D or C) and (A and B). Perhaps you're forced to compute simple expressions in several lines of code to make it work...
    Attached Files Attached Files

  9. #9
    500+ This must be a daytime job



    Join Date
    Jul 2013
    Posts
    917
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Morten

    As I asked earlier, do you know that the encoders are being read correctly by SIOC? Do you have the same encoders on your MCP and do they work correctly?

    Regards

    David

  10. #10
    75+ Posting Member MortenHa's Avatar
    Join Date
    Apr 2007
    Location
    Norway, Vardø
    Posts
    77
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Sorry for the delay David!

    Yes they are the same, and they work perfectly on the MCP!

    I haven't tried the code Nils posted yet, been awfully busy!

    But will report back soon!

Page 1 of 2 12 LastLast

Similar Threads

  1. EFIS script project magenta
    By Wim Nenegerman in forum PM Boing MCP
    Replies: 1
    Last Post: 10-08-2010, 10:46 AM
  2. Any good sioc script ?
    By 737NGPilot in forum PM Boeing FMC/CDU
    Replies: 2
    Last Post: 07-15-2010, 06:50 AM
  3. SimAcionics EFIS script
    By markusr in forum OpenCockpits General Discussion
    Replies: 0
    Last Post: 01-19-2010, 04:17 PM
  4. PM MCP SIOC Script
    By MortenHa in forum OpenCockpits General Discussion
    Replies: 9
    Last Post: 02-18-2009, 12:18 PM