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