Saar, Sapr - Mitsubishi Melsec A User Manual

Table of Contents

Advertisement

7. COMMUNICATION WITH PROGRAMMABLE CONTROLLER CPU
/MELSEC
7.6.3 BASIC program example
This section gives the procedure for transferring sequence programs
and TIC set values between the PC CPU and the AD51.
(1) Sequence program read (SAAR, SAPR)
[Program example1
Program to read the PC CPU main program to the following
AD51 memory areas.
Sequence program (2K steps)' Channel 2 EOOOH to EFFFH
Parameter
(3K
bytes)
-t
Channel 2 DOOOH to DBFFH
. . . .
100 Z=ZWR1(2, $F800. $FF).
Defines PC station number as host.
110 Z=ZWR1(2, $F801, $4D).
. . . .
.Sets main, "M", sequence program.
120 Z=ZWR2(2, $F804,64)
. . . . . .
.Sets the number of steps to be read to 64.
130 Z=ZWR2(2. $F808, 60).
. . . . .
.Sets time check period to 60 (600m sec).
140 A=$E000.
. . . . . . . . . . . . . . .
S e t s data destination head address to
variable A.
150 FOR I=0 TO 2047 STEP 64
160 Z=ZWR2(2, $F802, I )
. . . . . . .
Sets head step number of sequence pro-
gram to be read.
170 Z=ZWR2(2, $F806. A).
. . . . . .
.Sets data destination head address.
180 Z=CALL(O, $808A, 2, $Fa001
.
.Reads sequence program.
185 IF Z#0 PRlNT"ERR0R".
Z; GOT0 180.
. . . . . . . . . . . .
.Checks for errors in SAAR execution.
190 A=A+128
. . . . . . . . . . . . . . .
.Adds 128 (64 steps) to head address of
area to be read.
200 NEXT I
210 Z=NVR1(2, $F810, $FF)
. . . . .
Defines PCstation number a s host.
220 Z=ZWR2(2, $F814, 128)
. . . . .
S e t s read byte length to 126.
230 Z=ZWR2(2, $F818, 60)
. . . . . .
.Sets time check period to 60 (600msec).
240 FOR I = 0 TO $BFF STEP $80
1
. . . .
250 Z=ZWR2 (2' $F811' I'
]
.Sets parameter read head address
260 Z=ZWR1(2, $F813,0)
270 Z=ZWR2(2, $F816, $D000+1).
.
S e t s
data destination head address.
.
280 Z=CALL(O, $8090.2. $F810). .Reads parameters.
285 IF Z#0 PRINT "ERROR",
. . . . . . . . . . . .
Z: GOT0 280.
.Checks for errors in SAPR execution.
290 NEXT I
300 END

Advertisement

Table of Contents
loading

Table of Contents