Click PLC to Modbus TCP RTU Remote IO BX-MBIO

The Click PLC can communicate to a remote I/O (input and output) controller modules using the Modbus protocol for communications. The BX-MBIO provides both Modbus RTU and Modbus TCP interfaces for remote IO. Modbus RTU is a serial communication and Modbus TCP is an Ethernet communication. Modbus RTU is supported over an RS-485 serial connection. Modbus TCP is supported over an Ethernet connection. They function as listening/replying devices (slave, server) and can connect with any mastering (master, client) device that communicates using the Modbus protocol.
Previously we looked at the BX-MBIO Modbus RTU TCP Remote IO Controller wiring and configuration.
Modbus RTU TCP Remote IO Controller BX-MBIO
BX-MBIO Hardware Video
BX-MBIO Powering and Configuring Video

We will connect the Click Ethernet PLC to the Modbus remote IO. This will be done using the Modbus TCP and Modbus RTU protocol. Ethernet and serial RS485 communication to the BX-MBIO unit will be the media.
The BX-MBIO remote I/O expansion units feature the following:
• RJ45 Ethernet port for communications via Modbus TCP
• RS485 serial port for communications via Modbus RTU
• Supports up to 8 additional Expansion Modules (Add the discrete or analog I/O you require)
• AC and DC powered units available
• AC powered units include an integral 24VDC auxiliary output power supply
• Power connector and serial port connector included
Let’s get started.

Previously in this series, we have discussed:
System Hardware – Video
Installing the SoftwareVideo
Establish CommunicationVideo
Numbering System and AddressingVideo
Timers and Counters
Counter Video
Timer Video
Compare and Math InstructionsVideo
Program Control InstructionsVideo
Shift RegisterVideo
Drum InstructionVideo
Send and Receive InstructionsVideo
AdvancedHMI CommunicationVideo
Firmware UpdateVideo
HMI Rotary Encoder Dial InputVideo
High Speed Counters Part 1
High-Speed Count Mode Video
– Interval Measurement Mode Video
Duration Measurement Mode Video
Frequency Measurement Mode Video
High Speed Counters Part 2
– External Interrupt Mode Video
Pulse Catch Mode Video
Filter Pulse Mode Video
Frequency Measurement and High-Speed Count Mode Video
Wiring Stack Light to Click PLCVideo
Wiring Push Buttons and Selector Switch to Click PLCVideo
Test and Assembly of Push Buttons and a Selector Switch – Video
Wiring an Inductive Proximity NPN PNP Sensor to the Click PLCVideo
Wiring a Capacitive Proximity NPN PNP Sensor to the Click PLCVideo
Wiring an Ultrasonic Proximity Sensor to the Click PLCVideo
Unboxing our UK1F Ultrasonic Proximity Sensor – Video
Analog Dusk to Dawn ProgramVideo
PID using Factory IOVideo
PID Instruction and Autotuning using Factory IOVideo
Logging Data with Time and Date StampVideo
Stride Field Remote IO Modules Modbus TCP Ethernet
Unboxing SIO MB12CDR and SIO MB04ADS Video
Powering and Configuring Video
Click PLC to Stride Field IO Modbus TCPVideo
Modbus RTU TCP Remote IO Controller BX-MBIO
BX-MBIO Hardware Video
BX-MBIO Powering and Configuring Video

Our entire series can be found here.
The programming software and manuals can be downloaded from the Automation Direct website free of charge.
Watch the video below to see Click PLC controller control analog and digital inputs and outputs remotely.

Click PLC System Modbus Setup – Client (Master)

click plc remote io
Our click plc will act as the Modbus Client (Master). It will communicate to the BRX BX-MBIO remote I/O which are Modbus Servers (Slaves).
Call up the COM Port Setup window by using the main menu | Setup | Com Port Setup…
click plc remote io
Select the Setup button on Port 1. This is the Ethernet port on the PLC.
click plc remote io
Here is where we can set our IP address for the Click PLC Ethernet port. Modbus communication is already selected as the protocol.

Click PLC System Modbus RTU Setup – Master (Client)
click plc remote io
On the COM Port Setup window, select the Setup button on Port 3. This is the RS485 port on the PLC.
click plc remote io
The port settings (baud rate, data bits, stop bits, parity, etc.) must match the settings on the BX-MBIO remote IO unit. Select OK. The protocol is automatically selected as Modbus.
The Click PLC is now ready to be a Modbus RTU Client (Master).

BX-MBIO Modbus Server (Slave) Setup Address and Parameters

Previously we used NetEdit3 and a web browser to configure our Modbus remote input and output unit. See the links above.
Start NetEdit3 by selecting it from the Applications section of the Launchpad on our Do-More Designer software.
click plc remote io
Select the BX-MBIO module from the list that was scanned and then select the MBIO Settings tab at the bottom.
Select the General… button.
click plc remote io
Here is the IP address for our unit.
Select the Serial Port… button.
click plc remote io
Here are the port settings for the Modbus remote IO unit. This must match the settings on the Click PLC that we set above.

BX-MBIO Modbus Addresses

Using the web-based configuration from the NetEdit3 software we can call up the main menu. This can be done also by entering the IP address of the MBIO unit in your web browser software.
click plc remote io
Select display Modbus I/O mapping. This will show us the Modbus addresses that we will need to program our PLC.
click plc remote io
This table will now be used to program our Click PLC.

System Wiring

