Hello! I am having trouble establishing serial communication between a WAGO PFC200 (using a 750-653 module) and an EATON PLC. My goal is to read variables from the EATON PLC using the PFC200.
I have tried several different code logic and wiring configurations, but nothing seems to work. Interestingly, CODESYS shows a ‘Communication OK’ status even when no wires are connected to the 750-653 module. This leads me to believe the status bit is not reflecting the actual physical connection. I am unable to read any variables or registers from the EATON device.
I’ve attached my code and wiring. I am looking for the correct configuration and setup to get these two devices talking. If anyone has a working example or a step-by-step guide for connecting a WAGO 750-653 to another device via RS-485, I would greatly appreciate the help in getting this communication established.
CODESYS CODE:
FUNCTION_BLOCK RS485_Master
VAR
FbMbMasterSerial_01 : FbMbMasterSerial;
xConnect : BOOL := TRUE;
utQuery : typMbQuery;
xTrigger : BOOL;
utResponse : typMbResponse;
xError : BOOL;
oStatus : FbResult;
xIsConnected : BOOL;
wDelta : WORD;
T1 : TON;
xMyError : BOOL;
myData : ARRAY [0..124] OF WORD;
END_VAR
// 1. Pregătirea datelor pentru Query (Evităm operații directe complexe în structură)
utQuery.bFunctionCode := 16#17;
utQuery.uiReadAddress := 16#164D;
utQuery.uiReadQuantity := 3;
utQuery.uiWriteAddress := 0;
utQuery.uiWriteQuantity := 0;
utQuery.bUnitId := 1;
utQuery.awWriteData[0] := utQuery.awWriteData[0] + 1;
// 2. Apelul Blocului Funcțional
FbMbMasterSerial_01(
xConnect := xConnect,
I_Port := _750_653_003_000_04, // Asigură-te că acest ID există în I/O Mapping
udiBaudrate := 9600,
usiDataBits := 8,
eParity := eTTYParity.None,
eStopBits := eTTYStopBits.One,
eHandshake := eTTYHandshake.None,
ePhysical := eTTYPhysicalLayer.RS485_HalfDuplex,
xIsConnected => xIsConnected,
xError => xError,
oStatus => oStatus,
eFrameType := eMbFrameType.RTU,
tTimeOut := T#1000MS,
utQuery := utQuery,
xTrigger := xTrigger,
utResponse := utResponse
);
myData := utResponse.awData;
myData[0];
T1(IN := NOT(xTrigger), PT := T#200MS);
IF T1.Q THEN
xTrigger := TRUE;
END_IF
