Mitsubishi Electric MELSEC FX Series User Manual page 118

Programmable logic controllers
Hide thumbs Also See for MELSEC FX Series:
Table of Contents

Advertisement

FX communication
4 ) Example program of programmable controller
M8002
M8000
M20
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.
10
C LO S E #1 :A $="40"
20
O P E N "C O M 1:" A S #1
30
P R IN T #1,A $
40
C LO S E #1 :F O R I=J T O 2000:N E X T *1
50
O P E N "C O M 1:" A S #1
60
F O R I=1 T O 100 *1
70
IF LO C (1)>=4 G O T O 10 0
80
N E X T
90
C LO S E #1 :P R IN T "T IM E O U T E R R O R ":E N D
100
B $=IN P U T $(LO C (1),#1)
110
P R IN T B $
120
E N D
*1 This counter is used for waiting time of receiving data from PLC. Please change setting
value of counter for personal computer CPU speed.
FNC 40
ZRST
FNC 12
FNC 80
D10
RS
M8123
FNC 15
BMOV
D0
D11
H 048F D8120
MOV
K4
D0
K4
D0
D10
K2
M20
PLF
M8123
RST
M8122
SET
END
T ext of A S C II stored.
C O M 1 port is opened.
D ata is sen t to P LC .
Length of received data is check ed.
R eceived d ata is displayed.
RS instruction 9
Sending data and receiving data
reset. #
Setting communication format.$
b15
0000 0100 1000 1111
0
4
RS instruction drive. (
The receiving data (D0, D1)
moves to sending data area
(D10, D11). )
+
Receive completion reset ,
Send request *
b0
8
F
9-16

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Rs-232cRs-422Rs-485

Table of Contents