Modbus RTU Click PLC Master to BRX PLC Slave Communication

Recently I was asked to demonstrate communication between a Click PLC and BRX PLC using Modbus RTU. Both PLCs are available from automation direct com. Modbus serial communication (Modbus RTU) is a standard protocol used in many automation devices. It works on a Master / Slave configuration. You can have only one master per network on Modbus RTU (Remote Terminal Unit). A maximum of 32 devices (Nodes) on the network can communicate to the master. A review of the Modbus RTU protocol (RTU frames) can be seen at the following URL.
http://www.rtaautomation.com/technologies/modbus-rtu/
Using the Click PLC as a Master we will be communicating to the BRX PLC (Slave). Our example will read 10 registers from the BRX PLC and write 10 registers to the Click PLC. Let’s get started!

Previously in this series we have discussed:
Click PLC System Hardware – Video
Click PLC Installing the SoftwareVideo
Click PLC Establish CommunicationVideo
Click PLC Numbering System and AddressingVideo
Click PLC Timers and Counters
Counter Video
Timer Video
Click PLC Compare and Math InstructionsVideo
Click PLC Program Control InstructionsVideo
Click PLC Shift RegisterVideo
Click PLC Drum InstructionVideo
Click PLC Send and Receive InstructionsVideo
Click PLC AdvancedHMI CommuniationVideo
Create an Analog Voltage Input Tester for a PLCVideo
Wiring Testing Analog PLC Input Click – Video
Modbus RTU Click PLC Master to BRX PLC Slave CommunicationVideo
The programming software and manuals can be downloaded from the Automation Direct website free of charge.

Hardware

Our BRX PLC comes with a built in RS485 port that we will be using for a Modbus RTU slave unit. Here are the specifications for the port.


The Click PLC that we will be using also comes with a RS485 port. We will be using Modbus RTU protocol to communicate to the BRX PLC

Com Port 3 of the Click supports 2-wire RS-485

Wiring

RS485 is a two wire communication. You daisy chain the devices along the path until you get to the end of the chain where a termination resistor is placed between the + and – terminals. The BRX PLC has the ability to add the termination resistor in the software.

Addressing
Modbus addressing for the BRX PLC is located in a separate memory area. BRX PLC is part of the Do-More family of controllers. See the following chart for the Modbus addresses.

Coil/Register Numbers Data Addresses Type BRX (Do-More) PLC Table Name
00001-09999 0000 to 270E Read-Write MC1 to MC1023 Discrete Output Coils
10001-19999 0000 to 270E Read-Only MI1 to MI1023 Discrete Input Contacts
30001-39999 0000 to 270E Read-Only MIR1 to MIR2047 Analog Input Registers
40001-49999 0000 to 270E Read-Write MHR1 to MHR2047 Analog Output Holding Registers

We will be using the send and receive commands in the Click PLC. Ten registers will be read and written according to the chart below.

Controller Modbus Address BRX (Do-More)PLC Click Address Comment
Click Read 40001 – 40010 MHR1 to MHR10 DH1 to DH10 Read 10 registers from the BRX PLC
Click Write 40011 – 40020 MHR11 to MHR20 DH11 to DH20 Write 10 registers to the BRX  PLC

BRX PLC Configuration
The BRX PLC can be programmed using free Do-More Designer software from Automation Direct. Here is a link for the software which includes a simulator.
http://support.automationdirect.com/products/domore.html
The following links will help you to install the software and establish communication.
http://accautomation.ca/brx-plc-installing-the-software/
http://accautomation.ca/brx-plc-establishing-communication/

We will go online with our controller and call up the system configuration window.

Ensure that under the Serial Port Configuration we have Modbus RTU Server (Slave) selected. Also under Port Type we have the RS485 selected and enable the 120 Ohm Termination.
Select the “Change @IntSerial Device Settings..”

We can now set up the parameters for the serial port on the BRX PLC.
Unit ID: 1
Baud Rate: 38400
Data Bits: 8
Stop Bits: 1
Parity: Odd
Note: It is important to have all of these parameters set the same on each side or you will not communicate.
Select OK once these parameters have been set. Select OK again to exit from the system configuration menu.

BRX Ladder Program
Since the BRX PLC is acting as a slave it will not require any ladder programming for the communications to work. We will be putting in a few rungs to demonstrate that communication link.

You will see that MHR11:0 represents bit 0 of the first word that the Click PLC will write to the BRX.
We will also set up a data view window to view our information being transmitted.

The first 10 registers are for writing to the Click PLC and the next are reading form the Click PLC.
We have now finished setting up our BRX PLC Slave unit.

Click PLC Configuration
The Click PLC can be programmed using free Click programming software from Automation Direct. Here is a link for the software.
http://support.automationdirect.com/products/clickplcs.html
The following links will help you to install the software and establish communication.
http://accautomation.ca/click-plc-installing-the-software/
http://accautomation.ca/click-plc-establish-communication/

We will go online with the Click PLC and call up our Com Port Setup…
Main Menu | Setup | Com Port Setup…

Under Port 3 select Setup…

We will now make sure that the communication settings match our slave unit.
Unit ID: 1 – This will not matter in our case because this is the master.
Baud Rate: 38400
Data Bits: 8
Stop Bits: 1
Parity: Odd
Select OK once the settings have been changed. We can then select OK on the COM Port Setup window to close it.

Click PLC Program
We will be using the send and receive instruction in the Click PLC to get the information (receive) and write the information (send) using Modbus RTU.
http://accautomation.ca/click-plc-send-and-receive-instructions/

The Receive instruction will read the first 10 words from the BRX PLC. See the table above for the addresses.

The instruction will be enabled from the leading edge of the send instruction success or error flag. These flags have been labeled Write_Success and Write_Error. The instruction can also be enabled by the first scan flag (bit) of the PLC. This will get the communication started.

The Send instruction will write the next 10 words to the BRX PLC. See the table above for the addresses.

The instruction will be enabled from the leading edge of the receive instruction success or error flag. These flags have been labeled Read_Success and Read_Error.

Using the copy command we will set the first register (DH1 – 400001) into the physical outputs. We will then see the information changing.
Save the program and download it to the controller. We can then put the Click PLC in run mode and execute our ladder program.

Calling the Data View in the Click programming software, we can then monitor and set the information that we are now exchanging with the BRX Series PLC.

See this program in action by watching the video below.

You can download both PLC programs here.

Watch on YouTube : Modbus RTU Click PLC Master to BRX PLC Slave Communication
If you have any questions or need further information please contact me.
Thank you,
Garry



If you’re like most of my readers, you’re committed to learning about technology. Numbering systems used in PLC’s are not difficult to learn and understand. We will walk through the numbering systems used in PLCs. This includes Bits, Decimal, Hexadecimal, ASCII and Floating Point.

To get this free article, subscribe to my free email newsletter.


Use the information to inform other people how numbering systems work. Sign up now.

The ‘Robust Data Logging for Free’ eBook is also available as a free download. The link is included when you subscribe to ACC Automation.




It's only fair to share...Email this to someoneShare on LinkedInShare on FacebookShare on Google+Digg thisPin on PinterestShare on StumbleUponShare on TumblrTweet about this on TwitterShare on RedditPrint this page

Leave a Reply

Your email address will not be published. Required fields are marked *