551
FX
3U
/FX
3UC
Series Programmable Controllers
Programming Manual - Basic & Applied Instruction Edition
21 Real Time Clock Control – FNC160 to FNC169
21.5 FNC164 – HTOS / Hour to Second Conversion
21
FN
C
160-FN
C
169
R
eal
Ti
m
e
C
loc
k
C
ont
ro
l
22
FN
C
170
-F
N
C
17
9
E
xt
e
rnal
D
evi
ce
23
FN
C
180
Su
b
st.
I
n
str
. I
n
fo
24
FN
C
181-FN
C
189
O
ther
s
25
FN
C
190-FN
C
19
9
B
loc
k D
a
ta
O
per
at
io
n
26
FN
C
200-FN
C
209
C
har
act
e
r St
ring
C
ont
ro
l
27
F
N
C2
10
-F
NC
21
9
Da
ta
O
per
at
ion 3
28
FN
C
220-FN
C
24
9
Da
ta
Co
m
p
a
ris
o
n
29
FN
C
250-FN
C
269
Da
ta
T
a
b
le
O
per
at
io
n
30
FN
C
27
0-F
N
C
274
Ex
-D
ev
ic
e
In
ve
rte
r C
o
mm
s
2. 32-bit operation (DHTOS and DHTOSP)
The time data (hour, minute, and second) stored in
,
+1, and
+2 is converted into data in
units of "second", and stored to
+1,
.
For example, when "35 hours 10 minutes 58 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
stored in D8067.
• When the data of
,
+ 1 or
+ 2 is outside the allowable range (error code: K6706)
Program example
In the program shown below, the time data read from the real time clock built in a PLC is converted into data
in units of "second", and stored to D100 and D101 when X020 turns ON.
Operation
• Clock data reading operation by TRD (FNC166) instruction
• Conversion operation into "second" by DHTOS (FNC164) instruction
S
S
S
D
D
Command
input
FNC164
DHTOS
S
D
hour
minute
second
S
+1
+2
second
S
S
(0 to 32767)
(0 to 59)
(0 to 59)
D
D
+1
35
10
58
S
+1
+2
126658
S
S
D
D
+1
S
S
S
X020
D100
FNC166
TRD
D10
END
FNC164
DHTOS
D13
2004
1
31
D11
D10
D12
Year
20
21
23
D14
D13
D15
6
D16
Month
Day
Hour
Minute
Second
Real time
clock
Day of week
Time data
Clock data
20
21
23
73283
D101,D100
D13
D14
D15