Make Modbus RTU Work for You
Modbus RTU May Meet Your Needs
ModBus RTU is a lower-cost, more code-intensive solution. With a 19.2K baud rate, if your system requirements are minimal, a Micro830 with a serial plug-in module may make sense for you. If you are considering this solution, here are some factors to keep in mind:
- No more than Nodes 0-31
- End resistors of 120 ohms should be placed at the physical end of the network
- If the Micro800 can do Modbus RTU, the CompactLogix and the ControlLogix can accomplish the same networking scheme
- The Micro830 is more suitable for the cost to perform well on slow serial networks such as Modbus RTU
Why Choose Modbus RTU?
EtherNet/IP is an extremely fast network compared to Modbus RTU, but don’t overlook Modbus and Micro800 on low-budget, high-priority jobs. The advent of the UDFB (user defined function block) takes many steps out of programming. If you are not placing many devices on a network, this might be an excellent alternative to a CompactLogix system. The physical wiring is a very simple design called “daisy chaining,” place each wire on top of each other, ground the shields to drain any noise that may get on the network. The baud rate helps with noise immunity versus higher-speed networks.
Each drive will need a two-position terminal with an RJ45 connector on one end of the device. AK-U0-RJ45-TB2P drive terminals come with six terminals and two resistors in each package for easy connection to the network. The serial plug-in module (2080-SERIALISOL) does not require a connector; it has a terminal block and the networking cable (RS485) will directly into the plug-in module.
Wiring the Serial Communication Module
Connect the RJ45 plug on your drive to your Micro800 controller’s isolated serial port by using a two-wire, twisted-pair shielded cable (Belden 3105A, recommended).
Downloading Programming Software
The Micro800 programs with a software package known as Connected Component WorkBench (CCW). It can be downloaded from the Product Compatibility and Download Center (PCDC) at ra.rockwell.com.
There is a full Developer’s Edition (DE) which allows you to make online programming changes during the design stages of your product. The Standard Edition is an offline tool only, so you will have to download it every time you make a change. We strongly encourage you to use the DE version of the software. You will be asked for your Tech Connect information from Rockwell Automation to download from the PCDC.
Programming the Micro Controller
You can access a sample program here: Lead-Lag Pumps. This zip file contains an archive file, so you will have to import in CCW. The program was written for PF520 series drives. Feel free to study the automatic restart functions, the network timers to avoid messaging too early on power-up of a controller, and the faults with resets in the code.
In this lead-lag pump application, the pumps will alternate back and forth to provide equal wear to redundant supply pumps. Modbus utilizes message instructions through the code and tag structure to read and write to a slave device from the serial module. Each device will have a unique node address on the network, like mailboxes in a town. There will be a certain amount of information sent and gathered from the master to the slave; this will be determined by the size of the block being sent and received, similar to the size of the letter in the mail.
Some prior programmers have written blocks to make the process easier. Depending on your version of the software, you may have to go to the PCDC and download some UDFB to place in your code to reduce the amount of code in your message structure. You can see a drive UDFB on the right.
In the image to the right, outputs are on the left and Inputs to the drive are on the right.
Programming Variables for Ladder Programming
Feel free to cut and paste sections of this sample program into your own workspace and download it into a controller. Keep in mind that what you enter as values in the data structure change the properties of the messaging over Modbus. The lead-lag program is the messaging from the serial module to each slave device, in this case, the drives. The project organizer stores the code for the programs in the controller (lead-lag, pump_1, pump2) and the variables (structure data for the code). Global variables are common to all programs. Local variables are specific to the program directly above it in the organizer. UDFB is also stored here. Download the archive, import it, and explore around in the organizer.
Programming Variables and Understanding Structure
The pump_1 variable structure is from the UDFB, and the data is built for you. If you use rough message structure, you will have to type in all the tag names and associate those tags to the correct word position and possibly the proper data. This will save you a lot of time!
Important: The node address is unique for each device on the network. You must fill in this value manually into the data table.
Developing the Modbus Read Instruction
The following reads the status on the right of the UDFB. It refreshes every time the program scans for new information to put in the pump_1 variables.
Pump_1 Modbus Read Instruction in Lead_Lag Main Program
Developing the Modbus Write Instruction
The following writes the status on the right of the UDFB. It refreshes every time the program scans for new information to put in the pump_2 variables.
Pump_2 Modbus Write Instruction in Lead_Lag Main Program
Are You Ready to Try Modbus RTU?
If you think Modbus RTU is the right fit for you, the instructions above can help you set up our system. As always, our specialists are here to help you along the journey to a perfect program. If you have any questions or need help deciding, contact us today!