Chapter 16 PLC Function Applications│CP2000
16-64
API
BCD
S D
BIN to BCD transformation
18
D P
Bit device Word device
16-bit command (5 STEP)
BCD Continuous
execution type
BCDP Pulse
execution type
32-bit command (9 STEP)
DBCD Continuous
execution type
DBCDP Pulse
execution type
Flag signal: none
X Y M K H KnX KnY KnM T C D
S
*
* * * * *
D
*
* * * *
Notes on operand usage: none
S
: Data source.
D
: Destination of data movement.
The content of data source
S
(BIN value, 0–9999) executes
BCD transformation and saves in
D
.
Arithmetic elements S and D use the F device, it can only use 16-bit command.
When X0 is ON, and the BIN value of D10 is transformed to BCD value, the digit is
saved in 4-bit element of K1Y0 (Y0–Y3).
BCD D10 K1Y0
X0
If D10 = 001E (Hex) = 0030 (Decimal), the executed result will be Y0–Y3=0000
(BIN).