Click PLC Modbus ASCII Protocol Communication

We will now look at the click plc modbus ascii protocol. This communication will happen in PLC ladder logic and communicate through the serial port (RS485) to a Solo process temperature controller. Modbus ASCII will be the communication protocol.
Modbus is a communication method used for transmitting information over serial lines between electronic devices. The device requesting the information is called the Modbus Master (Client) and the devices supplying information are Modbus Slaves (Servers). This protocol was originally developed by Modicon systems.
Modbus protocol comes in basically three different types. Ethernet (Modbus TCP) or Serial (Modbus RTU or Modbus ASCII). Modbus TCP and Modbus RTU come as standard protocols in the productivity series of PLCs.
click plc modbus ascii
We will connect the Click PLC to a Solo process temperature controller. This will be done using the Modbus ASCII protocol over serial RS485 communication wire. (Media) The present and set values (PV / SV) will be read from the Solo controller and the set value will be written when required. 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
Click PLC to Modbus TCP RTU Remote IO Controller BX-MBIOVideo

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.

Solo Process Temperature Controller

click plc modbus ascii
All Solo Standard Controllers are capable of Modbus communication.
click plc modbus ascii
The data and bit registers support the following Modbus function codes.
Data Registers
03: Read Holding Registers (maximum limit is read of eight registers)
06: Write Single Register
16: Write Multiple Registers (maximum limit is eight)
Bit Registers
01: Read Coils
02: Read Discrete Inputs (Both Function Code 1 & 2 read the same memory area.)
05: Write Single Coil (Write FF00H to set the coil or 0000H to reset the coil.)
The modbus addresses for the Solo process temperature controller can be found in chapter 7 of the manual. See the link below.

In our example, we will be reading the PV and SV values from the controller and write the SV when required.

Solo Process Temperature Controller Configuration

The first thing that we will do is set up the Solo Temperature Controller. Additional information can be found at the following link.

Wiring diagram:
click plc modbus ascii

The solo process temperature controller needs to be set up before we can communicate with it. The default setting is ‘Off’ for the On-Line Configuration. Here is the way to change into the different modes in the Solo.

In the Initial Setting Mode we will change the online configuration to on and make the changes to the Modbus settings as follows: 19200 Baud, Even, 7 Data Bits, 1 Stop Bit, Modbus ASCII Format. We will leave the default unit number as 1.


Our controller is now set to communicate.

Download the documentation and/or configuration and monitoring software at the following URL link:
Solo Process Temperature Controller Manual

Modbus ASCII Protocol Format

As the name states, ASCII (American Standard Code for Information Interchange) is used for the communication messages.
Modbus ASCII marks the start of each message with a colon character “: ” (hex 3A).
The end of each message is terminated with the carriage return and line feed characters (hex 0D and 0A).
Example:
Sent data from the master
:010310000002EA
: – Start of message
01 – Address (unit) number
03 – Function Code (read multiple registers)
1000 – Data – Starting address to read
0002 – Data – Number of registers to read
EA – LRC (Longitudinal Redundancy Check) error checking byte
Response data from the slave
:01030400DC012CEE
: – Start of message
01 – Address (unit) number
03 – Function Code (read multiple registers)
04 – Number of return registers in bytes
00DC – Data returned PV in Hexadecimal = 22.1 degrees C
012C – Data returned SV in Hexadecimal = 30.0 degree C
EE – LRC (Longitudinal Redundancy Check) error checking byte
The bytes that you see in sending and receiving information is represented by two ASCII characters. Each ASCII character is 8 bits long. This means that Modbus ASCII sends more information back and forth than Modbus RTU.
Note: Since the space between bytes is variable, transmission through modems is possible with Modbus ASCII.

Click PLC Modbus Setup – Master


click plc modbus ascii

