Productivity 1000 Series PLC Modbus TCP Ethernet Communication

The productivity series of PLCs comes with 4 built-in communication ports for easy connectivity to your PC or various industrial networks. Ethernet protocols like Modbus TCP can be utilized with the RJ45 port on this PLC. Modbus TCP is an open (published) protocol that uses the Server (Master) / Client (Slave) architecture. It’s a very common protocol used in industrial automation controls.

We will be using the RJ45 (Ethernet) port to communicate to a Click PLC. Modbus TCP will be the protocol used on this Ethernet communication media. The Productivity 1000 PLC will be the server and the Click PLC will be the client. We will be creating a network between the two PLC units. A heartbeat will be used so if communications is lost, the server (slave) will know. The throughput time will be timed by using a small program in the Click PLC. You will soon see how the Productivity Series of PLC’s is the best way to handle communication to other devices. Let’s get started.

Previously in this Productivity 1000 series PLC we have discussed:
System HardwareVideo
Installing the SoftwareVideo
Establishing CommunicationVideo
First ProgramVideo
Documenting the ProgramVideo
Monitoring and Testing the ProgramVideo
Online Editing and Debug ModeVideo
Numbering Systems and Tag DatabaseVideo
Contact and Coil InstructionsVideo
Timer InstructionsVideo
Counter InstructionsVideo
Math InstructionsVideo
Data Handling Instructions Part 1Video
Data Handling Instructions Part 2Video
Array Functions Part 1Video
Array Functions Part 2Video
Array Functions Part 3Video
Program ControlVideo
Drum Sequencer InstructionsVideo
Data LoggerVideo
Web ServerVideo
Modbus RTU Serial CommunicationVideo

Watch the video below to see the running and configuration of the Modbus TCP Ethernet Communication from the Productivity 1000 Series PLC to the Click PLC.

System Configuration
We will be writing and reading 10 16bit registers each; to and from the Click PLC from our Productivity 1000 PLC.

Click PLC Productivity 1000 PLC
DH1 ——————– P1000_Net_Write1 – Bit 1 = Heartbeat Bit (1sec on 1sec off)
DH2 ——————– P1000_Net_Write2
DH3 ——————– P1000_Net_Write3
DH4 ——————– P1000_Net_Write4
DH5 ——————– P1000_Net_Write5
DH6 ——————– P1000_Net_Write6
DH7 ——————– P1000_Net_Write7
DH8 ——————– P1000_Net_Write8
DH9 ——————– P1000_Net_Write9
DH10——————- P1000_Net_Write10
DH11——————- P1000_Net_Read1
DH12——————- P1000_Net_Read2 = Throughput Time Captured
DH13——————- P1000_Net_Read3
DH14——————- P1000_Net_Read4
DH15——————- P1000_Net_Read5
DH16——————- P1000_Net_Read6
DH17——————- P1000_Net_Read7
DH18——————- P1000_Net_Read8
DH19——————- P1000_Net_Read9
DH20——————- P1000_Net_Read10
Note: If we wish to extend our network with a third PLC that would share information to the network we would do the following. Read 10 registers and write 20 registers from and to the 3rd PLC. We would then write 20 registers to the Click PLC. This includes the existing 10, plus the 10 read registers from the 3rd PLC.

Click PLC Configuration
The first thing that we will do is set up the Click PLC Ethernet port.

You can access the Com Port Setup by using the main menu | Setup | Com Port Setup…

Select Port 1: Setup for the Ethernet.

You will notice that the Modbus protocol is already selected. We will use the manual settings for the Network Address Configuration.
IP Address: 192.168.1.130
Subnet Mask: 255.255.255.0
The default gateway will be left at 0.0.0.0 so it is not exposed to the internet.
Since the Click PLC will be configured as a Server (Slave), ensure that the TCP Port Number is set for 502. This is the default port for Modbus TCP Protocol. We will leave everything else as a default. Select OK to close the Com Port Setup Details. Select OK again to close the COM Port Setup.
We will now find the Modbus addresses that we need from the Address Picker in the Click programming software.

Select Address Picker under the Ladder Program in the Navigation menu. You can also get to this by the main menu | Program | Address Picker… or use CTRL + T.

On the left side of the address picker edit mode, select the DH area. Ensure that display Modbus Address is selected. We are using MODBUS 984 Addressing. Note the following:
DH1 – Modbus Address 424577
DH11 – Modbus Address 424587
Select OK to close the address picker window.
More information can be obtained by going to our Click PLC Series page. This will go through most of the features of this cost effective programmable logic controller.

Productivity 1000 Modbus Overview

1 – microSD Slot
2 – Micro USB 2.0 Programming Port
3- RS232 Serial Port (RJ12)
4 – RS485 Serial Port (TB Style)
5 – 10/100 MB Ethernet Port
Modbus TCP protocol through the Ethernet port (RJ45) is the method in which we will communicate to the Click PLC. This is a client (master) / server (slave) protocol. The client sends a request and the server will respond to that request only. A review of the Modbus TCP protocol can be seen at the following URLs.
https://www.rtautomation.com/technologies/modbus-tcpip/
http://www.simplymodbus.ca/TCP.htm

Productivity 1000 Port Setup
The Ethernet RJ45 port must be set up. Under the Setup in the Application Tools select Hardware Config.

Alternatively you can also use the main menu | Setup | Hardware Config.

The hardware configuration window will now be displayed. Double click on the CPU unit outlined in green.

This will bring up the P1-540 CPU model window. Select the Ethernet Port tab along the top of the screen.

