574
FX3S/FX3G/FX3GC/FX3U/FX3UC Series
Programming Manual - Basic & Applied Instruction Edition
21 Real Time Clock Control – FNC160 to FNC169
21.6 FNC165 – STOH / Second to Hour Conversion
2. 32-bit operation (DSTOH and DSTOHP)
The time data in units of "second" stored in +1 and is converted into data in units of "hour, minute, and
second", and stored to three devices , +1, and +2 (hour, minute, and second).
For example, when "45,325 seconds" is specified, the operation is as follows:
Error
An operation error is caused in the following case; The error flag M8067 turns ON, and the error code is store in
D8067.
• When the data of is outside the allowable range (error code: K6706)
Program example
In the program shown below, the time data in units of "second" stored in D0 and D1 is converted into data in units of
"hour, minute, and second", and stored to D100, D101, and D102 when X020 turns ON.
Operation
• Converting the data in second into the data in hour, minute and second using STOHP instruction
(when "40,000 seconds" is specified by D1 and D0)
S
S
D
D
D
Command
input
FNC165
DSTOH
S
D
Hour
Minute
Second
D
+1
+2
D
D
(0 to 32767)
(0 to 59)
(0 to 59)
S
Second (0 to 117964799)
S
+1
12
35
25
D
+1
+2
D
D
S
45325
S
+1
S
X020
FNC165
DSTOH
D0 D100
END
11
6
40
40000D1,D0
D100
D101
D102