G-36
FX Series PLC User's Manual - Data Communication Edition
Non-Protocol Communication (FX2N-232IF)
6 Practical Program Examples
6.1 Example of Sending/Receiving 16-Bit Buffer Length Data
4. Sequence program example
D200(K 9)
→
BFM#1000
D201(e T)
→
BFM#1001
D202(t s)
→
BFM#1002
D203(d )
→
BFM#1003
D204(t a)
→
BFM#1004
D205( a)
→
BFM#1005
The number of bytes to be sent and send data are transferred.
M8000
FNC 78
FROM
K 0 K 28 K4M10 K 1
RUN monitor
The status is read.
(BFM#28 b15 to b0
→
M25 to M10)
X001
Error reset input
Block No.
The error is reset.
BFM #
Transfer
source
Number of
transfer points
M 3
M8000
FNC 79
TO
K 0 K 1 K1M0 K 1
The commands are transferred.
(M3 to M0
→
BFM#1 b3 to b0)
M11
K 0 K2001 D301 K 4
FNC 78
FROM
Receiving
complete
The received data buffers are read.
BFM#2001
→
D301
BFM#2002
→
D302
BFM#2003
→
D303
BFM#2004
→
D304
Receiving complete
flag reset command
M 2
Y 1
Y 0
The status is monitored (if necessary).
M 0
Sending/receiving is enabled.
M10
M13
Sending complete
Error occurrence
FNC 79
TO
K 0 K1000 D200 K 6
M8002
Initial pulse
The communication format is transferred.
(009FH
→
BFM#0)
FNC 79
TO
K0 K2 K8 K1
The maximum number of receivable bytes is transferred.
(K 8
→
BFM#2)
Block No. BFM #
Transfer
source
Number of
transfer points
X000
Sending command input
PLS M 1
M 1
FNC 12
MOV
K 9 D 200
FNC 12
MOV
H6554 D 201
Sending command
Number of bytes to be sent
(K9
→
D200)
( e T)
FNC 12
MOV
H7473 D 202
( t s )
FNC 12
MOV
H6420 D 203
( d )
NC 12
MOV
H7461 D 204
( t a )
FNC 12
MOV
H0061 D 205
( a)
Send data (9 bytes)
"Test data"
FNC 79
TO
K0 K4
H02
(STX)
K1
Sending header
(02H
→
BFM#4)
FNC 79
TO
K 0 K 6
H03
(ETX)
K 1
Sending terminator
(03H
→
BFM#6)
FNC 79
TO
K 0 K 8
H02
(STX)
K 1
Receiving header
(02H
→
BFM#8)
FNC 79
TO
K 0 K 10
H03
(ETX)
K 1
Receiving terminator
(03H
→
BFM#10)
Blank
M8003
FNC 79
TO
K0 K0 H009F K1