0:03
90% of industrial automation systems use
0:05
modbus for communication this open
0:08
standard protocol is used for everyday
0:10
applications including monitoring and
0:11
controlling equipment such as plc's
0:14
programmable logic controllers remote
0:16
terminal units sensors and More in
0:18
Automation and process control
0:20
environments rs45 typically utilizes
0:23
twisted pair cables which consist of two
0:25
insulated copper wires Twisted together
0:28
this configuration helps to reduce
0:30
magnetic interference Emi and cross talk
0:33
from external sources ensuring a more
0:35
reliable signal over long distances
0:38
peer-to-peer or PTP communication is a
0:41
decentralized communication where two or
0:43
more devices connect directly to share
0:45
data or resources without needing a
0:48
server using modbus rtu serial protocol
0:52
we will connect two click plus PLC
0:54
through rs45 in a peer-to-peer fashion
0:57
we will share the following information
0:59
between the two p L C's 100 individual
1:01
bits IO or on and off which can be
1:04
written and read between the controllers
1:06
we will also share 10 words 16 bit each
1:09
these will also be written and read
1:12
between the plc's in this manner the
1:15
individual controls can see all the data
1:18
other the following summary table will
1:22
relationship let's get
1:25
started detailed information contained
1:27
in this video can be found at ACC
1:29
automation. a a link has been put in the
1:31
description below if you have not
1:33
watched the other videos yet there'll be
1:34
links in the description below that will
1:35
start you a video one they be links the
1:37
rest of videos in the series as
1:41
well wearing click PLC rs45
1:46
ports rs485 is a standard defining the
1:50
electrical characteristics of a balanced
1:52
differential Digital Signal system
1:55
commonly used for serial communication
1:57
industrial environments and
1:58
long-distance applications the physical
2:00
media for rs45 communication has several
2:05
characteristics twisted pair cabling
2:08
rs45 typically utilizes twisted pair
2:10
cables which consists of two insulated
2:13
copper wire Twisted together as
2:15
previously mentioned this configuration
2:17
helps reduce Electric magnetic
2:18
interference or Emi and cross talk from
2:21
external sources ensuring a more
2:23
reliable signal over long
2:25
distances balance differential signaling
2:28
the balance differential signaling used
2:30
in rs45 transmits data over two wires
2:33
often called A and B lines the
2:35
difference in voltage between the two
2:37
lines determines the binary data being
2:39
transmitted making it less susceptible
2:41
to noise and allowing for longer
2:43
communication distances up to 4,000 ft
2:47
more impedance the characteristic
2:51
impedance of rs45 cabling is typically
2:54
around 120 ohms matching the impedence
2:56
of the cable and the connectors is
2:58
critical to prevent signal Reflections
3:00
that can lead to data loss or
3:03
corruption termination resistors rs45
3:07
systems of to employ termination
3:09
resistance typically around 120 ohms at
3:11
both ends of the communication line to
3:13
reduce signal Reflections at the end of
3:17
runs shielding shielded twisted pair
3:20
cables can be used in environments with
3:21
high Electric magnetic
3:23
interference The Shield provides
3:25
additional protection against external
3:27
noises providing the reliability of data
3:30
although rs45 does not specify a
3:33
connector type standard options depend
3:35
on the application include DB9 db25 and
3:38
terminal blocks the choice of connector
3:41
can affect the ease of installation and
3:44
overall reliability of the
3:46
connection the physical media of rs45
3:49
communication is designed to enable
3:51
reliable and robust data transmission
3:53
over extended distances making it a more
3:56
popular choice in various Industrial
3:57
Automation applications
4:01
our click plcs have a terminal
4:03
connection on Port three of the CPU we
4:05
are wiring the plus terminal to the plus
4:07
terminal and the negative terminal to
4:09
the negative terminal using a twisted
4:11
pair cable two wires additional devices
4:14
can be physically wired by daisy
4:20
series click PLC plus client master
4:25
program call up the click programming
4:28
software we will now create a program to
4:30
control all the information on our rs45
4:32
modbus rtu Network select the connect
4:36
tab the connect to click PLC window will
4:40
displayed the program will look at your
4:42
network and Report the available PLC
4:44
Connections in our case we can see the
4:46
two different plc's there are three
4:49
connections because of the Wi-Fi setup
4:51
on the one PLC and the ethernet port on
4:54
both if you are unsure of the correct
4:56
connection select blank run and error
5:00
LEDs this will flash a light so you can
5:02
determine the PLC for the connected
5:08
connect the connection status will be
5:10
displayed at the bottom of the software
5:12
window we can also highlight our logic
5:14
by selecting the status icon on the Home
5:17
tab select comp Port setup under the CPU
5:21
icon on the Home tab this will open the
5:23
window displaying all available ports on
5:25
the controller select setup for Port
5:29
this is the rs45 communication Port the
5:32
port details will show you the setup for
5:35
communication the protocol will be set
5:37
for modbus we will leave the node
5:40
address as a default the parameters will
5:42
also be left as their default 38,400 bod
5:46
odd parody One Stop bit and eight data
5:49
bits we will also leave the advanced
5:51
configuration for timeouts and response
5:53
delays as their default select
5:56
okay on the Home tab under CPU select
5:59
system Sy configuration this will show
6:01
you the physical PLC and the associated
6:03
inputs and outputs we have
6:05
connected give this PLC a name under the
6:08
PLC name this will help us determine the
6:10
PLC we are communicating with in the
6:12
future we will name our ACC client
6:17
okay since we changed the configuration
6:20
we must write the program to our PLC
6:42
we can now save the PLC program with a
7:02
we will now start the ladder Logic for
7:04
our rs45 modbus communication right
7:07
click sub routine program in the
7:09
navigation window and select add new sub
7:11
routine program this can also be done by
7:13
selecting the shortcut Control Plus
7:15
U we can now name our new sub routine
7:18
communication rs485 will be used as our
7:22
name select okay a quick guide for a sub
7:25
routine program will be displayed select
7:30
the first one will have the first scan
7:32
SC2 used to trigger the first sand
7:37
instruction CPU Port 3 will be set for
7:40
our communication port for the send
7:42
instruction the protocol will be modbus
7:45
we previously looked at the comp Port
7:46
setup but if you don't know the
7:48
parameter set we can look at them again
7:51
button the slave ID for the serial
7:53
device will be set to one and we will
7:55
write multiple coils function code 15
7:59
click addressing will be used for the
8:02
type C1 will be the starting slave and
8:06
starting Master address we will write
8:10
information status Flags play an
8:12
essential role in the serial
8:13
communication method we will use these
8:15
flags to trigger the next communication
8:17
instruction the following communication
8:20
instruction Flags will be trigger the
8:21
next Etc here's a timing chart for the
8:26
command assign a bit to each status flag
8:28
and register for the communication
8:30
instruction status code we will use the
8:33
address picker to document these words
8:35
and bits which will help us to continue
9:15
Rong two will now be used the normally
9:17
closed sending flag with the Leading
9:18
Edge of the send success and send error
9:21
to trigger the receiving instruction
9:31
we do not care if the send was
9:33
successful we want to keep the
9:37
going the receive instruction will use
9:39
CPU Port three of the modbus protocol
9:42
with the slave address ID 1 we will read
9:44
the coil status using click addressing
9:48
the starting slave address will be c101
9:51
and the starting modbus address will
9:54
c101 just like the send command we will
9:56
read 100 bits of information
9:59
set and document the status Flags so we
10:01
can use them to trigger the next send
10:34
rung 3 will use the status flags from
10:36
the receive instruction to trigger the
10:37
next send instruction the normally
10:40
closed sending flag with the Leading
10:42
Edge of the send success or send error
10:47
instruction copy the previous send
10:49
instruction and we will change the
10:50
modbus function code to write multiple
10:56
16 10 Master addresses starting at DS1
10:59
will be sent to the slave address
11:03
DS1 status flags are set and documented
11:06
for the next receive instruction
11:37
the status fles from the previous
11:39
instruction send write register
11:42
instruction will trigger the final
11:43
receive read register
11:56
instruction copy the last received bit
11:59
and we will change our modbus function
12:01
code to the read holding register
12:04
03 the starting address for the master
12:06
and slave will be set for
12:08
ds11 we will read 10 words or register
12:12
addresses setting the status flags and
12:14
document for this instruction will
12:15
trigger the first send instruction at
12:32
remember to save your program often as
12:34
you program this will ensure you do not
12:36
lose any work if your computer
12:53
crashes place a return instruction at
12:55
rung five for our communication sub
12:57
rutine you can see that we are just
12:59
using the modb read and write commands
13:01
series the status flags from one
13:04
instruction trigger the next the final
13:06
instruction status Flags trigger the
13:08
first and we start the communication
13:10
again this method of communication
13:13
ensures the quickest system
13:15
response returning to our main program
13:17
under the navigation window we can use
13:19
the call instruction to execute the
13:21
communication sub routine every
13:24
scan save and write the program to The
13:41
click PLC plus server slave modbus rtu
13:49
program call up the click programming
13:53
software we will now create the program
13:55
to control all the information on our
13:57
rs45 modbus rtu Network on the startup
14:00
window select connect to PLC the connect
14:03
to click PLC window will appear the
14:06
program will examine your network and
14:08
Report the available PLC
14:11
Connections in our case we will see two
14:13
different plcs are existing ACC client
14:16
can be seen for our Wi-Fi and ethernet
14:18
connections there's also another PLC
14:20
with no name select this
14:22
controller if you are unsure of the
14:24
correct connection select blink run and
14:26
error lights this will Flash the light
14:29
so you can determine the PLC for the
14:31
connection selected select
14:34
connect we will read the PLC program in
14:38
controller the connection status will be
14:41
displayed at the bottom of the software
14:42
window we can also highlight our logic
14:44
by selecting a status icon on the Home
14:47
tab on the Home tab under CPU select
14:50
system configuration this will show you
14:52
the physical PLC and Associate inputs
14:54
and outputs we have connected give this
14:56
PLC a name under the PLC name this this
14:59
will help us determine the PLC we will
15:01
be communicating with in the future we
15:03
will name ours ACC server select
15:07
okay save the PLC program with a name so
15:10
we will remember it in the
15:21
save select comp Port setup under the
15:24
CPU icon on the Home tab this will open
15:27
the window displaying all available
15:29
ports on the controller select setup for
15:31
Port three this is the rs45
15:33
communication Port the port details will
15:36
show you the setup for the physical
15:38
communication the protocol will be set
15:41
modbus we will leave the node address as
15:43
the default one the parameters will also
15:46
be left as their default 38,400 bod odd
15:50
parody One Stop bit and 8 bit
15:53
communication we will also leave the
15:55
advanced configuration for timeouts and
15:57
response delays as their default
16:00
okay since we changed the configuration
16:03
we must write the project to our PLC
16:23
controller returning to the click client
16:26
we will stop and start the plc this will
16:29
start the communication with the first
16:30
scan flag you will now see the LED
16:33
lights blinking on our click
16:57
server monitoring The Click modbus rtu
17:00
rs485 network using data
17:05
view under the monitor heading in the
17:08
program tab select data view this is in
17:10
the click programming software
17:13
window right clicking this data view
17:15
window and selecting rename will allow
17:17
us to rename it double clicking on the
17:20
new title will display the data View
17:23
Window the data view window will display
17:26
we can now enter our bits and words we
17:28
want to monitor for the rs45 modbus
17:31
network if we need consecutive addresses
17:33
we can quickly enter them by selecting
17:35
the last address and pressing control
17:37
enter we will display 10 bits and words
18:03
finally we should save the program so
18:04
our data view information is
18:07
saved call up the data view information
18:09
for the click server on our modbus
18:11
Network enter the same address as the
19:04
as you write the bits and words in the
19:06
data view window for either the client
19:08
or the server the corresponding bits and
19:10
words will be changed in the other our
19:15
working however if communication is lost
19:18
the programs will no longer share
19:20
information and a controller will not
19:21
know how to recover the in continued
19:24
communication we will now examine how to
19:26
correct and program this
19:29
if you're enjoying this video please hit
19:30
the like button below keeping up with
19:33
all the latest automation Innovations
19:34
can be difficult so hit the Subscribe
19:36
button remember to hit the Bell beside
19:38
your subscription to actually receive
19:43
notifications creating a heartbeat for
19:51
Communications a heartbe bit will pulse
19:53
on and off on our Network for a Time
19:55
duration this can be used to determine
19:57
if Communications or working or not our
20:00
herbe bit will turn on for one complete
20:02
send and receive instruction sequence
20:04
and then turn off for another complete
20:07
send and receive instruction
20:10
sequence we will add this heartbeat bit
20:12
pulse at the end of our communication
20:15
routine when the Leading Edge of our
20:17
last communication instruction is
20:19
triggered this will set an internal bit
20:35
when this internal bit is on and the
20:37
heartbeat bit c100 is on c100 and C 1900
21:06
when it's internal bit is on and the
21:07
hary bit c100 is off set c100 and reset
21:36
as you can see the heartbeat bit will be
21:38
triggered on and off with the Leading
21:39
Edge or our last communication send
21:48
flag using the address picker and the
21:50
click programming software we can
21:52
document the heartbeat and work bits for
22:49
returning to the click server program we
22:50
can program the heartbeat bit logic we
22:53
will use a timer to determine the
22:54
communication throughput on our modbus
22:56
rs45 Network and weather communication
23:06
lost the trailing edge of the heartbe
23:08
bit will copy the timer representing the
23:11
communication throughput into our
23:19
ds100 the c100 harpy bit will then be
23:22
used to determine the condition for
23:24
timer one which will have a set point of
23:26
10,000 milliseconds or 10
23:44
seconds the communication output error
23:46
will be activated when the last
23:48
communication timer is greater than 200
24:00
remember to save and document as you
24:01
program the controller
24:58
our heartbeat circuit for our server now
25:01
counts for when the heartbeat bid is on
25:03
we must also create Logic for when this
25:06
off when the c100 heartbeat bti is off
25:09
it controls a second timer with the same
25:19
first if this timer exceeds 200
25:21
milliseconds the output aor bit will
25:27
on document save and transfer the click
25:30
modbus rs45 server program to the
25:55
controller when testing the heartbeat
25:57
circuit up the server PLC we can
25:59
disconnect the rs45 communication and
26:02
the output will turn on indicating an
26:11
error putting back the connection will
26:13
restore the communication
26:29
monitoring and resetting the modbus
26:34
communication our current click client
26:37
program starts only on the first scan
26:38
bit we will modify it to detect a
26:40
communication error and reset it using
26:42
two timers we will start the first timer
26:45
using the knot of the last sen bit flag
26:47
instruction and the second timer each
26:50
timer will have a preset value of a
26:52
th000 milliseconds or 1 second
27:03
the output of the first timer will start
27:14
timer we can document the timers using
27:16
the address picker in the click
27:18
programming software
27:37
we can now add the Leading Edge contact
27:39
of our first timer on the first Runk
27:41
when the communication sequence does not
27:43
execute within 1 second this bit will
27:45
trigger starting the communication
27:48
again the second timer is used to
27:50
continuously every 2 seconds 1 second is
27:53
for the first timer and then this 1
27:55
second is for the second timer we can
27:58
save and transfer our program then
28:00
moving back to the main program of our
28:02
client code we can add our program to
28:03
turn on an output when we detect the
28:12
error if the first timer expires we will
28:18
output document and transfer the program
28:43
we can call up both the DAT view windows
28:44
are both click programs and test our
28:55
Communications if you found this video
28:57
helpful check out our other videos on
28:59
PLC programming and don't forget to
29:00
leave our questions and comments
29:10
below zal communication over rs45
29:13
provides a versatile and robust solution
29:15
for industrial communication it
29:17
facilitates interruptibility between
29:20
various devices and ensures reliable
29:22
data communication over long
29:24
distances we have learned the importance
29:26
of modbus rs45 in PLC communication and
29:34
effectively The Click PLC now has a
29:36
mobile app for control learn how this is
29:40
here our entire series on the click PLC