Chapter 6: Instructions 99
Word Conversion Instruction Details
Instruction
Mnemonic BCD Conversion,
Binary Conversion
Range
Bit
■ Byte
BCD
DBCD
BIN
DBIN
BCD: Convert binary to BCD
BIN: Convert BCD to binary
■ Word
Ladder
BCD: Convert the S value from binary into BCD and store in D.
BIN: Convert the S value from BCD into binary and store in D.
Description
1. BCD: Convert S, which is expressed in binary (byte /word), into BCD and store in D. The
range is as follows:
Byte conversion: S = 0 to $63 (hex) = 99 (decimal)
D = 0 to $99 (hex) = 153 (decimal)
Word conversion: S = 0 to $270F (hex) = 9999 (decimal)
D = 0 to $9999 (hex) = 39321 (decimal)
2. BIN: Convert S, which is expressed in BCD (byte /word), into binary (binary code) and store
in D. The range is as follows:
Byte conversion: S = 0 to $99 (hex) = 153 (decimal)
D = 0 to $63 (hex) = 99 (decimal)
Word conversion: S = 0 to $9999 (hex) = 39321 (decimal)
D = 0 to $270F = 9999 (decimal)
3. This operation will occur on every scan for which the input condition is true (On). To perform
the operation only on a change of input condition, use the rising/falling edge contact.
Example
Program Expression Operation Results
Initial conditions: W0 = $07CC = 1996 (decimal)
W1 = $1996 = 6550 (decimal)
W2 = $XXXX
W3 = $XXXX
Operation results: W0 = $07CC
W1 = $1996
W2 = $1996 = 6550 (decimal)
W3 = $07CC = 1996 (decimal)
BCD
D =
S =
R
R
BIN
D =
S =
DBCD
D = W2
S = W0
DBIN
D = W3
N = W1
R0.0
R
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com