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:
PROGRAMPT100_PRGVAR
  sComSettings: COMSETTINGS;
  ePort : PORTS :=COM0;
  bIsConfigured: BOOL :=FALSE;
  bIsOpen: BOOL :=FALSE;
  dwHandle: DWORD;
  dwErrorCount : DWORD :=0;END_VARVARCONSTANT
  bAddress : BYTE :=0;
  dwErrorHandle : DWORD :=16#FFFFFFFF;END_VAR(*implementationstartshere*)IFbIsOpen=FALSETHEN
  bIsConfigured :=FALSE;
  dwHandle :=SysComOpen(ePort);
  IFdwHandle<>dwErrorHandleTHEN
    bIsOpen :=TRUE;
  END_IFEND_IFIFbIsOpen=TRUEANDbIsConfigured=FALSETHEN
  sComSettings.byParity :=0;
  sComSettings.byStopBits :=0;
  sComSettings.dwBaudRate :=38400;
  sComSettings.dwTimeout :=0;
  sComSettings.dwBufferSize :=0;
  sComSettings.dwScan :=0;
  IFSysComSetSettings(dwHandle, ADR(sComSettings))=TRUETHEN
    bIsConfigured :=TRUE;
  END_IFEND_IF(* ... andsomewritelogichere*)
Thanks in advance.
/Mikkel
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Greetings.
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:
Thanks in advance.
/Mikkel
Are you sure that it's COM0 not COM1?
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).
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.
/Mikkel