Hi,
Jim is right, boolean algebra rules dictates that, read more about that here:
http://en.wikipedia.org/wiki/Introdu...oolean_algebra
Nico
Printable View
Hi,
Jim is right, boolean algebra rules dictates that, read more about that here:
http://en.wikipedia.org/wiki/Introdu...oolean_algebra
Nico
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.
________________________________
Hiya Jim,
Thanks for that post. I have made an amendment to mr original script, look below:
I want this code to achieve the following: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
}
}
}
- 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).
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:
rgrds,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
}
}
Nico
___________________________
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?
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.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
}
}
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
}
}
____________________________