beautypg.com

Delta Electronics Programmable Logic Controller DVP-PLC User Manual

Page 241

background image

6 Application Instructions API 00-49

DVP-PLC Application Manual

6-29

API Mnemonic Operands

Function

18

D BCD P

Binary Coded Decimal

Controllers

ES/EX/SS SA/SX/SC EH/SV

Bit Devices

Word Devices

Program Steps

Type

OP

X Y M S K H

KnX

KnY KnM KnS T C D E F

S

*

*

*

*

*

*

*

*

*

D

*

*

*

*

*

*

*

*

BCD, BCDP: 5 steps

DBCD, DBCDP: 9 steps

PULSE 16-bit 32-bit

ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV

Operands:

S

: Source of data D: Conversion result

Explanations:

1. If

S

and D are used in device F, only 16-bit instruction is applicable.

2.

See the specifications of each model for their range of use.

3.

Flags: M1067 (operation error); M1068 (operation error); D1067 (error code)

4.

The content in S (BIN value) is converted into BCD value and stored in D.

5.

As a 16-bit (32-bit) instruction, when the conversion result exceeds the range of 0 ~ 9,999 (0 ~ 99,999,999), and

M1067, M1068 = On, D1067 will record the error code 0E18 (hex).

6.

The four arithmetic operations and applications in PLC and the execution of INC and DEC instructions are

performed in BIN format. Therefore, if the user needs to see the decimal value display, simply use this

instruction to convert the BIN value into BCD value.

Program Example:

1.

When X0 = On, the binary value of D10 will be converted into BCD value, and the 1s digit of the conversion

result will be stored in K1Y0 (Y0 ~ Y3, the 4 bit devices).

X0

BCD

D10

K1Y0

2.

When D10 = 001E (hex) = 0030 (decimal), the execution result will be: Y0 ~ Y3 = 0000(BIN).