7 APPLICATION INSTRUCTION
7.19 Clock instruction
587
7
Converting time data from hour/minute/second to seconds in 16
bits
HTOS(P)
These instructions convert the time data stored in the device numbers starting from (s) to the time value in seconds, and store
the converted data in the device numbers starting from (d) as 16-bit binary.
■Descriptions, ranges, and data types
■Applicable devices
• These instructions convert the time data stored in the device numbers starting from (s) to the time value in seconds, and
store the converted data in the device numbers starting from (d).
When specifying 4 hours 29 minutes 31 seconds in (s)
Ladder diagram Structured text
ENO:=HTOS(EN,s,d);
ENO:=HTOSP(EN,s,d);
Operand Description Range Data type Data type (label)
(s) Head device number where the clock data before conversion is
stored
16-bit signed binary ANY16
(d) Head device number where the clock data after conversion is
stored
16-bit signed binary ANY16
Operand Bit Word Double word Indirect
specification
Constant Others
X, Y, M, L,
SM, F, B, SB
U\G T, ST,
C, LC
T, ST, C, D,
W, SD, SW, R
U\G Z LC LZ K, H E $
(s)
(d)
Error code
(SD0/SD8067)
Description
2820 Any of the device area ranges specified in (s) and (d) exceed the corresponding device range.
3403 The result is outside the following range.
0 to 32767
3405 A value specified by (s) is outside the following range.
0 to 9
Any of values specified by (s)+1 and (s)+2 is outside the following range.
0 to 59
(s)
(s)+1
(s)+2
(d)
Data range
(0 to 9)
(0 to 59)
(0 to 59)
Hour
Minute
Second
Second
(d)
16171
(s)
(s)+1
(s)+2
4
29
31