Chapter 6 Applied Instructions Symbol S 1 : Source device 1 S 2 : Source device 2 D : Device where the result is stored Explanation 1. This instruction subtracts the value of the hour, the minute, and the second in the real-time clock specified by S 2 6_ from the value of the hour, the minute, and the second in the real-time clock specified by S 1 , and stores the difference in the register specified by D . 2. The operands S 1 , S 2 , and D all occupy three consecutive devices. 3. If the difference is a negative, SM601 is ON, and the instruction adds 24 hours to the difference and then stores the result in D . 4. If the difference is zero (zero hour zero minute zero second), SM600 is ON.
Example 1. When M0 is ON, the instruction subtracts the value of the hour, the minute, and the second in D10–D12 from the value of the hour, the minute, and the second in D0–D2, and stores the difference in D20–D22.
D0 D1 D2 20 ( Hour ) 20 ( Minute ) 5 ( Second ) D10 - 14 ( ) Hour 30 ( ) Minute 8 ( ) Second D20 D21 D22 5 ( ) Hour 49 ( ) Minute 57 ( ) Second D11 D12 20 hour 20 minute 50 second 14 hour 30 minute 8 second 5 hour 49 minute 57 second 6-483 API Instruction code Operand Function 1603 T- P S1, S2, D Subtracting the time Device X Y M S T C HC D FR SM SR E K 16# “$” F S1 S2 D BOOL WORD DWORD LWORD UINT INT DINT LINT REAL LREAL TMR CNT STRING Data type S1 S2 D Pulse instruction 16-bit instruction 32-bit instruction ES3 ES3 -