Results 1 to 1 of 1
  1. #1
    150+ Forum Groupie
    Join Date
    Jan 2007
    Location
    Italy
    Posts
    184
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Post ALT , FLT LDG, Displays and ENC SIOC code

    OPENCOCKPITS SIOC CODE for PMsystems

    Hi guys, after a lot of effort, trial and error i got the Flight Altitude and Landing Altitude Displays and encoder knobs working as i like it!

    The difficult part for me and a nice FEATURE was get the LDG Display recursively blank or light up the single Digits! For example when 0(zero) is selected only one digit must show it all other balnk not multiple zeros, same thing for 50, 100, 1000 and back, only the needed digits works.

    The way OpenCockpits Display cards and Sioc work is to put zeros before the last digit.
    So after a lot of trial got it working try it and let me know what you think.

    Note: I have implemented the routine for Flight Altitude in steps of 500ft instead of PMsystem own logic 1000ft and for the Landing steps of 50ft.
    I did this 'cause i had read those was the correct steps, can someone confirm this? I will modify it if it is wrong.
    I can add also a dimming control if you want it!

    Here is the code 'cause the attachements doesn't work admin?

    Code:
    // SIOC code for:
    // Landing, Flight Altitude Displays and Knobs For PMSystems
    // Vers. 1.0 by Davide Cutugno
    // email: willycutu@hotmail.com
     
    Var 0000, Value 0
    Var 0005, name MLightTest, Link FSUIPC_IN, Offset $560D, Length 1 // Master Light Test
    {
    If V0005 = 1
     {
      V0603 = 8888
     }
    Else
     {
      V0603 = &LandAlt
     }
    }
    Var 0006, name FltAlt, Link FSUIPC_INOUT, Offset $56AC, Length 2 // FltAlt
    {
      V0601 = &FltAlt * 10
    }
    Var 0009, name LandAlt, Link FSUIPC_INOUT, Offset $56AA, Length 2 // LandAlt
    {
      L0 = &LandAlt * 10
      If L0 = 0
       {      
         V0604 = -999999           
         V0605 = L0         
       }
     
       If L0 > 0
       {
       If L0 < 100
         {      
         V0605 = -999999
         V0602 = -999999           
         V0604 = L0         
         }
       }  
      If L0 > 99
        { 
        If L0 < 999
          {      
          V0604 = -999999
          V0603 = -999999 
          V0602 = L0         
          }
        }
      If L0 > 999
       {
         V0602 = -999999 
         V0603 = L0
       }
    }
     
    // Encoder Knobs
    Var 0100, name FLTENC, Link IOCARD_ENCODER, Input 3, Aceleration 2, Type 2 // FLT ALT Enc
    {
     L0 = &FLTENC * 50
     &FltAlt = LIMIT 1000, 4500, L0  
    }
    Var 0110, name LDGENC, Link IOCARD_ENCODER, Input 0, Aceleration 2, Type 2 // LDG ALT Enc
    {
     L0 = &LDGENC * 5
     &LandAlt = LIMIT 0, 900, L0  
    }
     
    // Displays Flight and Landing Altitude
     
    Var 0601, Link IOCARD_DISPLAY, Digit 5, Numbers 5 // D_FLT ALT
    Var 0602, Link IOCARD_DISPLAY, Digit 0, Numbers 3 // D_LDG ALT
    Var 0603, Link IOCARD_DISPLAY, Digit 0, Numbers 4 // D_LDG ALT Digit 4
    Var 0604, Link IOCARD_DISPLAY, Digit 0, Numbers 2 // D_LDG ALT Digit 2
    Var 0605, Link IOCARD_DISPLAY, Digit 0, Numbers 1 // D_LDG ALT Digit 1
    Attached Files Attached Files

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. SIOC code issues - Can someone take a look?
    By XOrionFE in forum I/O Interfacing Hardware and Software
    Replies: 8
    Last Post: 02-04-2009, 07:43 AM
  3. 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
  4. 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
  5. SIOC Code
    By Polmer in forum I/O Interfacing Hardware and Software
    Replies: 6
    Last Post: 12-28-2006, 09:49 AM