Hi, Would really appreciate your insights in this issue I have.
I am currently using a WAGO 750-881 with multiple IO devices. For one of them I already occupied the MODBUS Master configuration tool so I cannot overwrite it for my other devices.
I have a total of two serial interfaces WAGO 750-652.
The first one is instantiated in COM2 and doesn't need any protocol since the information comes in an specific formatting that need little code to differentiate between needed info. This one is working just fine.
The second one is where I have an issue. I have tried to instantiate the port using MODBUS library modb_L05.lib to properly receive the data from an ARDUINO and I am absolutely unable to open the port: Signal DEVICE2.fbModbus.MODBUS_EXT_MASTER.Interface.Com_Port_Ist_Offen is never TRUE, among with all other signals from that interface, while signal DEVICE1.COM2.Com_Port_Ist_Offen is TRUE, and the other signals also read as TRUE or FALSE.
I have tried instantiating the second one as the first one, changing COM3 to COM4, I've tried a lot of things but it wont ever open the channel. I don't know if you have any recommendations for me.
For both physical modules, both witness LEDs A and E are on.
First one is instantiated like this:
PROGRAM DEVICE1
VAR
wBaudRate : WORD := BAUD_9600;
bDataBits : BYTE := 8;
bParity : BYTE := 0;
bFlowControl : BYTE := 3; (RS422 FullDuplex with continous send)
i : INT;
COM2 : SERIAL_INTERFACE;
xOpenPort2 : BOOL := TRUE; ( Flag to open the Port )
xInitPort2 : BOOL; ( Flag to initiallize the Port )
ReceiveBuffer2 : typRing_Buffer;
END_VAR
Second one like this:
PROGRAM DEVICE2
VAR
COM4 : SERIAL_INTERFACE;
xInitPort4 : BOOL := TRUE;
xOpenPort4 : BOOL := TRUE;
ReceiveBuffer4 : typRing_Buffer;
Hi β good description of the problem. A few suggestions / questions that might help narrow this down:
Since your first serial port (COM2) works fine but the second (COM4 + MODBUS_EXT_MASTER) never opens, check whether the two ports are truly independent β some WAGO modules share internal resources, so COM4 might conflict with other functions or modules.
Make sure that the physical wiring and module configuration for the second port (baud rate, flow control, RS-485 vs RS-422, etc.) exactly match what the library expects β a mismatch in flow control or wiring could prevent port opening even if the LED signals seem OK.
Try using a plain SERIAL_INTERFACE on COM4 first (like you did for COM2) without Modbus logic β if that opens, you know the hardware + port config is fine, so the issue is more likely with modb_L05.lib.
If the port opens but Modbus still fails, enable debug/logging (if available) to inspect whether the port opening fails or the subsequent Modbus negotiation fails.
If you like β I can share a minimal example project I used with WAGO + COM4 + Modbus that worked; you could adapt that to test your setup. Wacky Flip
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi, Would really appreciate your insights in this issue I have.
I am currently using a WAGO 750-881 with multiple IO devices. For one of them I already occupied the MODBUS Master configuration tool so I cannot overwrite it for my other devices.
I have a total of two serial interfaces WAGO 750-652.
The first one is instantiated in COM2 and doesn't need any protocol since the information comes in an specific formatting that need little code to differentiate between needed info. This one is working just fine.
The second one is where I have an issue. I have tried to instantiate the port using MODBUS library modb_L05.lib to properly receive the data from an ARDUINO and I am absolutely unable to open the port: Signal DEVICE2.fbModbus.MODBUS_EXT_MASTER.Interface.Com_Port_Ist_Offen is never TRUE, among with all other signals from that interface, while signal DEVICE1.COM2.Com_Port_Ist_Offen is TRUE, and the other signals also read as TRUE or FALSE.
I have tried instantiating the second one as the first one, changing COM3 to COM4, I've tried a lot of things but it wont ever open the channel. I don't know if you have any recommendations for me.
For both physical modules, both witness LEDs A and E are on.
First one is instantiated like this:
PROGRAM DEVICE1
VAR
wBaudRate : WORD := BAUD_9600;
bDataBits : BYTE := 8;
bParity : BYTE := 0;
bFlowControl : BYTE := 3; (RS422 FullDuplex with continous send)
i : INT;
COM2 : SERIAL_INTERFACE;
xOpenPort2 : BOOL := TRUE; ( Flag to open the Port )
xInitPort2 : BOOL; ( Flag to initiallize the Port )
ReceiveBuffer2 : typRing_Buffer;
END_VAR
COM2( bCOM_PORT_NR := 2,
cbBAUDRATE := wBaudRate,
cbsBYTESIZE := bDataBits,
cpPARITY := bParity,
csSTOPBITS := STOPBITS_1,
cfFLOW_CONTROL := bFlowControl,
utRECEIVE_BUFFER := ReceiveBuffer2,
ptSEND_BUFFER := ADR(SendString2),
xINIT := xInitPort2,
xOPEN_COM_PORT := xOpenPort2,
iBYTES_TO_SEND := LEN(SendString2)+1,
xSTART_SEND := xSendActive2 );
Second one like this:
PROGRAM DEVICE2
VAR
COM4 : SERIAL_INTERFACE;
xInitPort4 : BOOL := TRUE;
xOpenPort4 : BOOL := TRUE;
ReceiveBuffer4 : typRing_Buffer;
END_VAR
COM4(
bCOM_PORT_NR := 4,
cbBAUDRATE := BAUD_9600,
cbsBYTESIZE := 8,
cpPARITY := 0,
csSTOPBITS := STOPBITS_1,
cfFLOW_CONTROL := 2, ( RS-485 half-duplex )
utRECEIVE_BUFFER := ReceiveBuffer4,
xINIT := xInitPort4,
xOPEN_COM_PORT := xOpenPort4,
xSTART_SEND := xSendActive4,
);
stQuery.SlaveAddress := 1;
stQuery.FunctionCode := 3;
stQuery.Read_StartAddress := 0;
stQuery.Read_Quantity := 15;
(Poll code)
fbModbus(
ENABLE := TRUE,
bCOM_PORT := 4, ( COM4=> 750-652 port )
cbCOM_BAUDRATE := BAUD_9600,
cpCOM_PARITY := 0,
csCOM_STOPBITS := 1,
cbsCOM_BYTESIZE := 8,
cfCOM_FLOW_CONTROL := 2,
TimeOut := T#500ms,
StartFunction := xStart,
ExtQuery := stQuery,
Response := stResponse,
MB_Error => fbError
);
FOR i := 0 TO 14 DO au16Data[i] := stResponse.Data[i]; END_FOR;
Hi β good description of the problem. A few suggestions / questions that might help narrow this down:
If you like β I can share a minimal example project I used with WAGO + COM4 + Modbus that worked; you could adapt that to test your setup. Wacky Flip