6. BASIC INSTRUCTIONS
6 − 24
MELSEC-A
Program Examples B+
Program which performs the addition of BCD data 5678 and 1234, and stores the
result to D993, and at the same time outputs it to Y30 to 3F.
B-
Program which performs subtraction of the BCD data of D3 and that of D8 and
transfers the result to M16 to 31 when X1B turns on.
• Coding
0 LD M9036
1 MOVP H5678 D993
6 B+P H1234 D993
13 MOVP D993 K4Y030
18 END
0
M9036
P H
B+ 1234 D993
P H
MOV 5678 D993
P K4
MOV D993 Y030
5678 is stored into D993 in BCD
BCD data 1234 and D993 are added and the
result is stored into D993.
Data of D993 is output to the Y30 to 3F.
0
X01B
P K4
B- D3 D8 M16
• Coding
0 LD X01B
1 B-P D3 D8 K4M16
10 END