
2.4 Instruction Details
3-152
2
Chapter 2 Instructions
Application of ADD instruction
■ Total count
Writes the total count of counters C001 to C003 into DM0100. The total count must
be within #65535.
Coding
Writes C001 current value into DM0001.
C001
LDA
DM0001
STA
0000
C002
LDA
DM0002
STA
0000
C003
LDA
DM0003
STA
0000
DM0002
ADD
DM0001
LDA
DM0003
ADD
DM0100
STA
2002
#09999
C003
#09999
C001
0001
0002
#09999
C002
0003
Writes C002 current value into DM0002.
Writes C003 current value into DM0003.
Writes total count (DM0001 + DM0002 +
DM0003) into DM100.
Line No. Instruction Operand
0000 LDB 0001
0001 C 010 #099999 0000
0002 CON
0003 LDA C001
0004 CON
0005 STA DM0001
0006 LDB 0000
0007 C 002 #099999 0002
0008 CON
0009 LDA C002
0010 CON
0011 STA DM0002
0012 LDB 0000
0013 C 003 #099999 0003
0014 CON
0015 LDA C003
0016 CON
0017 STA DM0003
0018 LD 2002
0019 LDA DM0001
0020 CON
0021 ADD DM0002
0022 CON
0023 ADD DM0003
0024 CON
0025 STA DM0100
ADD / @ADD
KVNKA Chap 02_4cP.p65 08.3.11, 0:02 PM152
Kommentare zu diesen Handbüchern