Modbus ASCII will be the serial (RS485) method in which we will communicate between the Click PLC Port #3 and the Automation Direct Solo Process Temperature Controller.
We can address up to 247 (Solo 1 to 247) devices on this master-slave protocol. A maximum of 32 devices (Nodes) on the network can communicate to the master.
click plc modbus ascii
Using the Click programming software call up Com Port Setup… by selecting it from the main menu | Setup.
click plc modbus ascii
Select Setup… under port 3. This is our RS485 communication port.
click plc modbus ascii
Under the Com Port Setup Details window, select ASCII for the protocol. Our communication parameters must be set to match our selection from the Solo controller.
(19200, Even, 7, 1) Select OK to save the parameters.
click plc modbus ascii
Another way to get to the port setting on the PLC is to use the System Configuration… (main menu | Setup)
click plc modbus ascii
Click on the port that you would like to set up on the system configuration window.
click plc modbus ascii
In our case, we are selecting the RS485 port. If the protocol will not allow you to change (Dim) then this indicates that a program is in the PLC that controls this port already. Delete the ladder instructions so you can change the protocol.
We are using the ASCII instruction to send and receive out the port. Our PLC is now set to start programming our Modbus ASCII protocol.

Click PLC Program

Using the Modbus ASCII Protocol communicate to a Solo Process Temperature Controller
DH1 – PV present value
DH2 – SV set value
DH20 – Change SV
click plc modbus ascii
When the value in DH20 changes to greater than 0 the value is then written into the Solo controller. Call the subroutine to perform the Modbus ASCII protocol.
click plc modbus ascii
Modbus ASCII Send:
:010310000002EA (See above for an explanation.)
click plc modbus ascii
Modbus ASCII Receive:
:010304XXXXYYYYZZ (See above for an explanation.)
click plc modbus ascii
When the correct number of return characters are received, then set the done bit.
click plc modbus ascii
All communications (Send / Receive) will have a time delay of at least 10 msec.
click plc modbus ascii
Convert the returned ASCII values into the appropriate hexadecimal values. This will return the Solo present and set values.
Send SV Value to Solo
click plc modbus ascii
If the Solo SV Change Value is greater than 0 then copy the value to the Solo SV Write variable. We then set the Change SV bit.
The set value is then unpacked into the individual 16 bits. We then assemble the lease significant byte (LSB) and the most significant byte (MSB) into DH4 and DH5. This is used for the calculation of the LRC.
Calculation of LRC value for Sending SV to Solo
click plc modbus ascii
The LRC is calculated by adding together successive eight-bit bytes in the message, discarding any carries, then two’s complementing the result.
Modbus ASCII SV Write – :01061001XXXXYY (XXXX SV) (YY LRC)
01 + 06 + 10 + 01 = 18
Formula: 1 – (18 + SV LSB + SV MSB) – 1
The result word is then converted to ASCII text.
click plc modbus ascii
Convert the SV into ASCII text.
click plc modbus ascii
Assemble the ASCII string to change the Solo SV value.
TXT101 to TXT109
:01061001
TXT110 to TXT113
Solo SV (XXXX)
TXT114 to TXT115
LRC (ZZ)
Ladder Logic Sample Programming Code
Change the Solo SV time delay before sending the Modbus ASCII string.
Ladder Logic Sample Programming Code
Send the Modbus ASCII string to change the Solo set value (SV).
Ladder Logic Sample Programming Code
Receive the return string after changing the solo SV.
Modbus SV Write Receive:
:010602XXXXZZ
Ladder Logic Sample Programming Code
When the SV is sent successfully on the port, then set the communication done bit for the SV write.
Ladder Logic Sample Programming Code
Set the communication delay timer.
Ladder Logic Sample Programming Code
Reset the parameters and bits once all of the communications have been done. Then turn on a communication restart bit.
Ladder Logic Sample Programming Code
Restart the communication again after a time delay.
Ladder Logic Sample Programming Code
Timeout Delay Signals
Timer 5 will reset the Modbus ASCII communications if no activity is seen for 2 seconds. (2000 ms)
click plc modbus ascii

Testing the Modbus ASCII program

click plc modbus ascii
Using data view we can change the set value of the controller. See below for error codes that may be seen when troubleshooting your program.

Watch the video below to see the running and configuration of the Modbus ASCII Serial Communication from the Click PLC to the Solo Process Temperature Controller.

Solo Error Response Codes

Exception responses that the Solo process temperature controller will help to troubleshoot your communication.
Format:
Modbus Address + (function code + 80H) + Error code
Here are the response codes (error codes) that can be returned.
01H function code is not supported
02H Illegal function address
03H Illegal read/write word count
04H Data process fails
09H Checksum error
Note: 04H is often caused by writes to the solo, but not having parameter CoSH set.

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 Modbus ASCII Protocol


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