My mistake was using button and variable in same place. Button is impulse signal 1 then 0, variable is constant. So only thing to do was intermediate variable. So I made a trigger. I’m using 1 modbus address per 1 light.
I’ve changed variables names since first time, here is a code:
TRG1A:=(EXTOUT_1A_R1 AND NOT OUT_1A_R1) OR (OUT_1A_R1 AND NOT EXTOUT_1A_R1);
LIGHT1A(xSwitch:=INP1A OR TRG1A, xCentOFF:=masterOFF, xCentOn:=masterON); OUT_1A_R1:=LIGHT1A.xActuator; EXTOUT_1A_R1:=OUT_1A_R1;
VAR
LIGHT1A: Fb_LatchingRelay;
TRG1A: BOOL;
Global variables:
EXTOUT_1A_R1 AT %MX0.0:BOOL; (*Modbusadresse 12288*)
i’m using Building_common.lib btw in Codesys.