click plc remote io
The first relay output of the BX-08CD3R will be wired to the input of the first point on the same mixed IO unit. This unit is located on our remote input and output Modbus unit. This will allow us to see the input working.
Using the voltage input tester that we created previously, we will be wiring this up to the first voltage input on the BX-08AD-2B unit.
Create an Analog Voltage Input Tester for a PLCVideo

Click PLC Program

click plc remote io
Our sample program has a Main program that will do the overall logic. It will call up two subroutine programs that will handle the communications to the BX-MBIO unit.
– Modbus TCP BX-MBIO – Modbus TCP via Ethernet RJ45
– Modbus RTU BX-MBIO – Modbus RTU via Serial RS485

Click PLC Main Program

The main program will call the communication subroutines and handle the main logic.

The first rung of the program will call the subroutine Modbus TCP BX-MBIO.
The second rung of the program will call the subroutine Modbus RTU BX-MBIO.
Unconditional rungs are used because we want this communication to happen every scan of the PLC.

Rung 3 and 4 will set up timers based on the analog input signal coming from the remote Modbus input and output unit.

If timer 0 is done, rung 5 will compare the analog input to a value of 100. This is to ensure that the analog timer will not chatter the output if the value becomes too low. The first discrete output relay is then turned on. We have included both the settings for Modbus TCP and RTU because both of our communication methods have control over the output. (This is done for demonstration purposes. Normally you would use either Modbus TCP or RTU and not both.)

Modbus TCP BX-MBIO
Modbus TCP Communication to BX-MBIO

BX-MBIO Remote I/O Modbus TCP – PLC Addresses
DS1 – 0000 – Reset Errors – 410001
DS2 – 0000 – Reset Errors – 410002
DS4 – 3000 – Timeout on the Remote Unit (3 Seconds) – 410007
DS20 – DS27 – Analog Input Remote Unit – 300001 – 300008
DS30 – DS37 – Analog Output Remote Unit – 400001 – 400008
C30 – C33 – Discrete Input Remote Unit – 100001 – 100005
DS12 – Discrete Output Remote Unit – 402001 – 402005
click plc remote io
The above Modbus address list is where the BX-MBIO errors are located. Writing a 0 into these addresses will clear the error. Link Monitor Timeout is used to determine the amount of time between Modbus transmissions before the BX-MBIO displays an error.


Upon the first scan of the PLC or the detection of a remote I/O error, reset the error on the remote I/O rack. This is done using the Send instruction. C1, C2, and C3 are used to trigger the next communication from this one. This will keep our timing synchronized.

Set the link monitor timeout for 3 seconds. This is the value stored in DS4.
click plc remote io
This is what it will look like when a link monitor timeout occurs.

Read the analog inputs on the Modbus remote I/O unit.

Write the analog outputs on the Modbus remote I/O unit.

Read the discrete inputs on the Modbus remote I/O unit.

Use the copy to pack the output bits into a word. Write the discrete output word on the Modbus remote I/O unit.

Read the Modbus remote input and output rack unit errors.

If there are no errors then turn on C22 which will then trigger reading the analog inputs again.

If an error is read, then turn on C23 with will then reset the errors. This is at the beginning of the program routine.

Modbus_RTU_MBIO
Modbus RTU Communication to BX-MBIO

BX-MBIO Remote I/O Modbus RTU – PLC Addresses
DS101 – 0000 – Reset Errors – 410001
DS102 – 0000 – Reset Errors – 410002
DS104 – 3000 – Timeout on the Remote Unit (3 Seconds) – 410007
DS120 – DS127 – Analog Input Remote Unit – 300001 – 300008
DS130 – DS137 – Analog Output Remote Unit – 400001 – 400008
C130 – C133 – Discrete Input Remote Unit – 100001 – 100005
DS112 – Discrete Output Remote Unit – 402001 – 402005
The Modbus RTU program is identical to the TCP program to get the information. The addresses used are offset by 100 in most cases. Normally you would program one or the other Modbus method.


Upon the first scan of the PLC or the detection of a remote I/O error, reset the error on the remote I/O rack. This is done using the Modbus Network Write instruction. C101, C102, and C103 are used to trigger the next communication from this one. This will keep our timing synchronized.

Set the link monitor timeout for 3 seconds.
click plc remote io
This is what it will look like when a link monitor timeout occurs.

Read the analog inputs on the Modbus remote I/O unit.

Write the analog outputs on the Modbus remote I/O unit.

Read the discrete inputs on the Modbus remote I/O unit.

Use the copy to pack the output bits into a word. Write the discrete output word on the Modbus remote I/O unit.

Read the Modbus remote input and output rack unit errors.

If there are no errors then turn on C122 which will then trigger reading the analog inputs again.

If an error is read, then turn on C123 with will then reset the errors. This is at the beginning of the program routine.

Watch the videos below to see the running of the Click PLC program to communicate to our BX-MBIO Modbus remote I/O unit.

Download the Click PLC program here.

Click PLC Support Links
The Click PLC can be programmed using free Click programming software from Automation Direct. Here is a link to the software.
https://support.automationdirect.com/products/clickplcs.html
The following links will help you to install the software and establish communication.
https://accautomation.ca/click-plc-installing-the-software/
https://accautomation.ca/click-plc-establish-communication/
The entire Click PLC series can be found at the following URL:
https://accautomation.ca/series/click-plc/

Modbus Learning Links:
Simply Modbus Frequently Asked Questions
Modbus TCP/IP Overview – Real-Time Automation
All You Need to Know About Modbus RTU – Video

Watch on YouTube: Click PLC to Modbus TCP RTU Remote IO Controller BX-MBIO


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 Comment