Chapter 7 Second Development PlatformVP3000
307
API Instruction code Operand Function
18 D BCD P S, D Convert BIN to BCD
Type
Operand
Bit devices Word devices
16-bit instruction (5 steps)
BCD
Continuous
execution
type
BCDP
Pulse
execution
type
32-bit instruction (9 steps)
DBCD
Continuous
execution
type
DBCDP
Pulse
execution
type
Associated flag: none
X Y M K H KnX KnY KnM T C D
S
D
Caution for using operand
Scope of S is BIN: 0–9999
Description
S: source of data
D: destination of data
The content in S (BIN value, 0–9999) is converted into BCD value and stored in D.
Operand S, D use device F, and they can only use 16-bit instructions.
Example
When X0 = ON, the binary value of D10 is converted into BCD value, and the unit digit of the
conversion result is stored in K1Y0 (Y0–Y3, the 4 bit devices).
BCD D10 K1Y0
X0
When D10 = 001E (Hex) = 0030 (decimal), the execution result is: Y0–Y3 = 0000 (BIN).