Mitsubishi Melsec A User Manual page 74

Table of Contents

Advertisement

7. COMMUNICATION WITH PROGRAMMABLE CONTROLLER CPU
/MELSEC
[Program example
21
Program t o write numerical data t o the following random word
devices.
100 A=$E000
. . . . . . . . . . . .
Sets in' direct vari, able head address
110 FOR I=OTO3
I
. . . . . .
Character string variable head address for
120 A(I)=$ElOO+IX7
130 N E X T I
destination device.
140 C=$E100
. . . . . . . . . . . .
Sets indirect variable head address.
150 A$(O)="D0567".
. . . . . . .
Sets device name "D0567".
160 @(C+5)=0.
. . . . . . . . . . .
Sets source data for D567.
170 A$(1 )="R0882".
. . . . . . .
Sets device name "R0882".
180 @(C+12)=1234.
. . . . . . . .
Sets source data for R882.
190 A$(2)="W0187"
. . . . . . .
Sets device name 'W0187".
200 @(C+19)=751
. . . . . . . . .
Sets source data for W187.
210 A$(3)="CN049"
. . . . . . .
Sets device name "CN049".
220 @(C+26)=0
. . . . . . . . . . .
Sets source data for CN49.
230 B=$E200
. . . . . . . . . . . .
Sets indirect variable head address.
240 B:O)=$FF
. . . . . . . . . . . .
.Defines PC station number as host.
250 B:l )="W".
. . . . . . . . . . .
.Specifies "word write".
260 8(1)=4.
. . . . . . . . . . . . .
.Specifies 4 pieces o f data t o be written.
270 8(2)=$E100
. . . . . . . . . .
Sets source data head address.
280 8(3)=70
. . . . . . . . . . . . .
Sets time check period t o 70(700msec).
290 Z=CALL(O, $8081. 1, B)
. .
.Calls system subroutine SADT.
300 IF
Z#0
PRINT "ERROR",
Z; GOT0 290
. . . . . . . . .
.Checks for errors in SADT execution.
310 END

Advertisement

Table of Contents
loading

Table of Contents