I have an PFC200 PLC from WAGO (750-8208), which has a RS232 / RS485 port on the front.
I would like to use that port to communicate with an external device using a custom RS485 protocol (i.e. not modbus rtu). I have implemented using the SysLibCom library and tested the protocol code using the simulator. I cannot get the communication to work when connecting the PLC to the device, or even to my laptop via a FTDI RS485 dongle. I suspect that something is not right in the com port setup on the PLC.
Maybe I'm missing something obvious, but I can't see a way to tell SysLibCom that COM0 should be treated as an RS485 port and not a RS232. Can anyone tell me how to do this? Is it even necessary?
My code looks like this:
ePort : PORTS := COM0;
bIsConfigured: BOOL := FALSE;
bIsOpen: BOOL := FALSE;
dwErrorCount : DWORD := 0;
bAddress : BYTE := 0;
dwErrorHandle : DWORD := 16#FFFFFFFF;
(* implementation starts here *)
IF bIsOpen = FALSE THEN
bIsConfigured := FALSE;
dwHandle := SysComOpen(ePort);
IF dwHandle <> dwErrorHandle THEN
bIsOpen := TRUE;
IF bIsOpen = TRUE AND bIsConfigured = FALSE THEN
sComSettings.byParity := 0;
sComSettings.byStopBits := 0;
sComSettings.dwBaudRate := 38400;
sComSettings.dwTimeout := 0;
sComSettings.dwBufferSize := 0;
sComSettings.dwScan := 0;
IF SysComSetSettings(dwHandle, ADR(sComSettings)) = TRUE THEN
bIsConfigured := TRUE;
(* ... and some write logic here *)
Thanks in advance.