Results 1 to 4 of 4
  1. #1
    New Member
    Join Date
    Mar 2008
    Location
    Volos, Greece
    Posts
    2
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Post COM1, replace TFR switch with an on-ff switch and IF....THEN code

    Trying to programm with SIOC, a home made VHF Radio COMM 1, using a TFR switch for selecting between the active and the stanb by freq.
    I'm using Opencockpits hardware.

    My panel has:
    a freq tfr toggle type switcha five 7-segment display for the left frequency software controlled Freq Decimal Point via an Output
    a five 7-segment display for the right frequency software controlled Freq Decimal Point via an Output
    two leds for active frequency indication
    two rotary encoders (one encoder for changing the two digits before Decimal Point, and one for two digits after the Decimal points)


    My problem is tha my tfr toggle switch is not actually that.
    Is an on-off (1,0) switch, and now I don't have another output for changing the on-off switch with an on-off-on one.


    Since, while Var 510 has the value 1, Var 511 has the value 0 and via versa,
    I was wondering if is it possible to by-pass this problem usign an IF...THEN code in SIOC ..
    The concept is that

    IF Var 510 = 1, then 511 = 0
    ELSE 511 = 1
    END IF
    Is this worth trying or it would be a waste of time?

  2. #2
    2000+ Poster - Never Leaves the Sim kiek's Avatar
    Join Date
    Jan 2007
    Location
    Netherlands
    Posts
    2,202
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: COM1, replace TFR switch with an on-ff switch and IF....THEN code

    Yes you can do that like this:
    Code:
    Var 9001 name TFR Link IOCARD_SW Device x Input y Type I     // fill in your device and input     
    {
      IF &TFR  = 1
      {
        v510 = 1
        v511 = 0
      }
      ELSE
      {
        v510 = 0
        v511 = 1
      }
    }
    
    
    Var 510 Static     
    Var 511 Static
    regards,
    Nico

  3. #3
    New Member
    Join Date
    Mar 2008
    Location
    Volos, Greece
    Posts
    2
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: COM1, replace TFR switch with an on-ff switch and IF....THEN code

    Thanks a lot for your quick and very usefull answer....
    Writing the code for me, surely saved me a lot of time...
    The trick was to introduce a new var (TFR), which propably would have take me a lot of time to think of.

    I would also like to thank you one more time for your superb programme...

    Kostas Christodoulou

  4. #4
    2000+ Poster - Never Leaves the Sim kiek's Avatar
    Join Date
    Jan 2007
    Location
    Netherlands
    Posts
    2,202
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: COM1, replace TFR switch with an on-ff switch and IF....THEN code

    Quote Originally Posted by kchristo View Post
    I would also like to thank you one more time for your superb programme...
    Thank you! I'm glad you like it.
    Spread the news...

    regards,
    Nico