Mitsubishi Melsec A User Manual page 73

Table of Contents

Advertisement

7. COMMUNICATION WITH PROGRAMMABLE CONTROLLER CPU
/MELSE
(3)
Data write t o any PC device data memory (SADT)
[Program example
I ]
Program t o write onloff data to the following random bit devices:
Switch on Y 11 5, switch o f f M340.
Switch off B24C. switch on L875.
100 A=$E000
. . . . . . . . . . . .
.Head
address
for
system subroutine
INPUT data
110 FOR I=0 TO 3
120 A ( I ) = $ E l O O + I ~ 6
I
. . . . .
Sets character string variable head address
130 NEXT
I
for destination device.
140 C=$E100
. . . . . . . . . . . .
Sets indirect variable head address.
150 A$(O)="Y0115".
. . . . . . .
Sets device name "YO1 15".
160 C:5)=1
. . . . . . . . . . . . . .
.Source data for Y115.
170 A$(! )="M034OW
. . . . . . .
Sets device name "M0340".
180 C : l l ) = O
. . . . . . . . . . . . .
.Source data for M340.
190 A$(2)="B024C".
. . . . . . .
S e t s device name "8024C".
200 C: 17)=0
. . . . . . . . . . . . .
Source data for B24C.
210 A$(3)="L0875".
. . . . . . .
Sets device name "L0875".
220 C:23)=1
. . . . . . . . . . . . .
.Source data for L875.
230 B=$E200
. . . . . . . . . . . .
Sets indirect variable head address.
240 B:O)=$FF
. . . . . . . . . . . .
.Defines PC station number as host.
250 B:l)="B"
. . . . . . . . . . . .
.Specifies "bit write".
260 B ( 1 ) = 4 .
. . . . . . . . . . . .
.Specifies 4 pieces of data t o be written.
270 B(2)=$E100
. . . . . . . . . .
Sets source data head address.
280 B(3)=70
. . . . . . . . . . . . .
Sets time check period t o 70(700msec).
.
290 Z=CALL(O. $8081, 1, 0 ) .
.Calls system subroutine SADT.
300 I F Z#U PRlNT"ERR0R".
. . . . . . . . .
Z;
GOT0 290
.Checks for errors i n SADT execution.
310 END

Advertisement

Table of Contents
loading

Table of Contents