Справочник Пользователя для Mitsubishi Electronics FX3G

Скачать
Страница из 964
572
FX
3S
/FX
3G
/FX
3GC
/FX
3U
/FX
3UC
 Series
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 built-in PLC real time clock 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
hour
minute
second
+1
+2
second
(0 to 32767)
(0 to 59)
(0 to 59)
+1
35
10
58
+1
+2
126658
+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