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 />

48 D SQR P Square Root<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 SQR, SQRP: 5 steps<br />

S * * * DSQR, DSQRP: 9 steps<br />

D *<br />

Operands:<br />

S: Source device D: Device for storing the result<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 />

Explanation:<br />

1. This instruction performs a square root operation on S and stores the result in D.<br />

2. S can only be a positive value. Performing a square root operation on a negative value will<br />

result in an error and the instruction will not be executed. The error flag M1067 and M1068 =<br />

ON and D1067 records error code H0E1B.<br />

3. The operation result D should be integer only, and the decimal will be left out. When decimal<br />

is left out, borrow flag M1021 = ON.<br />

4. When the operation result D = 0, zero flag M1020 = ON.<br />

Program Example:<br />

When X20 = ON, square root of D0 will be stored in D12.<br />

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

X20<br />

SQR D0 D12<br />

D0 D12<br />

3-114

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

Saved successfully!

Ooh no, something went wrong!