SysLibCom and RS485 on WAGO PFC200

  • mikkelaunsbjerg

    mikkelaunsbjerg - 2018-03-15


    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:

       sComSettings: COMSETTINGS;
       ePort : PORTS := COM0;
       bIsConfigured: BOOL := FALSE;
       bIsOpen: BOOL := FALSE;
       dwHandle: DWORD;
       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.


  • maniek765

    maniek765 - 2018-04-03

    Are you sure that it's COM0 not COM1?

  • Anonymous - 2018-04-03

    Originally created by: scott_cunningham

    It is typically a hardware setup, not on the coding side. On some controllers, it is a BIOS setting. Perhaps it is a configuration selection however you setup the hardware (WAGO specific).

  • mikkelaunsbjerg

    mikkelaunsbjerg - 2018-05-09

    Thanks for the inputs. With the help of WAGO support, I found the solution which I'm posting here for future reference.

    When using the RS232/RS485 port on the PFC200 module, make sure to:

    What tripped me, was using the "wrong" library, not that it was documented anywhere that I could find.



Log in to post a comment.