599
FX
3G
/FX
3U
/FX
3UC
Series Programmable Controllers
Programming Manual - Basic & Applied Instruction Edition
21 Real Time Clock Control – FNC160 to FNC169
21.6 FNC165 – STOH / Second to Hour Conversion
21
FN
C
160-
FN
C
169
R
eal T
im
e C
lo
ck
C
ont
ro
l
22
FN
C
170-
FN
C
179
Exter
nal D
ev
ice
23
FN
C
180
Al
ter
nate
In
str
uc
tions
24
FN
C
181-
FN
C
189
O
ther
s
25
FN
C
190-
FN
C
199
B
lock D
ata
O
per
at
ion
26
FN
C
200
-F
N
C
20
9
C
har
acter
S
tring
C
ont
ro
l
27
FN
C
210-
FN
C
219
Da
ta
O
per
ation 3
28
FN
C
220-
FN
C
249
Da
ta
C
om
par
ison
29
FN
C
250
-F
N
C
26
9
D
ata T
abl
e
O
per
ati
on
30
FN
C
270-
FN
C
274
Ex
-D
ev
ice
Inv
ert
er
Com
m
s
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
40000
D1,D0
D100
D101
D102