Download Type ACPU/QCPU-A (A Mode)(Common Instructions

Transcript
6. BASIC INSTRUCTIONS
Program Examples
MELSEC-A
CHG
The following programs are used with the A3CPU and other types of CPUs to output
pulses in accordance with the input condition of the PLS instruction while alternately
running the main and subprograms.
(1) For A3CPU
It is necessary to compare the operation result of a scan with that of the
previous scan to allow correct output of the PLS instruction. M9050 must
therefore be turned ON when the CHG instruction is executed to save the
operation result of the previous scan, which has been stored in the operation
result storage memory, in the save area.
Since the CHG instruction for the A3CPU is executed only when input
conditions are turned ON, programs must be written in the forms shown below.
Main sequence program
Sub sequence program
Always on
M9036
Always on
M9036
M0
( M9050
)
( M0
)
M1
M0
M0
)
( M1
)
M1
CJ
P0
( M9050
P1
CJ
M9051 M9057
P0
M1
M9051 M9056
P1
M1
M9051 M9056
P1
CHG
P1
M0
CHG
M9051 M9057
CHG
M0
CHG
M9051
M1
CJ
M9051
P0
CJ
P0
FEND
FEND
(2) For A3N, A73 and A3V CPUs
Since the CHG instruction for the A3NCPU is executed only when input
conditions are turned ON, programs must be written in the forms shown below.
M0
M1
(
M0
)
(
M0
M1
CJ
P0
M0
P1
M9051 M9057
CJ
P0
M1
M0
M9051 M9057
CHG
P1
M1
M9051 M9056
CHG
M0
M9051
CHG
M1
CJ
P0
FEND
Main sequence program
6 − 80
P1
M9051 M9056
CHG
P1
M1
M9051
CJ
P0
FEND
Sub sequence program
)