
8.2 Details
3-347
1
8
Chapter 8 Programming Examples
0001
#09999
C000
2002
0500
#00999
C000
≤
00999
LDA
C000
CMP
0501
0502
2011
#01999
CMP
2011
0500
#02999
CMP
2011
0500 0501
0000
00999
<
C000
≤
01999
01999
<
C000
≤
02999
Ladder diagram
Coding
➮
Refer to p. 3-146.
Application of ADD instruction
■ Adding BCD and BIN values
Adds a 4-digit BCD input value (7000 to 7015) to the counter current value and
writes the sum into DM0100.
Ladder diagram
Coding
2002
0001
#09999
C001
ADD
DM0000
LDA
C001
2002
TBINLDA
7000
0000
STA
DM0100
STA
DM0000
Converts BCD input value to BIN.
Adds converted BIN value to the current value of
C001 and writes the sum into DM0100.
Line No. Instruction Operand Line No. Instruction Operand
0000 LDB 0001 0012 CON
0001 C 000 #09999 0000 0013 ANB 2011
0002 LD 2002 0014 ANB 0500
0003 LDA C000 0015 OUT 0501
0004 CON 0016 MPP
0005 MPS 0017 CMP #02999
0006 CMP #00999 0018 CON
0007 CON 0019 ANB 2011
0008 ANB 2011 0020 ANB 0500
0009 OUT 0500 0021 ANB 0501
0010 MRD 0022 OUT 0502
0011 CMP #01999
Line No. Instruction Operand Line No. Instruction Operand
0000 LD 2002 0007 LDA C001
0001 LDA 7000 0008 CON
0002 CON 0009 ADD DM0000
0003 TBIN 0010 CON
0004 CON 0011 STA DM0100
0005 STA DM0000 0012 LDB 0001
0006 LD 2002 0013 C 001 #09999 0000
KVNKA Chap 08.p65 08.3.11, 0:12 PM347
Kommentare zu diesen Handbüchern