RS485 communication x20 series


i’m trying to connect my x20cp0484 to a third party device for RGB lights ;
the controller for RGB only accepts RS485 commandos

has anybody some startcode to share ? i’ve tried the dvframe library but the external controller doesn’t reacts.

i have the x20bb53 socket in my project.

thanks you all

Hello Sven,

welcome to the Community!

First, DVFrame is the right choice to develop a communcation via a serial interface to a 3rd party device.
To get a serial communication up and running does not only depend on the right settings of the interfaces itself, but depending on the communication partners also in some cases on the protocol implementation itself: some devices may not react even if settings and base code setup are right, as long as the protocol is not as expected by the 3rd party device.

But let’s start at the beginning:
RS485 connection has to be terminated at the first and the last device - X20BB53 has a little switch at the bottom to activate the built-in termination resistor - if it’s activated you can see that the “T” led on the X20BB53 is on.
If the 3rd party device is the last device at the RS485 bus, it has to be terminated, too.

With Automation Studio installation, some samples for libraries are available. For DVFrame, the sample code can be imported directly from the following folder:

Of course this samples have to be adapted to the device and the protocol needs, but it’s a good starting point to dig deeper into DVFrame functions.
What’s implemented in and how the demo code works is described here in Automation Help.

For using the RS485 on BB53 you have to change in the demo code at least the FRM_xopen.mode string to the 3rd party device settings for baudrate (/BD), data bits (/DB), parity (/PA), stopp bits (/SB), and tell the function block that we’re using a RS485 interface (/PHY).

The following screenshot shows a example for X20BB53’s interface (the interface name is IF1 like shown in the hardware tree), and a setup for “RS485 interface using a baudrate of 115.2kBit, 8 data bits and 1 stopp bits, parity none”:

The usage of the parameter string is described here in the Automation Help

After setting the right parameters for the 3rd party device, then you can go on with sending and receiving data.
Of course, this now depends highly on the device / protocol itself, so I can’t provide more tipps/ideas about that without having much deeper knowledge about the device itself.

But I hope the information above helps a little, have a nice weekend!

Hello Alexander,

thank you for the clear explanation!
i will look into it and try to solve my problem

the tip of the end resitor is also nice, it is like CAN bus communication.

regarding the third party device, i only know 9600/8/1/n parameters and the parameter to send

PL1 string for activate
PL0 string for deactivate

with regards and thanks a lot

Hi Sven,

sometimes such devices also expect carriage return and / or line feed at the end of a command, like as they are sent by a terminal program.

When using a IEC language like structured text, such special characters are escaped by ‘$’ character. So maybe you have to send for example ‘PL1$r$n’ to “emulate” that the command was sent from a terminal.

Best regards, Alex

Hello @SvenG

It looks like you got some good answers from Alexander and it has been a couple of weeks since the last activity on this post. If the answers helped you with your question, can you help the next person with the same question by marking the solution on the information which helped you the most. If you still have open questions on this topic, can you provide an update? Thanks!