Chapter 7 Second Development Platform VP3000
308
API Instruction code Operand Function
19 D BIN P S, D Convert BCD to BIN
Type
Operand
Bit devices Word devices
16-bit instruction (5 steps)
BIN
Continuous
execution
type
BINP
Pulse
execution
type
32-bit instruction (9 steps)
DBIN
Continuous
execution
type
DBINP
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 BCD: 0–9,999, DBCD: 0–99,999,999
Descriptio
n
S: source of data
D: conversion result
The content in S (BCD value, 0–9999) is converted into BIN value and stored in D.
The scope of valid value of S is BCD: 0–9,999, DBCD: 0–99,999,999
Provided the content in S is not a BCD value, an operation error will occur.
Example
When X0 = ON, the BCD value of K1X20 is converted to BIN value and stored in D10.
X0
BIN
D10K1X20
Remark
When PLC needs to read an external DIP switch in BCD format, BIN instruction has to be first
adopted to convert the read data into BIN value and store the data in PLC.
When PLC needs to display its stored data by a 7-segment display in BCD format, BCD
instruction has to be first adopted to convert the data into BCD value and send the data to the 7-
segment display.
When X0 = ON, the BCD value of K4X20 is converted into BIN value and sent it to D100. The
BIN value of D100 will then be converted into BCD value and sent to K4Y20.
BCD D100 K4Y20
X0
BIN D100K4X20