MarkoSiroki
Member level 2
Hi to all!
I ma working on PLC program (using CyPro's Structure Text Language) that will drive light on/off via DALI protocol compatible wall switch. Now, I have a chunk of code:
The problem is, regardless of number of this if checks, only the last one is taken into account, i.e. executed, so only the one (last) of four switches is "alive". Why are other if clauses ignored?
Sincerely,
Marko
I ma working on PLC program (using CyPro's Structure Text Language) that will drive light on/off via DALI protocol compatible wall switch. Now, I have a chunk of code:
Code:
// *****************************************
// * Light operation according to statuses *
// *****************************************
if state_light_on[COMP_RED] then
turn_light_on(COMP_RED);
else
turn_light_off(COMP_RED);
end_if;
if state_light_on[COMP_GREEN] then
turn_light_on(COMP_GREEN);
else
turn_light_off(COMP_GREEN);
end_if;
if state_light_on[COMP_BLUE] then
turn_light_on(COMP_BLUE);
else
turn_light_off(COMP_BLUE);
end_if;
if state_light_on[COMP_ALL] then
turn_light_on(COMP_ALL);
else
turn_light_off(COMP_ALL);
end_if;
Sincerely,
Marko