17.03.2014 Views

DVP-ES2-EX2-SS2-SA2-SX2-Operation Manual

DVP-ES2-EX2-SS2-SA2-SX2-Operation Manual

DVP-ES2-EX2-SS2-SA2-SX2-Operation Manual

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>DVP</strong>-<strong>ES2</strong>/<strong>EX2</strong>/<strong>SS2</strong>/<strong>SA2</strong>/<strong>SX2</strong>/SE <strong>Operation</strong> <strong>Manual</strong> - Programming<br />

API Mnemonic Operands Function<br />

23 D DIV P Division<br />

Controllers<br />

<strong>ES2</strong>/<strong>EX2</strong> <strong>SS2</strong> <strong>SA2</strong><br />

SE <strong>SX2</strong><br />

Type Bit Devices Word devices Program Steps<br />

OP X Y M S K H KnX KnY KnM KnS T C D E F DIV, DIVP: 7 steps<br />

S 1 * * * * * * * * * * DDIV, DDIVP: 13 steps<br />

S 2 * * * * * * * * * *<br />

D * * * * * * *<br />

PULSE 16-bit 32-bit<br />

<strong>SA2</strong><br />

<strong>SA2</strong><br />

<strong>SA2</strong><br />

<strong>ES2</strong>/<strong>EX2</strong> <strong>SS2</strong> <strong>SX2</strong> <strong>ES2</strong>/<strong>EX2</strong> <strong>SS2</strong> <strong>SX2</strong> <strong>ES2</strong>/<strong>EX2</strong> <strong>SS2</strong><br />

SE<br />

SE<br />

SE<br />

Operands:<br />

S 1 : Dividend S 2 : Divisor D: Quotient and remainder<br />

Explanation:<br />

1. This instruction divides S 1 and S 2 in BIN format and stores the result in D. Care should be<br />

taken on positive/negative signs of S 1 , S 2 and D when doing 16-bit and 32-bit operations.<br />

2. This instruction will not be executed when the divisor is 0. M1067 and M1068 will be ON and<br />

D1067 records the error code 0E19 (hex).<br />

3. If operands S 1 , S 2 use index F, then only 16-bit instruction is available.<br />

4. If operand D use index E, then only 16-bit instruction is available.<br />

5. 16-bit BIN division:<br />

Quotient<br />

S1 S2 D D<br />

Remainder<br />

b15.............b00 b15.............b00 b15.............b00 b15.............b00<br />

+1<br />

<strong>SX2</strong><br />

/<br />

=<br />

If D is specified with a bit device, it can designate K1 ~ K4 to store a 16-bit result. Users can<br />

use consecutive 2 16-bit registers to store 32-bit data of the quotient and remainder.<br />

6. 32-bit BIN division:<br />

Quotient<br />

Remainder<br />

S1 +1 S1 S2 +1 S2 D +1 D D +3 D +2<br />

b15..b00 b15..b00 b15..b00 b15..b00 b31..b16 b15..b00 b31..b16 b15..b00<br />

/ =<br />

If D is specified with a bit device, it can designate K1 ~ K8 to store a 32-bit result. Users can<br />

use consecutive 2 32-bit registers to store the quotient and remainder.<br />

Program Example:<br />

When X0 = ON, D0 will be divided by D10 and the quotient will be stored in D20 and remainder in<br />

D21. ON/OFF of the MSB indicates the positive/negative status of the result value..<br />

X0<br />

DIV D0 D10 D20<br />

3-80

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!