Page 2 of 2 FirstFirst 12
Results 11 to 19 of 19
  1. #11
    75+ Posting Member nricky's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    86
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Nico's Kaan NAV1 & Course example

    Hi Samsail

    Tanks for the code, it suizid be done with a single encoder. But at the moment my time is very limited.

    Writing sioc is not that hard. I always said to myself i can't learn it. I spend lots of money on other elektronics because sioc is so hard. Than one week I said now you have to learn how. Took lots of examples made Lots of mistakes, but now i am ok with it. And there are lots of people out there that will help you have problems.

    Don't give up have lots of fun here.

    Cheers Norbert

  2. #12
    500+ This must be a daytime job kiek's Avatar
    Join Date
    Jan 2007
    Location
    Netherlands
    Posts
    698
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Nico's Kaan NAV1 & Course example

    Quote Originally Posted by nricky View Post
    Maybe you can help me on my ADF
    That's already available at my website: SIOC code for ADF

    regards,
    Nico

  3. #13
    75+ Posting Member nricky's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    86
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Nico's Kaan NAV1 & Course example

    Hi Nico

    Will have a look at it later. Thanks

    Cheers Norbert

  4. #14
    Our new friend needs to reach 10 posts to get to the next flight level
    Join Date
    Aug 2010
    Location
    Greece
    Posts
    5
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Nico's Kaan NAV1 & Course example

    Hi,
    Here is my progress in SIOC code.

    In the attached file “Radio NAV1 NAV2”
    I wrote a script to control NAV1 And NAV2 Radio freq. using a single rotary encoder with push button for Hi and Low frequencies, plus two more push buttons, one to select NAV1 or NAV2 and one to Swap form standby mode to active mode.

    I thank you Nico for your examples, these are a great help for me.

    In the attached file “ Nico’s ADF1” I have try to modify your script for the ADF1 in case to use one rotary encoder with push a button, but it is not work.

    Can you please Nico check this file for my mistakes?
    I thank you in advance,
    Yiannis
    Attached Files Attached Files

  5. #15
    500+ This must be a daytime job kiek's Avatar
    Join Date
    Jan 2007
    Location
    Netherlands
    Posts
    698
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Nico's Kaan NAV1 & Course example

    Here a version in which I've corrected your mistakes ... Also check the input number of your PushButton
    Nico
    Code:
    Var 8700 name X_ADF1High Link FSUIPC_INOUT Offset $034C Length 2
    {
      L0 = FROMBCD &X_ADF1High
      IF &ADF1High <> L0           // block values coming from rotary
      {
        &ADF1High = L0 
        &ADF1HighR = DIV &ADF1High 10
        CALL &CalcADF1LowR
        CALL &CalcADF1Freq 
      }
    }
    Var 8701 name X_ADF1Low Link FSUIPC_INOUT Offset $0356 Length 2 
    {
      IF &X_ADF1Low <> &ADF1Low    // block values coming from rotary
      {
        &ADF1Low = &X_ADF1Low
        CALL &CalcADF1LowR
        CALL &CalcADF1Freq 
      }
    }
    Var 8710 name ADF1High         // FSUIPC ADF value high: 3 digits
    Var 8711 name ADF1Low          // FSUIPC ADF value: 1 digit
    var 8712 name ADF1Freq         // total (needed for display): 4 digits
    var 8713 name CalcADF1Freq Link Subrutine
    {
      L0 = &ADF1High * 10          // high * 10
      &ADF1Freq = L0 + &ADF1Low    // + decimal
      CALL &OutADF1
    }
    Var 8720 name OutADF1 Link SUBRUTINE    
    {
       &D_ADF1 = &ADF1Freq     
       &O_ADF1DP = 1 
    }
    Var 8730 name ADF1HighR        // higher TWO digits controlled by rotarie
    Var 8731 name ADF1LowR         // lower TWO digits controlled by rotarie
    var 8732 name CalcADF1LowR Link Subrutine  
    {
      L0 = MOD &ADF1High 10
      L0 = L0 * 10
      &ADF1LowR = L0 + &ADF1Low
    }
    var 8733 name CalcADF1High Link Subrutine
    {
      L0 = DIV &ADF1LowR 10
      L1 = &ADF1HighR * 10
      &ADF1High = L0 + L1
    }
    
    Var 8740 name PushButton link IOCARD_SW input 1 type P
    
    Var 8744 name RO_ADF1 Link IOCARD_ENCODER Input 5 Aceleration 4 Type 2     
    { 
      L0 = &RO_ADF1 * -1          // change direction
      IF &PushButton = 1
      {
        &ADF1HighR = ROTATE 20 99 L0 
        CALL &CalcADF1High
        CALL &CalcADF1Freq            
        &X_ADF1High = TOBCD &ADF1High   // higher 3 Digits in bcd to fsuipc 
      }
      ELSE
      { 
        L0 = L0 * 5  // in steps of 5 
        &ADF1LowR = ROTATE 0 99 L0    
        &ADF1Low = MOD &ADF1LowR 10
        CALL &CalcADF1High
        CALL &CalcADF1Freq            
        &X_ADF1Low = &ADF1Low           //  decimal digit to fsuipc 
        &X_ADF1High = TOBCD &ADF1High   // higher 3 Digits in bcd to fsuipc 
      }
    }
    
    Var 8770 name D_ADF1 Link IOCARD_DISPLAY Device 1 Digit 16 Numbers 4     
    Var 8780 name O_ADF1DP Link IOCARD_OUT Device 1 Output 95

  6. Thanks samsail thanked for this post
  7. #16
    Our new friend needs to reach 10 posts to get to the next flight level
    Join Date
    Aug 2010
    Location
    Greece
    Posts
    5
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Smile Re: Nico's Kaan NAV1 & Course example

    I can’t find words to thank you for helping me with the Sioc scripts.

    My ADF1 is operated now perfect.

    My best regards
    Yiannis



  8. #17
    500+ This must be a daytime job kiek's Avatar
    Join Date
    Jan 2007
    Location
    Netherlands
    Posts
    698
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Nico's Kaan NAV1 & Course example

    Hi Yiannis,
    It was my pleasure. I hope more people will see how easy and powerful SIOC is.
    Have Fun!
    Nico

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

    Re: Nico's Kaan NAV1 & Course example

    Hello fellow cockpit builders,
    I am new to the hobby ... I just ordered a bunch of parts and I'll be putting together my own OC cards this week... yay! I'm building a LVLD 767 cockpit...
    I have good experience in programming and working with hardware, and I have read the SIOC manuals and the bits of code that I have found online... still I am not following the programming language that well... for instance, the & sign is not talked about in the OC manual (or I in the manual I found) plus... how did you pickup this language? the code that was posted in this thread by Nico seemed simple, but I still couldn't follow... would it be possible if you explain a line by line for some of the more SIOC specific lines... I get the IF/ELSE parts and I'm shaky on the VAR parts, but totally confused on the CALL ...

    By the way, great site Nico!
    Mehdi

  10. #19
    500+ This must be a daytime job kiek's Avatar
    Join Date
    Jan 2007
    Location
    Netherlands
    Posts
    698
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Nico's Kaan NAV1 & Course example

    Hi,

    Welcome on board!

    The & sign is just a syntactical symbol (not an operator). It indicates the compiler that the identifier following is the name of a variable. It was introduced to make parsing of the text by the compiler simple. Of course there are more user friendly ways to work with variable names, but SIOC is a very simple language. Do not compare it with C++ or Java, or languages like that.

    With the CALL command you call a subroutine variable.

    Since you have good experience in programming, it should not be very difficult for you to learn SIOC. Just keep on studying the howto examples at my website and practice by writing small scripts.
    And do note that SIOC is an 'event driven scripting language', not a procedural language with a begin and an end, see this example of flow of control.

    Regards,
    Nico
    Last edited by kiek; 02-03-2011 at 06:39 AM.

Page 2 of 2 FirstFirst 12

Similar Threads

  1. One OC NAV to "copy" it's information NAV1 > NAV2
    By jespergb in forum General Builder Questions All Aircraft Types
    Replies: 1
    Last Post: 03-10-2011, 09:46 AM
  2. Gps/nav1 toggle switch
    By renegade in forum General Microsoft Flight Simulator 10 (FSX)
    Replies: 3
    Last Post: 07-05-2010, 11:51 AM
  3. com1 and nav1 from opencockpit, what does it look like?
    By jespergb in forum OpenCockpits General Discussion
    Replies: 0
    Last Post: 06-01-2010, 04:49 PM
  4. MyCockpit.org Welcome's to Nico Kaan
    By vybhav in forum MyCockpit News and Announcements
    Replies: 3
    Last Post: 04-18-2010, 07:56 PM
  5. Encoders and NAV1 frequency
    By RobertoR in forum FS2Phidget Users
    Replies: 2
    Last Post: 03-03-2005, 07:59 AM