Page 5 of 9 FirstFirst 123456789 LastLast
Results 41 to 50 of 90
  1. #41
    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: SIOC "IF" Question

    Hi,
    Jim is right, boolean algebra rules dictates that, read more about that here:
    http://en.wikipedia.org/wiki/Introdu...oolean_algebra
    Nico
    Last edited by kiek; 08-22-2010 at 01:30 PM.

  2. #42
    500+ This must be a daytime job Boeing 747 Flyer's Avatar
    Join Date
    Nov 2009
    Location
    England
    Posts
    635
    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 "IF" Question

    Hi Jim,

    Is it possible to have a SIOC IF statement without an ELSE statement? This is because, earlier in the script, I have said ELSE &REF=0. So, is there reall a need to repeat the ELSE statement? It just causes unwatned difficulties.

  3. #43
    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: SIOC "IF" Question

    Quote Originally Posted by Boeing 747 Flyer View Post
    Is it possible to have a SIOC IF statement without an ELSE statement?
    Yes, of course. The ELSE part is optional (like in most programming languages).
    Just write
    Code:
    IF condition
    {
      statement
    }
    Nico

  4. #44
    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 "IF" Question

    ________________________________

  5. #45
    500+ This must be a daytime job Boeing 747 Flyer's Avatar
    Join Date
    Nov 2009
    Location
    England
    Posts
    635
    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 "IF" Question

    Hiya Jim,

    Thanks for that post. I have made an amendment to mr original script, look below:

    Code:
    Var 7675, name REF, Link IOCARD_OUT, Output 4 // REF LED
    Var 7002, name OP, Link IOCARD_OUT, Output 5 // OP LED
    Var 9991, name OPSW, Link IOCARD_SW, Input 29, Type I // OP SW
    Var 8881, name REFSW, Link IOCARD_SW, Input 28, Type I // REF SW
    Var 9090, name Chain5, Link IOCARD_SW, Input 20 // Chain 5 Selector
    Var 7890, name Chain4, Link IOCARD_SW, Input 26 // Chain 4 Selector
    Var 7665, name Chain3, Link IOCARD_SW, Input 25 // Chain 3 Selector
    Var 7605, name Chain2, Link IOCARD_SW, Input 24 // Chain 2 Selector
    Var 7645, name Chain1, Link IOCARD_SW, Input 23 // Chain 1 Selector
    Var 9888, Link FSUIPC_IN, Offset $C28D, Length 1 // Cloud Precipitation Rate (1)
    {
    C0 = V9991 = 1
      C1 = V8881 = 1
        IF C0 OR C1
     {
      L0 = V9888 // FSUIPC L0 = v9888  
      IF L0 <= 3    // First sector
      {
    IF L0 > 0
    {
       IF &Chain1 = 1
       {
        &REF = 1
       }
        IF L0 > 3
        {
      &REF = 0 OR 1
       &BlinkLed = 500000
       &BlinkLed = TIMER 0 -1 40
      ELSE
         {
        &REF = 0
         }
        }
      }
     }
    }
    
    Var 9077, name BlinkLed
    {
       L0 = MOD &BlinkLed 2
       IF L0 = 0
       {
         &REF = 0
       }
       ELSE
       {
         &REF = 0 OR 1
       }
    }
    }
    I want this code to achieve the following:

    - LED ONLY Lights if Precipitation is 1-3

    - LED ONLY Blinks if Precipitation is MORE than 3

    - LED stops blinking if turbulence drops below three

    - LED is OFF if there is no Turbulence (=0)

    Does my script achieve this? I think yes to all of them, with the exception of the second to last requirement (stop code).

  6. #46
    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: SIOC "IF" Question

    Jack,
    Just a tip to help you:
    Make sure you indent each line properly. Your scripts are very hard to read because you do not adhere to normal programming practices.
    Use a fixed number of spaces to indent each block, do not use tabs. Normally one uses 2 or 4 spaces to indent a block, like this:

    Code:
    IF condition
    {
      IF condition  // two spaces at the beginning of this line, because this is the first block
      {
         statement   // 4 spaces at the beginning of this line because this is a block within a block
      }
      ELSE
      {
         statement
      }
    }
    rgrds,
    Nico

  7. #47
    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 "IF" Question

    ___________________________

  8. #48
    500+ This must be a daytime job Boeing 747 Flyer's Avatar
    Join Date
    Nov 2009
    Location
    England
    Posts
    635
    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 "IF" Question

    Hi Nico,

    Yes you are correct, I have made a few tweaks to my script and have noticed that the brackets were messy.

    In other news...

    I have tried the following SIOC script, and absolutely nothing happens in IOCPConsole Log, whatever the Turbulence is set to. Any ideas?

    Code:
    Var 7675, name REF, Link IOCARD_OUT, Output 4 // REF LED
    Var 9888, Link FSUIPC_IN, Offset $C28D, Length 1 // Cloud Precipitation Rate (1)
    {
      L0 = V9888 // FSUIPC L0 = v9888  
      IF L0 <= 3    // First sector
     {
    IF L0 > 0
      {
        &REF = 1
      }
        IF L0 > 3
       {
      &REF = 0
       &BlinkLed = 500000
       &BlinkLed = TIMER 0 -1 40
      ELSE
        {
        &REF = 0
        }
       }
     }
    }
    
    Var 9077, name BlinkLed
    {
       L0 = MOD &BlinkLed 2
       IF L0 = 0
       {
         &REF = 0
       }
       ELSE
       {
         &REF = 0
       }
    }
    EDIT: Jim, the script compiles fine here. Also, please note the one included in THIS post is the latest version, not post #45. I will still do as you ask though, it will probably help.

  9. #49
    500+ This must be a daytime job Boeing 747 Flyer's Avatar
    Join Date
    Nov 2009
    Location
    England
    Posts
    635
    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 "IF" Question

    Hi Jim,

    It may not be correct, but at least I've had a go.

    I've produced those three different scripts you asked for, here:

    Code:
    Var 9888, Link FSUIPC_IN, Offset $C28D, Length 1 // Cloud Precipitation Rate (1)
    Var 222
     {
      IF v9888 >= 3
      { 
    &REF = 0
       &BlinkLed = 500000 // Begin value of timer
       &BlinkLed = TIMER 0 -1 40
      }
     }
    
    Var 333 name BlinkLed
        {
       L0 = MOD &BlinkLed 2
       IF L0 = 0
         {
         &REF = 0
         }
       ELSE
          {
         &REF = 1
          }
        }
    
    Var 13 name REF Link IOCARD_OUT Output 93
    
    //
    
    Var 9888, Link FSUIPC_IN, Offset $C28D, Length 1 // Cloud Precipitation Rate (1)
    Var 222
     {
      IF v9888 <= 3
      { 
    &REF = 1
       {
       &BlinkLed = 1 // equal to end value of timer (0) + 1
       }
      }
     }
    
    Var 13 name REF Link IOCARD_OUT Output 93
    
    //
    
    Var 222
     {
      IF v9888 = 0
      { 
    &REF = 0
       }
     }

  10. #50
    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 "IF" Question

    ____________________________

Similar Threads

  1. "Inner Circle" HSI - SIOC DC Motors Card Script
    By Boeing 747 Flyer in forum OpenCockpits General Discussion
    Replies: 64
    Last Post: 04-21-2011, 10:59 AM
  2. Replies: 17
    Last Post: 03-05-2008, 12:39 PM
  3. A question for "Bus Drivers"
    By mpl330 in forum General Builder Questions All Aircraft Types
    Replies: 2
    Last Post: 01-31-2008, 06:56 PM
  4. PM updates and a question for "proof of concept"
    By pap in forum PM General Q & A
    Replies: 4
    Last Post: 01-27-2008, 06:22 AM