Results 1 to 5 of 5
  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 Audio Panel Code

    Hello,

    I have run in a sioc Coding problem and am looking for suggestions to try. I would like to set up the SIOC code so that when both Com1 & Com2 are pushed , Both radios can be heard (sounds simply??).

    The trouble is the audio panel is from a real aircraft, and both com1 and com2 are latching type switches (P type).


    The offset for these are $3122, with bytes 7, 6, & 5 involved.
    COM1 transmit Byte 7
    COM2 transmit Byte 6
    COM receive both Byte 5

    Is there a statement in SIOC that allows "If" switch A is pressed "and" switch b is press that Offset $ 3122 with be switch to byte 5?


    ~Polmer

  2. #2
    75+ Posting Member
    Join Date
    Apr 2009
    Location
    Toronto
    Posts
    125
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: SIOC Audio Panel Code

    Hello Polmer.

    You could construct a single IF test:
    Code:
    .
    .
    C0 = &SwitchA = 1
    C1 = &SwitchB = 1
    C0 = C0 AND C1
    IF C0 = 1
       { 
          ....set bit 5
       }
    .
    .
    A nested IF seems less laboured, though:

    Code:
    .
    .
    IF &SwitchA = 1
        {
          IF &SwitchB = 1
              {
                 set bit 5
              }
         }
    .
    .
    I think you should define your switches as Type I.

    Jim

  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

    Re: SIOC Audio Panel Code

    Yes you are correct,

    the switches are type I, not type "P".

    I tried both variation of the code but cant get both Com1 & Com2 to be on at the same time. Heres what I am running now with no luck....

    HTML Code:
    Var 1042, Link FSUIPC_IN, Offset $3122, Length 1     // Radio Audio Bytes
    
    Var 1034, Link FSUIPC_OUT, Offset $3122, Length 1     // Radio Audio Bytes
    
    Var 1035, Link IOCARD_SW, Input 111, Type I     // COM1 Audio
    {
      V1034 = CHANGEBIT 7 ,V1035     // COM1 vs COM2 
    }
    
    Var 1036, Link IOCARD_SW, Input 109, Type I     // COM2 Audio
    {
      V1034 = CHANGEBIT 6 ,V1036
    }
    
    Var 1038, Link IOCARD_SW, Input 108, Type I     // NAV1 Audio
    {
      V1034 = CHANGEBIT 4 ,V1038
    }
    
    Var 1039, Link IOCARD_SW, Input 115, Type I     // NAV2 Audio
    {
      V1034 = CHANGEBIT 3 ,V1039
    }
    
    Var 1040, Link IOCARD_SW, Input 116, Type I     // MKR Audio
    {
      V1034 = CHANGEBIT 2 ,V1040
    }
    
    Var 1041, Link IOCARD_SW, Input 110, Type I     // ADF Audio
    {
      V1034 = CHANGEBIT 0 ,V1041
    }
    
    Var 1043, Link IOCARD_SW, Input 108, Type I
    {
      &FO_JoyStick64 = CHANGEBIT 3 ,V1043     // toggle bit 0 of joystick 64
    }
    
    Var 1044, name FO_JoyStick64, Link FSUIPC_OUT, Offset $3340, Length 4
    
    Var 1046
    {
      IF V1035 = 1
      {
        IF V1036 = 1
        {
          V1047 = 1    
        }
      }
    }
    
    Var 1047
    {
      V1034 = CLEARBIT 7
      V1034 = CLEARBIT 6
      V1034 = CHANGEBIT 5 ,V1047
    }

  4. #4
    75+ Posting Member
    Join Date
    Apr 2009
    Location
    Toronto
    Posts
    125
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: SIOC Audio Panel Code

    Hello Polmer,

    The script attached to V1046 is never executed as the variable is never changed. Consequently, V1047 never changes.

    You can set the "receive both" flag without using an explicit "IF"

    Code:
    Var 1034, Link FSUIPC_OUT, Offset $3122, Length 1 // Radio Audio Bits
    
    Var 1035, Link IOCARD_SW, Input 111, Type I // COM1 Audio
    {
    V1034 = CHANGEBIT 7 ,V1035 // COM1 vs COM2
    CALL V1046
    }
    
    Var 1036, Link IOCARD_SW, Input 109, Type I // COM2 Audio
    {
    V1034 = CHANGEBIT 6 ,V1036
    CALL V1046
    }
    
    Var 1046   Link SUBRUTINE
    {
    //* Set "receive both" if both switches pressed
    //* Else, clear the flag
                L0  = V1035 AND V1036       // L0 = 1 iff  COM1 and COM2 are both on
                V1034 = CHANGEBIT 5, L0      
    }
    What do you want to happen to the transmit flags (bits 6 and 7) when both buttons are pressed? Switching them both off doesn't seem correct.

    Jim

  5. Thanks mickc, Polmer thanked for this post
  6. #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

    Re: SIOC Audio Panel Code

    Jim,

    It works like a charm with your code!
    Thanks for the help with this.....much apreciated.

    ~Polmer