Click PLC Serial Communication Timing

Click PLC Serial Communication Timing


Many questions come from serial communications using the Click PLC. Most of these questions deal with communication timing when using multiple send and receive instructions. We will show you how to deal with serial communication timing in the Click PLC.
Receive and Send instructions will allow you to send and receive serial data to an external device. The communication method that you set up can be ASCII or Modbus. ASCII (American Standard Communication for Information Interchange) can be used to send to devices such as a printer. Receiving ASCII can be used for connecting barcode scanners to the PLC. The barcode will be read as an ASCII string in the PLC. Modbus serial communication (Modbus RTU) is a standard protocol used in many automation devices.
Click PLC Serial Communication Timing
We will demonstrate the Send and Receive instruction by communicating Modbus RTU to a Solo Temperature Controller. Parameters from the Solo process temperature controller will be read using multiple receive instructions. The send instruction will be used multiple times as well to set the Set Value (SV) and Limits of the SV value entered in the temperature controller. The set values will only be changed when required. Let’s get started.

Our entire Click series can be found here. All of the previous information for the Click PLC can be applied to the Click PLUS.
Previously we looked at the following:
Software InstallationVideo
Click Software Establish CommunicationVideo
MQTT CommunicationVideo
Data LoggingVideo
Click Plus Real-Time ClockVideo
The programming software and manuals can be downloaded from the Automation Direct website free of charge.
Watch the video below to see the serial communication timing between the Click PLC and Solo process temperature controller.

Click PLC RS485 Setup

The first thing that we will do is set up the communication port on the Click PLC. We are using Port 3 which is the serial RS485 port.
Click PLC Serial Communication Timing
Main Menu | Setup | Com Port…
This will call up the communication port settings on the Click programming software.
Click PLC Serial Communication Timing
Depending on the Click CPU that you are using you may have different versions of this screen. Select the setup button for Port 3 (RS485).
Click PLC Serial Communication Timing
The Com Port Setup Details window will now be displayed. Port3 is the one that we selected and the protocol is set for Modbus. Under the basic configuration, we will set the baud rate, parity, stop, and data bits.
Note: These parameters must match what is set on the Solo process temperature control or communications will not take place.

Solo Temperature Controller RS485 Setup

We will now set up the Solo process temperature controller. This needs to be set up before we can communicate with it.
Click PLC Serial Communication Timing
The default setting is ‘Off” for the On-Line Configuration. (Communication) Here is the way to change into the different modes in the Solo.

In the Initial Setting Mode we will change the on line configuration to on and make the changes to the Modbus settings as follows: 9600 Baud, Even, 7 Data Bits, 1 Stop Bit, Modbus RTU 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 here.

Click to Solo RS485 Wiring Diagram

RS485 is a serial data transmission standard that is widely used in industrial automation controls. This twisted wire allows communication to happen with several devices back to one controller. In our case, the Click PLC will be the master and the Solo temperature controller will be the slave device.
Click PLC Serial Communication Timing
Note: We set the Click and Solo both with a node address value of 1. Since the Click will initiate all of the messages (Master) the node address is not used in the Click.
We can have 32 devices in our Modbus RTU network including the master. The maximum cable length is 1200m (4000 feet) without repeaters. The transmission rate depends on the wire and length. Longer wire runs require slow transmission (baud rate). If you suspect noise on your line then lowering your transmission rate may help you out.
Watch the video below to see the network time service in action on our Click Plus controller.

Slave Modbus Addresses

Modbus is a master/slave protocol. The master sends a request and the slave will respond to that request only. Addresses in the Modbus device are either 5 or 6 digits long. The Click will use a 6 digit Modbus decimal number. Here are the Modbus addresses that we will use in our sample program.
Click PLC Serial Communication Timing
The process value, setpoint, input range high, and input range low values will be read. Modbus addresses starting at 404097 to 404100 will be read. The beginning digit 4 gives a reference to the Modbus Holding Registers. See the links below for further information on Modbus.
Click PLC Serial Communication Timing
P, I, D, and the offset parameters will also be read into the Click PLC. These addresses start at 404106. This will demonstrate multiple reads in the PLC.
We will also write the setpoint value and input range values. This is possible because of the R/W indication meaning read and write.
Watch the video below to see the Modbus addresses being read and written in action on our Click Plus controller.

Click PLC Serial Port Programming

Our Click serial program will use two Receive Instructions to read the parameters mentioned above into the PLC. It will also use two Send Instructions to write the setpoint value and input limits. The writes will only happen when an internal signal is given in the PLC. So we will be constantly reading until a write is required. This is a good method so we can have control at the PLC/HMI or Solo directly.
Click PLC Serial Communication Timing
Our Solo serial communication will be in a separate subroutine which is called every scan. This is just for organization and readability purposes. The program will work also in the main program.
Click PLC Serial Communication Timing
Here is the timing chart for the receive instruction of the Click.
The enable will be a one-shot, leading-edge trigger. Since we are not using any other Receive or Send instruction on Port 3 at the same time, we will not have a delay.
We have three signals, receiving, success and error. Once we are not receiving then we can look at the success and error signals.
Click PLC Serial Communication Timing
The first scan of the PLC, end of communication timer, or communication reset timer will start our reading of the Modbus address 404097. We will read 4 consecutive addresses and place them in the PLC memory starting at DS1.
Communication flags (COM 1) receiving, success and error are then used for the next read instruction.
The reset is used for the sequencing bits for our communication.
Click PLC Serial Communication Timing
The COM 1 not receiving bit with the leading edge (one-shot) for the COM 1 success or error will then trigger the next read instruction.
COM 2 not receiving along with the leading edge of the success or error will set the Modbus reading done bit.
We will now write information using the Send instruction in the Click PLC.
Click PLC Serial Communication Timing
The timing chart for the send instruction is very similar to the receive instruction. We have the same three output bits that can be used in our logic for the timing of the communication.
Click PLC Serial Communication Timing
The change set value bit will control if the write operation is executed. If the Change SV Bit is on and the leading edge of Modbus reading done bit will then trigger the Send command. This will write the value in DS50 to Modbus address 404098 which is the setpoint value. COM 3 bits are then set.
Rung 5 will look for the COM 3 bits and set the Modbus write SV bit and reset the Change SV Bit. If the Change SV bit is off then the Modbus wire SV bit is set and the Change SV bit is immediately reset.
Click PLC Serial Communication Timing
This program will then cascade to the next write operation. Follow the logic that is similar to the above. The change limits bit will control if the information is sent or not.
Click PLC Serial Communication Timing
Once the write limits are complete, a timer delay of 100 milliseconds is used. This will allow the change to happen for the write bits to be set on with the software.
The output for the timer will then start the communication over again. Even with this small delay we are reading/writing the data from the Solo about 5 times per second.
Click PLC Serial Communication Timing
The last two rungs set up the overall reset of the communication. This is necessary if a cable gets unplugged or you use online programming. The timers when expired will start the communication again.

Watch the video below to see the serial communication timing in action on our Click Plus controller.

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.
Version 3.00
Version 2.60
The entire Click PLC series prior to the Click PLUS release can be found here.
All previous posts and information are still valid with the Click PLC line-up.
YouTube Click Playlist
YouTube Click PLUS Playlist
Click and Click PLUS PLC Overview
Click and Click PLUS PLC Videos from Automation Direct

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 Serial Communication Timing
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 PLCs 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. Arduino Uno Super Starter Kit Buzzers 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 *