570
FX3G/FX3U/FX3UC 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
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
secondS
S
(0 to 32767)
(0 to 59)
(0 to 59)
D
D
+1
35
10
58
S
+1
+2
126658S
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
6D16
Month
Day
Hour
Minute
Second
Real time
clock
Day of week
Time data
Clock data
20
21
23
73283
D101,D100D13
D14
D15