5 Applied Instructions and Basic Usage
DVP-20PM Application Manual
5-34
API
Applicable model
20PM
18
D
D
BCD
P
P
Converting a binary value into a
binary-coded decimal value
Bit device Word device
X Y M S K H KnX KnY KnM KnS T C D V Z
S
* * * * * * * * *
D
* * * * * * * *
Note: The instruction supports V devices and Z devices. (If the 16-bit
instruction is used, Z devices can not be used. If the 32-bit
instruction is used, V devices can not be used.)
Please refer to specifications for more information about device
ranges.
16-bit instruction (5 steps)
BCD
Continuity
instruction
BCDP
Pulse
instruction
32-bit instruction (6 steps)
DBCD
Continuity
instruction
DBCDP
Pulse
instruction
Flags
Ox O100
M
1793 M1953 Operation error flag
Explanation
The binary value in S is converted into a binary-coded decimal value, and the
conversion result is transferred to D.
If a binary value is converted to a binary-coded decimal value which is not in
the range of 0 to 9,999, the instruction BCD will not be executed. If a binary
value is converted to a binary-coded decimal value which is not in the range of
0 to 99,999,999, the instruction DBCD will not be executed.
BCD can be used to convert the binary value in a positioning unit to a
binary-coded decimal value, and transfer the conversion result to an external
device, e.g. a seven-segment display.
Example
When X0 is ON, the binary value in D10 is converted into a binary-coded
decimal value, and the digit in the ones place of the conversion result is stored
in K1Y0 (Y0~Y3).
X0
BCD D10 K1Y0
If D10=001E (hexadecimal value)=0030 (decimal value), Y0~Y3=0000 (binary
value).