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 (exactly the same code but to COM3/4), 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;
fbModbus : MODBUS_EXTENDED_MASTER_RTU;
fbError : enumMB_ERROR;
stQuery : typModbusExtendedQuery;
stResponse : typModbusResponse;
au16Data : ARRAY[0..14] OF WORD;
i : INT;
tPoll : TON;
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;