Our port settings are set to the following.
IP Address: 192.168.1.130
Subnet Mask: 255.255.255.0
These settings indicate that the Click PLC can communicate to the Productivity 1000 PLC. (What Everybody Ought to Know about IP Addressing)
The default gateway is 192.168.1.1 so it can connect to the internet.
Select OK after setting these parameters.
Click the x on the hardware configuration window. We are now finished setting the Ethernet port of the PLC for communication.

Productivity 1000 PLC Program

We will be using the Modbus Read (MRX) and the Modbus Write (MWX) instruction for our Modbus TCP master program.

Modbus Write (MWX)

This instruction is broken down into three sections. The first is the instruction parameters.
Select the Ethernet Port – CPU-ETH-Ext
IP Address is set for 192.168.1.130 – Click PLC
The slave node number is set for the default of 255. Since Modbus TCP uses the IP address this is not utilized for our instruction.
We will use structure with a name of ModbusTCPWrite. This will set up the corresponding addresses and bits to be used with this instruction.
The second part is the addressing and polling options. This makes the setting of the Modbus Master the easiest that I have seen. The Automatic Polling feature allows you to choose the rate at you desire to send messages without having to use a separate timer and enable logic. The Message Queue stages the messages from the ladder code to go out to each physical communications port without requiring interlocking logic. The longer the poll time can be, within tolerance of the application, the better the overall network performance. So for efficiency in programming and for the best possible performance for the system, conservative poll rates should be used when utilizing the Automatic Poll feature. There is also a Poll offset field in the communications instructions. This helps prevent the instructions from being queued all at the same time. When the CPU project starts, there is a master timer that begins. The ladder scan will look to see if the instruction is enabled. If it is enabled, it will begin the Automatic Poll timer at the specified poll offset value from the master time clock.
We will select automatic polling at 50 milliseconds. This means that all of the timing between all of the Modbus Write and Read commands will be automatically handled by the PLC firmware.
Our Slave Modbus Starting Address is 24577. Note that the +400000 is added based upon the Modbus Function Code selected. This is the Modbus address for DH1.
We will be using Modbus Decimal Addressing.
The third part of the instruction is Tagname Mapping. This will specify where the information is located to be written to the Click PLC. We will create a Non-Array of 10 tags. Our Tags will be a 16 bit integers named P1000_Net_Write1 to P1000_Net_Write10.

Here is our completed Modbus Write instruction.
Modbus Read (MRX)

This instruction is broken down into three sections. The first is the instruction parameters.
Select the Ethernet Port – CPU-ETH-Ext
IP Address is set for 192.168.1.130 – Click PLC
The slave node number is set for the default of 255. Since Modbus TCP uses the IP address this is not utilized for our instruction.
We will use structure with a name of ModbusTCPRead. This will set up the corresponding addresses and bits to be used with this instruction.
The second part is the addressing and polling options. Automatic Polling performs all of the sequencing for you so you do not have to write any logic.
We will select automatic polling at 50 milliseconds. Our poll offset will be set at 25 milliseconds. This means that when this instruction executes, a delay of 25 milliseconds will be observed before the first read takes place.
Our Slave Modbus Starting Address is 24587. Note that the +400000 is added based upon the Modbus Function Code selected. This is the Modbus address of DH11 of our Click PLC.
We will be using Modbus Decimal Addressing.
The third part of the instruction is Tagname Mapping. This will specify where the information read is to be placed. We will create a Non-Array of 10 tags. Our Tags will be 16 bit integers named Click_Net_Read1 to Click_Net_Read10. This will read the values of these registers from our Click and place them into our Productivity PLC.

Here is our completed Modbus Read instruction.

Here is our program for the Modbus Write and Read instruction.

Note that the Modbus read and write instructions do not have any logic to enable them. They are enabled all of the time because the automatic polling will take care of the timing sequence for us.

HeartBeat Pulse Bit
The Productivity will send out a pulse bit that can be used to determine if communications are good. This pulse bit will be on for one second and off for one second.

The heartbeat pulse bit will osculate bit 1 of P1000_Net_Write1 on and off. This can then be used by our Click PLC to determine if communication is functioning correctly.
Here is the program in the Click PLC for the Heartbeat.

Take the first read area register from the Productivity and separate into individual bits.
DH1 word to C1 to C16 bits

The Productivity will pulse a bit on for a second and off for a second. This will set up the heartbeat to detect for communication loss. When the heartbeat bit is on or off, on delay timers are started. The timers have a set value of 2 seconds. If either timer is activated then output Y1 will come on. This will indicate that we have a communication error.

Determine Throughput Time of the Network
The Click PLC is setting a bit on and we are in turn turning a bit on in the Productivity PLC.

The Click program will use a timer to determine the amount of time it takes for the signal to be sent and returned on the network. The result in milliseconds is located in P1000_Net_Read2 register.

Download the PLC programs here.

Watch the video below to see the running and configuration of the Modbus TCP Ethernet Communication from the Productivity 1000 Series PLC to the Click PLC.

Productivity 1000 Series PLC form Automation Direct
Overview Link (Additional Information on the Unit)
Configuration (Configure and purchase a system – BOM)
User Manual and Inserts (Installation and Setup Guides)
Productivity Suite Programming Software (Free Download Link)
This software contains all of the instruction sets and help files for the Productivity Series.

Next time we will look at Modbus TCP Ethernet communication in the Productivity 1000 Series PLC with AdvancedHMI.

Watch on YouTube : Productivity 1000 Series PLC Modbus TCP Ethernet 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.




Leave a Reply

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