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

163 TSUB P Time subtraction<br />

Controllers<br />

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

SE<br />

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

Type<br />

Bit Devices Word devices Program Steps<br />

OP X Y M S K H KnX KnY KnM KnS T C D E F<br />

S 1 * * *<br />

S 2 * * *<br />

D * * *<br />

TSUB, TSUBP: 7 steps<br />

PULSE 16-bit 32-bit<br />

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

<strong>SA2</strong><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 SE SE <strong>SX2</strong><br />

Operands:<br />

S 1 : Time minuend (occupies 3 consecutive devices) S 2 : Time subtrahend (occupies 3<br />

consecutive devices) D: Subtraction result (occupies 3 consecutive devices)<br />

Explanations:<br />

1. TSUB instruction subtracts the time value (Hour, Minute Second) S 1 with the time value (Hour,<br />

Minute Second) S 2 and stores the result in D.<br />

2. If operand S 1 , S 2 exceed the available range, operation error occurs and M1067 = ON, M1068<br />

= ON. D1067 stores the error code 0E1A (HEX).<br />

3. If the subtraction result is a negative value (less than 0), Borrow flag M1020 = ON and the<br />

value in D will be the result of “the negative value pluses 24 hours”.<br />

4. If the subtraction result (remainder) equals 0 (00:00:00), Zero flag M1020 will be ON.<br />

5. Besides using TRD instruction, MOV instruction can also be used to move the RTC value to<br />

D1315 (Hour), D1314 (Minute), D1313 (Second) for reading the current time of RTC..<br />

Program Example:<br />

When X0 = ON, TSUB instruction executes and the time value in D0~D2 is subtracted by the time<br />

value in D10~D12. The subtraction result is stored in D20~D22.<br />

X0<br />

TSUB D0 D10 D20<br />

D0 20(Hour)<br />

D1 20(Min)<br />

D2 05(Sec)<br />

D10 14(Hour)<br />

D11 30(Min)<br />

D12 08(Sec)<br />

D20 05(Hour)<br />

D21 49(Min)<br />

D22 57(Sec)<br />

20:20:05 14:30:08 05:49:57<br />

If the subtraction result is a negative value (less than 0), Borrow flag M1021 = ON.<br />

3-380

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

Saved successfully!

Ooh no, something went wrong!