00:00:02
hello everyone
00:00:03
in this video i would like to show how
00:00:05
can we use the siemens plc
00:00:08
i7 1200 controller run
00:00:11
as a modbus tcp client the modbus tcp
00:00:14
master function
00:00:16
to connect with one modbus tcp slave
00:00:19
to build up this modbus tcp connection
00:00:22
and i will use one actual controller for
00:00:25
this test
00:00:26
so this is the ti portal version 16 and
00:00:29
let's click this add a new device and in
00:00:32
this test
00:00:32
i will use one lowest controller that is
00:00:35
a 12
00:00:36
11 this is the lowest controller from
00:00:39
this
00:00:39
1200 series controller and my controller
00:00:43
that is the latest version version 4.4
00:00:46
basically to implement the modbus tcp
00:00:49
all those new version their function
00:00:51
they are the same
00:00:53
okay so this is my controller but keep
00:00:56
in mind because this is a 1211
00:00:58
that is the lowest controller here so it
00:01:01
only has a 50kb work memory
00:01:03
so after we implement this modbus tcp
00:01:05
client function
00:01:07
so we can see how large vocal memory it
00:01:09
will take
00:01:10
within this controller okay let's click
00:01:13
okay
00:01:14
okay this is the hardware wheel so
00:01:16
firstly we can double click this
00:01:17
ethernet port
00:01:20
and we can set the ip address for this
00:01:22
controller
00:01:24
so we can active this stop night and we
00:01:27
can set the ip address
00:01:29
for this controller so in this test this
00:01:32
s7 1200 controller is ip address is a
00:01:35
192 168.1.201
00:01:40
and the motorbox tcp server side i will
00:01:43
use my laptop
00:01:44
and i will use the software moto sim run
00:01:47
as a modbus tcp
00:01:49
server and my laptop the ip address is
00:01:52
1.10
00:01:54
and this plc is a 201
00:01:58
okay and after we set up this ip address
00:02:01
so we need to switch to this system
00:02:03
constant let's look at one value here
00:02:06
so this is the hardware interface one id
00:02:09
number
00:02:10
shown here so it shows 64 the integer
00:02:13
that is 100
00:02:15
this represents this hardware address so
00:02:18
when we use the modbus ttp programming
00:02:20
so when you use this
00:02:22
number 64. so let's record here
00:02:25
okay now we can shift to the programming
00:02:27
side so
00:02:28
expand here program blocks
00:02:31
from this ob1 we can double click okay
00:02:34
from here we can click this add a new
00:02:36
block
00:02:37
let's create a function and within this
00:02:40
function
00:02:41
we can program the motorbike tcp client
00:02:44
click this and we can name it and
00:02:47
we can rename this number for example we
00:02:49
can name it
00:02:51
10 number we will use the letter logic
00:02:54
okay click ok
00:02:59
and then go back to the main and then go
00:03:04
back to the main
00:03:05
we can drag this fc into the
00:03:08
well of the network within this ob1 our
00:03:11
program will be within this
00:03:12
fc10 okay and
00:03:16
to implement the modbus tcp we can go to
00:03:19
the right side
00:03:20
find out the instruction
00:03:24
so we can expand this communication from
00:03:27
this communication
00:03:28
let's open this others and this modbus
00:03:32
tcp
00:03:33
here and because we are using the
00:03:36
built-in ethernet port from this
00:03:38
controller
00:03:39
to implement the modbus tsp so that's
00:03:42
why we grab this uh
00:03:43
function block from this folder if you
00:03:46
expand here communication processor here
00:03:50
you can still find the motorbox rtu or
00:03:52
modbus here
00:03:54
this is a little bit confused that's why
00:03:56
it's called
00:03:57
communication processor if your
00:03:59
controller
00:04:00
has other module that's specially
00:04:03
communication module
00:04:04
so that will use this function block but
00:04:07
we are using the built-in
00:04:09
ethernet port to implement the modbus
00:04:12
tcp
00:04:12
that's why we are using this keep in
00:04:15
mind this
00:04:16
so to run the modbus client or the
00:04:19
master function
00:04:20
so we need to use this function block
00:04:22
drag to here
00:04:23
okay so and here we can select this menu
00:04:27
and we can name it this is the one zero
00:04:29
one so this is the instant
00:04:31
db number let's name modbus client db
00:04:35
name it as underscore one
00:04:38
or we can name it this is a read i will
00:04:41
explain
00:04:42
this after
00:04:45
okay here we can write the comments here
00:04:49
and this is the ifc03 read
00:04:52
so okay okay
00:04:56
if this is the first time for you to
00:04:57
implement this function this will be a
00:04:59
confused for you
00:05:00
especially for the live side please
00:05:02
follow me i will show how can we do this
00:05:05
okay let's firstly set up one db that's
00:05:08
for this connection so here we can
00:05:12
come here add a new block
00:05:15
and click this datadb tcp
00:05:20
connect okay and this
00:05:23
number could be 10 okay
00:05:26
connect
00:05:30
okay here we can name it
00:05:33
i'm b tcp client the read
00:05:38
okay and keep in mind this state type is
00:05:41
very important
00:05:42
so we need to type in tcom underscore ip
00:05:45
underscore
00:05:46
v4 so keep in mind we must type in this
00:05:50
and once we type in this it will
00:05:51
automatically create
00:05:53
this data type okay and
00:05:56
and here we need to type in for this
00:05:59
function block
00:06:00
so this interface if we record
00:06:03
this interface represent which ethernet
00:06:06
port
00:06:07
we need to communicate i showed from the
00:06:10
hardware that port number
00:06:12
is 64.
00:06:15
here it shows hweny that is
00:06:18
the hex that they type so if by accident
00:06:22
you type in 100 if you saw that is an
00:06:25
integer you type in 100
00:06:27
so after that so when we set up the
00:06:29
connection you will see the tco
00:06:32
set of the connection will show a09
00:06:35
default
00:06:36
so i will show this after so i would
00:06:38
simply type in 100 i will show this
00:06:40
fault
00:06:41
and this id number we can set this is
00:06:44
the first one we can set the number one
00:06:46
and for this connection type here we
00:06:49
will type in the 11 because we are using
00:06:51
the motorbox tcp
00:06:53
the background is still using the tcp
00:06:56
here
00:06:56
11 we need to type in here but also we
00:06:59
can type in the hex number here that is
00:07:01
a zero b
00:07:02
so we can leave this as zero b as a
00:07:04
default
00:07:05
okay or we can type in again 16
00:07:09
upon zero b okay
00:07:12
that is 11 this data and this active
00:07:15
established we can set to one because
00:07:18
this is a client
00:07:19
so this client need to active to set up
00:07:22
the communication
00:07:24
so here the remote address we can set
00:07:26
the address
00:07:27
so that is the server ipf device if
00:07:30
my client ip address is 192 168.1.101
00:07:36
so we need to type in here let's explain
00:07:43
and in this test my laptop ip address is
00:07:46
192
00:07:48
168.1.101
00:07:50
so here i will type in the hex number
00:07:53
i will use this calculator transfer to
00:07:56
hex number
00:07:57
okay and type in here
00:08:06
101 hacks that's a 65
00:08:10
so this is a remote this is the server
00:08:13
side ip address keep in mind this
00:08:15
and the remote port so we will use five
00:08:18
zero one
00:08:21
this is anzac this is the enzyme this is
00:08:24
enzyme integer so we will type in 502
00:08:28
here
00:08:28
the port will be used 502 okay the local
00:08:31
port we can use as a default
00:08:33
okay remote is very important okay keep
00:08:36
in mind this
00:08:37
okay this is a setup connection
00:08:39
parameter
00:08:40
okay and keep in mind all those
00:08:44
parameters
00:08:45
we are under this modbus tcp client read
00:08:49
this line here and then we can float
00:08:53
here
00:08:53
click this button and go back to this
00:08:57
function here and we can drag
00:09:01
this variable to here release
00:09:04
this basically transfer those parameters
00:09:07
to this connection here
00:09:09
okay and then
00:09:12
the mode bus mode so let's check out the
00:09:14
detail explanation for this
00:09:16
let's click this function block and hit
00:09:19
the iphone
00:09:21
okay this is the motorbike client
00:09:23
function explanation here
00:09:25
so we can see req that's the trigger
00:09:28
function
00:09:29
every time we trigger so we will trigger
00:09:31
the client
00:09:33
to read or write the data to the server
00:09:35
side
00:09:36
disconnect that's just enable or disable
00:09:38
if we set one we will disconnect the
00:09:41
communication
00:09:42
okay and this motorbox mode this is
00:09:45
very important if that is a zero that is
00:09:48
the read
00:09:49
if this is 1 that is right keep in mind
00:09:52
this is the enzyme
00:09:54
integer value here okay and
00:09:57
here that is the motorbus address if you
00:09:59
require motorbikes address that is a
00:10:01
1400
00:10:03
for example forty thousand one forty
00:10:05
thousand two
00:10:06
that is a motorbike address and this is
00:10:09
motorbikes lens
00:10:10
that means how long the data the data
00:10:12
register we need to read or we need to
00:10:14
write
00:10:15
okay and this modbus data pointer
00:10:18
that means after we read or write the
00:10:21
data
00:10:21
to the server modbus server side so
00:10:24
where we need to locate the plc data
00:10:27
this will assign the plc data here
00:10:30
okay so let's go back and let me program
00:10:33
so firstly this motorbox mode i will
00:10:36
directly type into the zero
00:10:38
zero means this function block will run
00:10:40
the row to read the data from the server
00:10:43
to this client side okay and modbus data
00:10:47
address
00:10:47
will start from the forty thousand one
00:10:49
so we're typing here directly
00:10:51
forty
00:10:56
okay this is the motor bus address this
00:10:58
is a start address and the lens
00:11:00
for example we will communicate read
00:11:04
20 register back okay
00:11:07
and this is the data we need to store
00:11:09
the data
00:11:10
so we need to create another db so
00:11:13
double click
00:11:15
click this data block click this data
00:11:17
block
00:11:18
and let's change the name this is a
00:11:20
modbus tcp
00:11:23
read so this is the motorbox tcp data
00:11:26
okay and this number we can follow this
00:11:30
number for example next one will be 11.
00:11:32
okay all right and here we can create a
00:11:37
buffer
00:11:37
so we can create read just the name as a
00:11:41
read
00:11:42
and this date type we can create array
00:11:45
the array less that is the word because
00:11:48
we are going to use the function 0 3 or
00:11:51
16
00:11:52
and the function 0 3 and 16 read or
00:11:55
write
00:11:56
will operate the word one register that
00:11:58
is one word
00:11:59
so we will create one array array
00:12:02
so like this style click and the array
00:12:07
we can start from the 1 and
00:12:11
120 this less
00:12:14
and because this is the data too easy to
00:12:17
operate the data
00:12:18
this buffer so personally i will
00:12:21
recommend
00:12:22
from here right click click this
00:12:24
properties
00:12:26
and go to the attributes and uncheck
00:12:29
this
00:12:30
optimize the block size so that's some
00:12:32
special case
00:12:33
we can use this transitional way and we
00:12:36
can
00:12:37
use this offside this absolute position
00:12:40
once we got a compile for example if i
00:12:43
compile here
00:12:44
after we uncheck the optimization
00:12:48
so this db will show the absolute
00:12:50
address here
00:12:51
it's very easy for us to operate
00:12:53
especially if we want to set one bit in
00:12:56
one word
00:12:57
so to use this we can drag
00:13:00
this db read to this modbus data
00:13:04
pointer
00:13:07
okay we can drag to here this is read
00:13:10
because we are using this modbus mode 0
00:13:13
means we are using the modbus tcp
00:13:15
function 0
00:13:16
3 that is reading the data from the
00:13:19
server
00:13:20
side to the client side okay
00:13:23
disconnect done busy arrow so we will
00:13:26
type in some template data
00:13:28
for example we can come here
00:13:31
and we can create some tags here
00:13:36
so we can add a row disconnect
00:13:40
that is a bool
00:13:46
so i will create the same name as the
00:13:48
interface of this ifb
00:13:51
while using those variables we can look
00:13:53
at the actual status
00:13:54
from this client connection busy
00:14:02
done and disconnect
00:14:06
okay by default this value is a zero
00:14:09
so that we do not need to disconnect is
00:14:12
a function
00:14:13
and this trigger signal here every time
00:14:16
we give a trigger signal it will send
00:14:18
so we can use one function from our
00:14:21
controller
00:14:22
if we double click this device
00:14:24
configuration
00:14:27
double click this controller property
00:14:34
and we scroll down here the system clock
00:14:37
if we enable this to checkbox
00:14:44
so for example if we are using this
00:14:47
onehurst clock
00:14:49
if we directly use this m05 one hertz
00:14:53
so we can directly use that okay
00:14:56
if we go back we will use onehurst
00:14:58
trigger
00:14:59
so at this req here we can directly type
00:15:02
in this i'm
00:15:03
0.5
00:15:07
okay it will show clockwise once we
00:15:10
download this controller it will run one
00:15:12
of us
00:15:12
this m address will automatically
00:15:14
controlled by the controller
00:15:16
okay here we set up this connection but
00:15:20
now
00:15:20
actually we only build up one direction
00:15:23
data
00:15:23
this is read the data from the server
00:15:26
side
00:15:27
to the client side now if i save this
00:15:30
project
00:15:31
and the compile
00:15:35
and now this is only one direction
00:15:37
reading the data from the server
00:15:39
to the modbus client this plc site and
00:15:42
now let's look at this uh
00:15:44
program info only use this one direction
00:15:48
modbus tcp client
00:15:49
let's see and now it takes 8k
00:15:53
bytes keep in mind this vocabulary
00:15:56
for this small controller it already
00:15:58
took 17
00:16:00
on this controller because totally it
00:16:02
only has a 50k
00:16:04
bytes here so this size is a reference
00:16:08
okay so here let me explain a little bit
00:16:11
more
00:16:11
so as we know from this port motor box
00:16:14
mode
00:16:15
zero that means reading reading the data
00:16:18
from the server to this client
00:16:19
if i read one so we can write the data
00:16:22
from this client
00:16:23
to the server side some cases some
00:16:26
people will assign
00:16:27
one variable here so we can switch this
00:16:30
to zero or one
00:16:32
and also associated with this uh req
00:16:35
this command so we can use one function
00:16:38
block here
00:16:39
and one instant db to implement the
00:16:41
reading
00:16:42
and the writing then no problem that can
00:16:45
save the cpu work memory
00:16:47
however there will be a little bit
00:16:49
complex problem
00:16:50
here as we know when we're reading or
00:16:53
writing the data
00:16:54
communicating with the server side this
00:16:56
buffer we are sharing
00:16:58
used for the reading of writing so we
00:17:01
need to very carefully about the switch
00:17:03
in the data buffer
00:17:04
so we need to prepare the data for the
00:17:06
sending and after we read
00:17:08
we need to transfer this buffer to a
00:17:11
read back buffer
00:17:13
so this is really annoying so personally
00:17:16
if we are using a higher end controller
00:17:19
and if you have enough space i recommend
00:17:22
you use two function block and use the
00:17:24
different instant db
00:17:26
i will show after so this function block
00:17:29
especially served for the reading
00:17:31
and this is the read buffer and next one
00:17:34
we will set
00:17:35
one and that buffer is specially used
00:17:37
for writing
00:17:39
okay so let's do that so next one
00:17:43
communication let's drag the next one
00:17:45
this client
00:17:46
because i'm using the ti portal version
00:17:48
16
00:17:49
so the latest version now that is a
00:17:52
version 5.2
00:17:54
okay and i will drag this client again
00:17:59
drag to here pop off this instant db
00:18:02
so click this a single instant because
00:18:05
we are using the fc to code them
00:18:06
okay so i have to use this a single
00:18:08
instant select this uh menu
00:18:11
and this time this is a one zero two
00:18:14
okay
00:18:15
i will rename this instant db motorbox
00:18:18
client db right okay and
00:18:21
i will select this number one zero two
00:18:25
so here i will write this comment modbus
00:18:27
tcp client
00:18:28
master fc16 here right
00:18:32
so to implement this i've seen 16 right
00:18:35
so
00:18:35
the modbus mode here i will write one
00:18:38
one means write the data and
00:18:42
this req here so
00:18:45
we can use here we can click this
00:18:49
we can use this signal is on or when
00:18:51
it's off
00:18:52
to trigger the modbus client reading and
00:18:56
writing and when this signal on we can
00:19:00
read the data
00:19:01
and once off we can write the data okay
00:19:05
so we can use a similar way program like
00:19:07
this way
00:19:08
so when the signal on it will trigger
00:19:10
reading
00:19:11
and this off this will trigger this
00:19:14
writing
00:19:14
and then let's config this connect so
00:19:18
let's open this db10 this motorbike ccp
00:19:20
connect
00:19:22
and let's create a second one that is a
00:19:24
modbus tcpa client
00:19:26
right okay actually we can copy this
00:19:30
copy paste
00:19:34
rename that as a write okay
00:19:38
the date type keep in mind the date type
00:19:40
still tcom ipv4
00:19:44
and this id number we're still using the
00:19:47
same
00:19:48
hardware port that's the 100 integer
00:19:50
number
00:19:51
so 64. and this id we can change the
00:19:55
second one
00:19:56
okay keep in mind id number while using
00:19:59
the different id number
00:20:01
so connection type is still the tcp
00:20:05
so connection type still the tcp 0b
00:20:09
that is 11 okay and active
00:20:12
established still the active side that's
00:20:15
one and the remote address this is this
00:20:18
so the ip address 192 168.1
00:20:23
one zero one okay and this is remote
00:20:26
port
00:20:27
that's still five zero two okay
00:20:30
and then fully in the similar way we
00:20:32
will declare
00:20:33
some port here
00:20:38
okay we declare here then we can drag
00:20:41
them
00:20:42
to this function block
00:20:46
okay and then this modbus address
00:20:49
so when we read the data from the
00:20:51
motorbox server side
00:20:53
so that address we start from the forty
00:20:55
thousand one
00:20:56
and the less we set the temp here and
00:20:59
the reading we can start from the 4020
00:21:03
and this lens still can be the 10 okay
00:21:06
so here
00:21:06
we can type in 40 000 40 021
00:21:11
okay and the less we can this is 10
00:21:15
and then this connect so we can drag
00:21:17
this uh
00:21:18
modbus tcp client right based on this
00:21:21
data type we can drag to here
00:21:25
okay and this plc local buffer
00:21:29
so we need to declare one new buffer
00:21:31
that is the right buffer
00:21:33
so we double click this db11
00:21:36
we can create a new line here and we can
00:21:41
name it right
00:21:45
so that's the array 1 to 120
00:21:48
word here okay
00:21:51
flow it come here we can drag this
00:21:55
right to this port
00:21:58
okay and because this db that is a
00:22:02
non optimization db so by default it
00:22:05
shows question mark here
00:22:07
and once we compile it it will show okay
00:22:10
so let's compile and now we have a two
00:22:13
function block here why especially for
00:22:16
reading the data from server to the
00:22:18
client one is
00:22:19
writing the data from the client to the
00:22:22
server
00:22:22
okay and because we just programmed this
00:22:25
a second
00:22:26
function block and now let's check out
00:22:28
this program info
00:22:30
it basically take a 10.5 k bytes
00:22:33
within this work memory so for this
00:22:36
smallest controller
00:22:37
12 11 it takes 20 on the work memory
00:22:41
so this value can be a reference for you
00:22:44
okay
00:22:44
okay now we can download this controller
00:22:51
okay so the software we found this so we
00:22:54
can download
00:22:58
okay let's start this controller
00:23:01
so our plc will be started and to test
00:23:04
the data we can use the watch table
00:23:07
and let's create one watch table
00:23:11
and and here we can open this db
00:23:14
so our actual data is within this read
00:23:17
and write
00:23:18
right so we can drag part of those data
00:23:21
for example the reading
00:23:22
so so we can drag the 15 buffer
00:23:27
to this watch list
00:23:30
okay and here
00:23:35
we can drag the right 15
00:23:39
here the lens we set the 10 so we drag
00:23:42
15 that will be
00:23:43
enough okay next let's use the model sim
00:23:47
software
00:23:47
run as a motorbike tcp server so to
00:23:50
download the software
00:23:52
we can browse this website wintac.com
00:23:55
and browse this model sim 64
00:23:58
this software that run as a modbus tcp
00:24:02
server software okay
00:24:06
okay after we download the model sim 64
00:24:09
this version so we can double click this
00:24:13
and this is the demo software okay so
00:24:16
click ok
00:24:20
click ok
00:24:23
click ok and we can set up this server
00:24:30
okay
00:24:32
and the address we can start from one
00:24:35
and the connection we can select this
00:24:37
motorbike tcp is server
00:24:40
and the port that's the 502 and my
00:24:43
laptop is 192 168.1.101
00:24:49
so my my laptop will run as a motorbox
00:24:52
tcp server
00:24:53
okay so it ready here so this is the plc
00:24:57
side
00:24:58
and let's look at the current status
00:25:00
from this function block
00:25:01
so it shows arrow and the code shows a09
00:25:05
b
00:25:06
so we can search this code
00:25:09
so we can find out i've one
00:25:12
and after we search this code a09b
00:25:16
and we can find out basically this code
00:25:18
come from the local device id
00:25:20
setting so if we go back
00:25:23
our program and we double click
00:25:27
this problem come from one second from
00:25:29
this connect
00:25:30
so that can now come from the db10
00:25:32
double click
00:25:34
and this sighting setup connection
00:25:37
setting
00:25:38
so if we expand here and we click this
00:25:41
online
00:25:42
click this online now the value shows
00:25:45
100 here
00:25:47
here we need to set 64 direct
00:25:50
to this hw so that is a direct
00:25:54
hex number here so and here we need to
00:25:57
type in
00:25:58
the direct 64.
00:26:01
so we can also change here 64.
00:26:04
we can change there 64. and we can
00:26:08
change this
00:26:08
also change for 64. so keep in mind
00:26:12
this and this number come from the
00:26:15
device configuration
00:26:17
if we double click this uh port click
00:26:20
this assistant
00:26:21
constants and this is the interface
00:26:23
number 64 is here
00:26:25
we directly type this 64
00:26:28
to here okay so let's download this new
00:26:32
setting
00:26:35
okay now we haven't set up this client
00:26:38
yet so it shows seven zero zero two okay
00:26:41
now click this new
00:26:46
and let's select this motorbox tcp
00:26:50
server
00:26:52
now let's set this address we start one
00:26:55
and here the device id for the siemens
00:26:58
by default
00:26:59
we need to set this device id to 255
00:27:02
here okay we need to cite a 255 here
00:27:07
i will explain this after and now let's
00:27:10
click this uh watch table click this
00:27:14
monitor and this is our read buffer and
00:27:17
the right buffer
00:27:18
and now from this forty thousand one so
00:27:21
we can double click
00:27:23
and this is the and this is the decimal
00:27:26
so we can type in one two three four
00:27:29
so we can see the hex number is
00:27:31
receiving here
00:27:32
so we can change this scale into the hex
00:27:35
so
00:27:36
we can switch to the hex now we can see
00:27:39
42 we received there so next one
00:27:42
we can type in aabb
00:27:46
so we can see aabb received here and
00:27:49
from this right area
00:27:51
hex number here we can write three three
00:27:54
four four
00:27:55
for example right enter
00:27:58
and transfer so we can see three three
00:28:02
four four
00:28:02
we start from the 21 it received here
00:28:06
so three zero four so from the client i
00:28:08
write this three three four four
00:28:10
to this server so next value
00:28:13
one one two two right
00:28:17
so one one two two here so because we
00:28:20
write
00:28:20
ten values so we can test this ten
00:28:24
so write c c d d and next one we can
00:28:27
specially test this c eleven this 11
00:28:29
shouldn't send to this
00:28:30
server so
00:28:34
we can transfer so this lens will send
00:28:37
the 10
00:28:38
register so we can see only cctd here
00:28:42
we send to here and this eeff
00:28:45
because that is the 11th so this e iff
00:28:49
will now be sent so we can see the value
00:28:51
can be read from this
00:28:53
server to this client correctly and this
00:28:56
value can write
00:28:57
from this client to this server
00:28:59
correctly
00:29:00
and this device id is very important
00:29:04
if now i use this default for example
00:29:07
one if now i write the data here
00:29:10
for example if i rewrite this data if i
00:29:13
said this is 3 here
00:29:15
let's say 1 1 2 2.
00:29:18
so we can see this value we write here
00:29:21
and here it doesn't show up if i write a
00:29:24
new value
00:29:25
to here one two three four
00:29:31
so we can see the one two three four
00:29:33
cannot send correctly here
00:29:35
so let's explain this device id here and
00:29:38
let's open one instant db okay
00:29:41
for example this db101
00:29:45
we open it and
00:29:48
from this instant db if we click this
00:29:52
monitor and there's one value
00:29:55
here it shows motorbox unit id
00:29:59
for the modbus tcp communication
00:30:02
sometimes
00:30:03
it will care about this some modbus tcp
00:30:06
server devices
00:30:07
they will not care about this uid number
00:30:10
but some wonder or some manufacturer
00:30:12
when they provide these devices inside
00:30:15
the devices might be the one
00:30:17
or the i5 in siemens this number default
00:30:21
that is i5
00:30:22
255. you can write this value to 0 or to
00:30:27
1
00:30:27
to match with your server side and
00:30:30
in this case for example if now i write
00:30:34
this value to 1.
00:30:39
that is a the hex one but the integer
00:30:41
also
00:30:42
equal to one right also
00:30:46
we can minimize this and open this
00:30:49
next instantdb
00:30:52
open monitor
00:30:57
and right here we can write to one
00:31:02
okay and keep in mind this value will
00:31:05
now be retained
00:31:07
so we can use the move directly right
00:31:10
this imb
00:31:11
unit id so let's temporarily test that
00:31:14
first
00:31:14
so we write one now let's go back to the
00:31:17
server side
00:31:19
so once we shift here so we can see this
00:31:22
one two three four
00:31:23
wrote correctly now if we're using the
00:31:26
device id
00:31:27
one because we change that to instant db
00:31:30
change to one okay so if i change the
00:31:33
value to do a verification here
00:31:35
let's do seven eight nine four
00:31:39
so right so we can see now it's
00:31:42
communicating correctly
00:31:44
now if i give a new value from this
00:31:46
server side let's say abcd here
00:31:50
we can see abcd read correctly from this
00:31:53
client side
00:31:54
so we are using one because we change
00:31:56
that unit id
00:31:57
from this client side so that means we
00:32:00
set up this
00:32:01
motorbike ccp communication correctly
00:32:04
all right
00:32:04
as we discussed since the unit ide
00:32:07
cannot be retained
00:32:09
inside the instant db so we better
00:32:12
use this move directed write the value
00:32:15
into the unit id
00:32:17
we will run this one to that unit id
00:32:20
so we can open this instant db
00:32:23
how to open it so we can go to the
00:32:25
system block
00:32:28
and this two eastern db one is one zero
00:32:32
one
00:32:33
y is one zero two right so here from
00:32:36
this
00:32:36
system block open this or db101
00:32:40
and we can flow that here
00:32:44
scroll down so find out this modbus unit
00:32:47
id here
00:32:49
we can see default start value that is
00:32:51
the i5
00:32:52
so we can drag it to here
00:32:56
okay so using this way we can write this
00:32:58
one to this unit id
00:33:00
okay so using this way we can directly
00:33:03
write this
00:33:04
instant db okay and we can write the
00:33:07
commas here
00:33:08
so this is the unit id
00:33:11
okay that is the motorbox tcp client
00:33:14
function
00:33:14
in the siemens i7 1200 plc
00:33:18
the i7 1500 plc there will be the same
00:33:21
and basically from this program the
00:33:24
reading and the writing
00:33:25
this tool function block we can use this
00:33:28
project as a template
00:33:30
all right that is for today thank you
00:33:31
for watching thank you for watching
00:33:34
if you like this video please give me a
00:33:35
thumb up if you like to watch more
00:33:37
videos in my channel
00:33:39
please subscribe and hit the bell thank
00:33:41
you for watching