Mitsubishi Melsec A User Manual page 62

Table of Contents

Advertisement

7. COMMUNICATION
WITH PROGRAMMABLE CONTROLLER CPU
/MELSEC
7.1.3 Read
from general-purpose output
A similar procedure may be used to read the general-purpose outputs
using the logical A N D operation. The work area addresses are given
in Section
7.1
. I .
Note that bits 2 to 7 of address 6820H are resewed
for the operating system and should be masked.
[Program example]
Program for ONIOFF monitor of Y20 to 27
100 A=PEEK($6800)
. .
.Reads address 6800H t o variable A.
110 B=1
. . .
. . . . . . .
.
.Variable B set.to 1.
120 FOR I=0 TO 7
130 IF (A&B)1#) PRINT"0N";GOTO
150..
.
.
. . . .
.Performs AND operation of variable A and
variable B, and if relevant bit is on, displays
"ON".
140 PRlNG "OFF"
150 B=B$2.
.
.
.
. . . . .
.Shifts the contents of variable B one bit to the
left.
160 NEXT1
170 END

Advertisement

Table of Contents
loading

Table of Contents