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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

3. Instruction Set<br />

API Mnemonic Operands Function<br />

29 D NEG P<br />

2’s Complement<br />

(Negation)<br />

Controllers<br />

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

SE<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 NEG, NEGP: 3 steps<br />

D * * * * * * * * DNEG, DNEGP: 5 steps<br />

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

PULSE 16-bit 32-bit<br />

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

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

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

SE<br />

Operands:<br />

D: Device to store the operation result of 2’s Compliment<br />

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

SE<br />

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

Explanations:<br />

1. This instruction conducts operation of 2’s complement and can be used for converting a<br />

negative BIN value into an absolute value.<br />

2. This instruction is generally used in pulse execution mode (NEGP, DNEGP).<br />

3. If operand D uses index F, only a 16-bit instruction is available.<br />

Program Example 1:<br />

When X0 goes from OFF to ON, the phase of each bit in D10 will be reversed (0→1, 1→0) and<br />

then 1 will be added to the Least Significant Bit (LSB) of the register. <strong>Operation</strong> result will then be<br />

stored in D10.<br />

X0<br />

NEGP<br />

D10<br />

Program Example 2:<br />

To obtain the absolute value of a negative value:<br />

1. When MSB (b15) of D0 is “1”, M0 = ON. (D0 is a negative value).<br />

2. When M0 = ON, the absolute value of D0 can be obtained by NEG instruction.<br />

M1000<br />

M0<br />

BON D0 M0 K15<br />

NEGP<br />

D0<br />

Program Example 3:<br />

Obtain the absolute value of the remainder of the subtraction. When X0 = ON,<br />

a) If D0 > D2, M0 = ON.<br />

b) If D0 = D2, M1 = ON.<br />

c) If D0 < D2, M2 = ON.<br />

d) D4 is then able to remain positive.<br />

3-89

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

Saved successfully!

Ooh no, something went wrong!