User`s manual

FX communication
RS instruction 9
9-16
4 ) Example program of programmable controller
5 ) Example program of computer
This is an example of a BASIC program for communication of RS instruction communication
(no protocol communication). This BASIC program is written by not know overseas.
*1 This counter is used for waiting time of receiving data from PLC. Please change setting
value of counter for personal computer CPU speed.
M8002
M8000
M8123
FNC 15
BMOV
D0 D10 K2
M20
END
SET
M8122
RST
M8123
PLF
M20
FNC 80
RS
D10 K4 D0 K4
FNC 12
MOV
H 048F D8120
FNC 40
ZRST
D0 D11
Sending data and receiving data
reset.
#
Setting communication format.
$
0000 0100 1000 1111
0 4 8 F
b15 b0
RS instruction drive.
(
The receiving data (D0, D1)
moves to sending data area
(D10, D11).
)
Receive completion reset
,
Send request
*
+
10
20
30
40
50
60
70
80
90
100
110
120
CLOSE #1:A$=”40”
OPENCOM1: AS #1
PRINT #1,A$
CLOSE #1:FOR I=J TO 2000:NEXT *1
OPENCOM1: AS #1
FOR I=1 TO 100 *1
IF LOC(1)>=4 GOTO 100
NEXT
CLOSE #1:PRINT ”TIME OUT ERROR”:END
B$=INPUT$(LOC(1),#1)
PRINT B$
END
Text of ASCII stored.
COM1 port is opened.
Data is sent to PLC.
Length of received data is checked.
Received data is displayed.