Mitsubishi Electronics FXCPU Video Game Controller User Manual


 
21 Applied Instructions (Real Time Clock Control)
21.4 TSUB / RTC Data Subtraction
550
FXCPU Structured Programming Manual
[Basic & Applied Instruction]
Function and operation explanation
1. 16-bit operation (TSUB, TSUBP)
From the time data (hour, minute, second) of the device specified by , the time data (hour, minute,
second) of the device specified by is subtracted, and the result is stored in the device specified by .
If the operation result is less than 0 hour, the borrow flag is turned ON, and the time by adding 24 hours to the
simple difference is stored as the operation result. If the operation result is 0 (0 hour, 0 minute, 0 second), the
zero flag is turned ON.
Cautions
1) Number of devices occupied
Three devices are occupied each in , and .
Be careful not to overlap with the devices used in machine control.
2) When using the time (hour, minute, second) of the clock data of the real time clock built in the PLC, first
read out the value of the special data register by using TRD, TRDP, and specify the word device in each
operand.
3) Some restrictions to applicable devices.
S1: The FX
3G, FX3GC, FX3U and FX3UC PLCs only are applicable.
S2: The FX
3U and FX3UC PLCs only are applicable.
Program example
If the operation result is less than 0 hour
-
+1 (minute)
(hour)
+2 (second)
+1 (minute)
(hour)
+2 (second)
+1 (minute)
(hour)
+2 (second)
The range of "hour" is 0 to 23.
The range of "minute" is 0 to 59.
The range of "second" is 0 to 59.
d
d
ds2
s2
s2
s1
s1
s1
s1 s1 s1 s2 s2 s2
d d d
( , +1, +2) - ( , +1, +2)
( , +1, +2)
TSUB
EN
s1
s2
ENO
d
Command
input
*1
*1 *2
Device for storing the subtracted result of two time
data (hour, minute, second)
Device for storing "hour" of subtraction time data
(hour, minute, second)
*1.
*2.
-
D 11
D 10
D 12
D 21
D 20
D 22
D 31
D 30
D 32
10 hours, 30 minutes, 10 seconds 3 hours, 10 minutes, 5 seconds 7 hours, 20 minutes, 5 seconds
(D10,D11,D12) - (D20,D21,D22)
(D30,D31,D32)
TSUB
EN
s1
s2
ENO
d
D30D10
D20
X000
[Structured ladder/FBD]
[ST]
TSUB(X000,D10,D20,D30);
10 (hour)
30
(minute)
10
(second)
5
(second)
10
(minute)
3 (hour)
5
(second)
20
(minute)
7 (hour)
<
-
20 (minute)
5 (hour)
40 (second)
10 (minute)
18 (hour)
5 (second)
10 (minute)
11 (hour)
35 (second)
11 hours, 10 minutes, 35 seconds18 hours, 10 minutes, 5 seconds5 hours, 20 minutes, 40 seconds
5-18=-13( 0)
ds1 s2