![background image](http://html.mh-extra.com/html/omron/sysmac-cp-series/sysmac-cp-series_user-manual_742262383.webp)
15-53
15 Ethernet
CP2E CPU Unit Software User’s Manual(W614)
15-5 Soc
ket Ser
vic
es
15
15-5-7 Soc
k
et/T
CP Prog
ramming Example
Note
When using the above programming example, change the bit and word addresses as necessary to avoid
using the same areas used by other parts of the user program or the CPU Bus Unit.
TCP Receive
TCP
S
end
MOV(021)
#1
D16008
W0.02
MOV(021)
#64
D16013
W2.02
W0.03
S
ET
A571.04
R
S
ET
W2.03
W2.03
W0.03
S
ET
W1.03
W2.03
A571.04
<>(305)
D16017
#0
W0.02
R
S
ET
W0.02
W2.02
A571.03
W0.03
@R
S
ET
W1.03
@
S
ET
W2.03
W0.02
@
S
ET
W1.02
W2.02
A571.03
<>(305)
D16017
#0
W0.02
S
ET
A571.03
R
S
ET
W2.02
W2.02
W0.03
R
S
ET
W0.03
W2.03
A571.04
MOV(021)
#8200
D16014
MOV(021)
#0
D16015
MOV(021)
#1
D16008
W0.03
MOV(021)
#64
D16013
W2.03
MOV(021)
#8200
D16014
MOV(021)
#0
D16015
MOV(021)
#0
D16016
W0.02
@R
S
ET
W1.02
@
S
ET
W2.02
A567.13
=(300)
D16000
&100
When the TCP
S
end Bit (W0.02) t
u
rn
s
ON, the TCP
S
end Error
Fl
a
g (W1.02) i
s
t
u
rned OFF
a
nd the TCP
S
ending Fl
a
g (W2.02) i
s
t
u
rned ON to initi
a
lize proce
ss
ing.
When the TCP
S
ending Fl
a
g (W2.02) t
u
rn
s
ON, the following
p
a
r
a
meter
s
a
re written to the p
a
r
a
meter
a
re
a
for
s
ocket n
u
m
b
er 1
D16008: 0001 Hex = UDP/TCP
s
ocket No. 1
D16013: 0064 Hex = No. of
s
end/receive
b
yte
s
i
s
100
D16014
a
nd D16015:
8200 0000 Hex =
S
end/receive d
a
t
a
a
ddre
ss
D00000
After the p
a
r
a
meter
s
h
a
ve
b
een
s
et, the
S
end Re
qu
e
s
t
S
witch
(A571.03) i
s
t
u
rned ON
a
nd the TCP
S
ending Fl
a
g (W2.02) i
s
t
u
rned OFF.
If the
S
end Re
qu
e
s
t
S
witch (A571.03) t
u
rn
s
OFF while the TCP
S
ending Fl
a
g (W2.02) i
s
OFF, the content
s
of the re
s
pon
s
e code
(D16017) in the
S
ocket
S
ervice P
a
-r
a
meter Are
a
i
s
checked,
a
nd
if it i
s
not 0000 Hex (norm
a
l end), the TCP
S
end Error Fl
a
g
(W1.02) i
s
t
u
rned ON.
After the exec
u
tion re
su
lt
s
h
a
ve
b
een checked, the TCP
S
end Bit (W0.02) i
s
t
u
rned OFF.
When the TCP Receive Bit (W0.03) t
u
rn
s
ON, the TCP Receive
Error Fl
a
g (W1.03) i
s
t
u
rned OFF
a
nd the TCP D
a
t
a
Received/Re
qu
e
s
ted Fl
a
g (
A567.13),
a
nd the N
u
m
b
er of Byte
s
Received
a
t TCP
S
ocket (D16000)
a
re checked. If the d
a
t
a
i
s
s
tored
in the
bu
ffer, the TCP Receiving Fl
a
g (W2.03) t
u
rn
s
ON.
When the
TCP Receiving Fl
a
g (W2.03) t
u
rn
s
ON, the following p
a
r
a
meter
s
a
re written to the p
a
r
a
meter
a
re
a
for
s
ocket n
u
m
b
er 1.
D16008: 0001 Hex = UDP/TCP
s
ocket No. 1
D16013: 0064 Hex = No. of
s
end/receive
b
yte
s
i
s
100
D16014
a
nd D16015:
8203 E800 Hex =
S
end/receive d
a
t
a
a
ddre
ss
D01000
D16016: 0000 Hex = No timeo
u
t time.
After the p
a
r
a
meter h
as
b
een
s
et, the Receive Re
qu
e
s
t
S
witch
(A571.04) i
s
t
u
rned ON
a
nd the TCP Receiving Fl
a
g (W2.03) i
s
t
u
rned OFF.
If the Receive Re
qu
e
s
t
S
witch (A571.04) t
u
rn
s
OFF while the TCP
Receiving Fl
a
g (W2.03) i
s
OFF, the content
s
of the re
s
pon
s
e code
(D16017) in the
S
ocket
S
ervice P
a
r
a
meter Are
a
i
s
checked,
a
nd if it
i
s
not 0000 Hex (norm
a
l end), the TCP Receive Error Fl
a
g (W1.03)
i
s
t
u
rned ON.
After the exec
u
tion re
su
lt
s
h
a
ve
b
een checked, the TCP Receive Bit
(W0.03) i
s
t
u
rned OFF.
Contin
u
ed from previo
us
p
a
ge.
Summary of Contents for SYSMAC CP Series
Page 3: ......
Page 32: ...1 Overview 1 4 CP2E CPU Unit Software User s Manual W614 ...
Page 44: ...3 CPU Unit Operation 3 8 CP2E CPU Unit Software User s Manual W614 ...
Page 116: ...6 I O Allocation 6 8 CP2E CPU Unit Software User s Manual W614 ...
Page 144: ...7 PLC Setup 7 28 CP2E CPU Unit Software User s Manual W614 ...
Page 170: ...10 Interrupts 10 14 CP2E CPU Unit Software User s Manual W614 ...
Page 200: ...11 High speed Counters 11 30 CP2E CPU Unit Software User s Manual W614 ...
Page 272: ...12 Pulse Outputs 12 72 CP2E CPU Unit Software User s Manual W614 ...
Page 278: ...13 PWM Outputs 13 6 CP2E CPU Unit Software User s Manual W614 ...
Page 460: ...18 Programming Device Operations 18 28 CP2E CPU Unit Software User s Manual W614 ...
Page 576: ...Revision 2 CP2E CPU Unit Software User s Manual W614 ...
Page 577: ......