beautypg.com

Delta Electronics Programmable Logic Controller DVP-PLC User Manual

Page 282

background image

6 Application Instructions API 00-49

DVP-PLC Application Manual

6-70

API Mnemonic

Operands

Function

49

D FLT P

Convert BIN integer to binary floating
point

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

*

FLT, FLTP: 5 steps

DFLT, DFLTP: 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 device for conversion D: Device for storing the conversion result

Explanations:

1.

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

2.

Flags: M1081 (FLT instruction function switch); M1020 (zero flag); M1021 (borrow flag); M1022 (carry flag)

3.

D

will occupy 2 consecutive devices

4.

When M1081 is Off, BIN integer is converted into binary floating point value. At this time, S of the 16-bit

instruction, FLT, occupies 1 register and D occupies 2 registers.

a) If the absolute value of the conversion result > max. floating value, carry flag M1022 = On.

b) If the absolute value of the conversion result < min. floating value, carry flag M1021 = On.

c) If the conversion result is 0, zero flag M1020 = On.

5.

When M1081 is On, binary floating point value is converted into BIN integer (digits after decimal point are left

out). At this time, S of the 16-bit instruction, FLT, occupies 2 registers and D occupies 1 register (action same as

that of INT instruction).

a) If the conversion result exceeds the range of BIN integer available in D (for 16-bit: -32,768 ~ 32,767; for 32-bit:

-2,147,483,648 ~ 2,147,483,647), D will obtain the maximum or minimum value and carry flag M1022 = On.

b) If any digits is left out during the conversion, borrow flag M1021 = On.

c) If

S

= 0, zero flag M1020 = On.

d) After the conversion, D stores the result in 16 bits.

Program Example 1:

1.

When M1081 = Off, the BIN integer is converted into binary floating point value.

2.

When X10 = On, D0 (BIN integer) is converted into D13 and D12 (binary floating point value).

3.

When X11 = On, D1 and D0 (BIN integer) are converted into D21 and D20 (binary floating point value).

4.

If D0 = K10, X10 will be On. The 32-bit value of the converted floating point will be H41200000 and stored in

32-bit register D12 (D13).

5.

If 32-bit register D0 (D1) = K100,000, X11 will be On. The 32-bit value of the converted floating point will be

H47C35000 and stored in 32-bit register D20 (D21).