Chapter 6 Applied Instructions Symbol: S 1 : Source device Word S 2 : Source device Word D : Device in which the result is stored Word Explanation: 1. The value of the hour, the value of the minute, and the value of the second in the real-time clock specified by S 2 are subtracted from the value of the hour, the value of the minute, and the value of the second in the real-time clock specified by S 1 , and the difference is stored 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 result gotten from the addition of 24 hours to the difference is stored in D . 4.
If the difference is 0 (0 hour 0 minute 0 second), SM600 is ON. Example: 1. When M0 is ON, the instruction T- is executed. The value of the hour, the value of the minute, and the value of the second in D10~D12 are subtracted from the value of the hour, the value of the minute, and the value of the second in D0~D2, and the difference is stored 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 2. If the difference is a negative, SM601 is ON.
20 hour 20 minute 50 second 14 hour 30 minute 8 second 5 hour 49 minute 57 second 5 ( Hour ) 20 ( Minute ) 30 ( Second ) - 19 ( ) Hour 11 ( ) Minute 15 ( ) Second 10 ( ) Hour 9 ( ) Minute 15 ( ) Second 5 hour 20 minute 30 second 19 hour 11 minute 15 second 10 hour 9 minute 15 second Additional remark: 1. If the value in S 1 or S 2 exceeds the range, the operation error occurs, the instruction is not 6-369 API Instruction code Operand Function 1603 T- P S1, S2, D Subtracting the time Device X Y M S T C HC D L SM SR E PR K 16# “$” DF S 1 S 2 D Pulse instruction 16-bit instruction (7 steps) 32-bit instruction AH500 AH500 -