beautypg.com

Delta Electronics Programmable Logic Controller DVP-PLC User Manual

Page 431

background image

8 Application Instructions API 100-149

DVP-PLC Application Manual

8-29

API Mnemonic

Operands

Function

119

D EBIN P

Scientific to Float Conversion

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

*

DEBIN, DEBINP: 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 D: Result

Explanations:

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

2. Flag: M1020 (zero flag)

3. This instruction converts decimal floating point value in the register designated by S into binary floating point

value and stores it in the register designated by D.

4. DEBIN instruction is exclusively for converting floating points from decimal to binary.

5. Range of decimal floating point real numbers: -9.999 ~ +9,999. Range of exponants: -41 ~ +35. Range of PLC

decimal floating points: ±1,175 Ч 10

-41

~

±3,402 Ч 10

+35

.

6. If the result = 0, the zero flag M1020 = On.

Program Example 1:

When X1 = On, the decimal floating points in D1 and D0 will be converted into binary floating points and stored in D3

and D2.

D0

DEBIN

X1

D2

D0

D1

D2

D3

[D1] * 10

[D0]

Decimal

Floating Point

Binary

Floating Point

23 bits for real number, 8 bits for exponent
1 bit for symbol bit

Real number

Exponent

Exponent

Real number

Program Example 2:

1. Use FLT instruction (API 149) to convert BIN integer into binary floating point before performing floating point

operation. The value to be converted must be BIN integer and use DEBIN instruction to convert the floating

point into a binary one.

2. When X0 = On, move K3,140 to D0 and K-3 to D1 to generate decimal floating point (3.14 = 3140 × 10

-3

).

X0

MOVP

K3140

D0

MOVP

K-3

D1

DEBIN

D0

D2

K3140 D0

K-3 D1

[D1]

[D0]

3140 10

X

-3

3140 10

X

-3

(D1, D0)

(D3, D2)

Binary floating point