7. APPLICATION INSTRUCTIONS
7
−
136
MELSEC-A
Program Example
STC , CLC
Program which performs addition of the BCD data of X0 to F and the BCD data of
D0 when M0 turns on, and turns on the carry flag (M9012) when the result is more
than 9999, and turns off the carry flag when the result is 9999 or less.
(
)
M0
0
P K4
B+ X000 D0 D1
K4
> X000 D1
BCD data of X0 to F and that of D0 are added
and the result is stored into D1.
When (addend) > (addition result) or (augend) >
(addition result), M1 is turned on.
•
Coding
0 LD
M0
1 B+P
K4X000 D0
D1
10
LD>
K4X000 D1
15
OR>
D0
D1
20
OUT
M1
21
LD
M1
22
STC
23
LDI
M1
24
CLC
25
END
When M1 turns on, carry flag is turned on.
M1
> D0
D1
STC
CLC
10
21
23
M1
M1
When M1 is off, carry flag is off.
Содержание MELSEC-A series
Страница 1: ......
Страница 2: ......
Страница 13: ...A 11 MEMO...
Страница 505: ...APPENDICES APP 100 MELSEC A MEMO...
Страница 507: ......
Страница 508: ......