WAGO 750-841 programming

Hello

I’m using Building_common.lib from WAGO to manage light, I added global variables for each light, but when I trying to operate light with SymCon it’s only operates with ON switch (for both ON and OFF), if I click OFF nothing happens.
How shall I program my PLC for using SymCon correctly? Here is my program:

PROGRAM PLC_PRG
VAR
	LIGHT1, LIGHT2  : Fb_LatchingRelay;
END_VAR
VAR_GLOBAL
	EXT_LIGHT1  AT %MX0.0:BOOL;	(*Modbus 12288*)
	EXT_LIGHT1MEM AT %MX0.1:BOOL;	(*Modbus 12289*)
	EXT_LIGHT2  AT %MX0.2:BOOL;	(*Modbus 12290*)
	EXT_LIGHT2MEM  AT %MX0.3:BOOL;	(*Modbus 12291*)
END_VAR

LIGHT1(xSwitch:=BT1 OR EXT_LIGHT1); OU1:=LIGHT1.xActuator; EXT_LIGHT1MEM:=OU1; EXT_LIGHT1:=FALSE;
LIGHT2(xSwitch:=BT2 OR EXT_LIGHT2); OU2:=LIGHT2.xActuator; EXT_LIGHT2MEM:=OU2; EXT_LIGHT2:=FALSE;

Add to VAR-Section:
EXT_LIGHT1_FP:BOOL;
EXT_LIGHT1_FN:BOOL;
EXT_LIGHT1_FHM:BOOL;
EXT_LIGHT1_TRIGGER:BOOL;

Code:
EXT_LIGHT1_FP := EXT_LIGHT1 AND NOT EXT_LIGHT1_FHM;
EXT_LIGHT1_FN := EXT_LIGHT1 AND EXT_LIGHT1_FHM;
EXT_LIGHT1_FHM := EXT_LIGHT1;

EXT_LIGHT1_TRIGGER := (EXT_LIGHT1_FP AND NOT OU1) OR (EXT_LIGHT1_FN AND OU1);

LIGHT1(xSwitch:=BT1 OR EXT_LIGHT1_TRIGGER);

OU1:=LIGHT1.xActuator;
EXT_LIGHT1MEM:=OU1;

Hope it work. At the moment i don’t have Codesys available.

Dear Dieter, thank you very much for reply.
It doesn’t work same but little differently, now i can turn On by pushing ON button, but to turn Off, i need to push Off button before On button :slight_smile:

Today I’ve managed Wago code to operate by Symcon correctly:

VAR TRG: BOOL; END_VAR

IF EXT_LIGHT1 AND NOT OU1
THEN TRG:=TRUE;
ELSIF OU1 AND NOT EXT_LIGHT1
THEN TRG:=TRUE;
LIGHT1(xSwitch:=TRG); OU1:=LIGHT1.xActuator; TRG:=FALSE;

Only thing is button operation. Both adding to xSwitch or IF cycle won’t work correctly. I guess I have to make own function block for lighting instead Wago one?

If you want to switch your lights from different places and with different systems, you have the choose the functionality between Toggle-Button and On-Off-Buttons. If you you chose Toggle-Button, you need one Variable from Symcon. You’ll find some Examples in the forum.
If you use On-Off-Buttons, it’s recommended to use 2 Variables. One for On, One for Off.

Have a look a Profiles for Variables, Actionscripts, Dummy-Devices and Links at Symcon.

Good Luck
Dieter

Dear Dieter

Thank you! I’m using Toggle-Buttons. My problem was that button is toggle and signal from SymCon is „switch“, so I made new toggle and now everything works great. Here is reworked buttons code:

TRG1:=(EXT_LIGHT1 AND NOT OU1) OR (OU1 AND NOT EXT_LIGHT1);
LIGHT1(xSwitch:=BT1 OR TRG1); OU1:=LIGHT1.xActuator; EXT_LIGHT1:=OU1;