![FATEK FBs Series Manual Download Page 205](http://html1.mh-extra.com/html/fatek/fbs-series/fbs-series_manual_3764826205.webp)
Advanced Function Instruction
7 -4 1
FUN 61
P
→
SEC
HOUR:MINUTE:SECOND TO SECONDS CONVERSION
FUN 61
P
→
SEC
S :
EN
Conversion control
Ladder symbol
61P. SEC
D :
D=0
Result as 0
S : Starting calendar data register to be
converted
D : Starting register storing results
WX
WY
WM
WS TMR CTR HR
IR
OR
SR
ROR
DR
K
Range
Ope-
rand
WX0
∣
WX240
WY0
∣
WY240
WM0
∣
WM1896
WS0
∣
WS984
T0
∣
T255
C0
∣
C255
R0
∣
R3839
R3840
∣
R3903
R3904
∣
R3967
R3968
∣
R4167
R5000
∣
R8071
D0
∣
D4095
-
117968399
∣
117964799
S
○
○
○
○
○
○
○
○
○
○
○
○
○
D
○
○
○
○
○
○
○
○
*
○
*
○
z
When conversion control "EN" = 1 or "EN
↑
" (
P
instruction) has a transition from 0 to 1, will convert the hour:
minute: second data of S~S+2 into an equivalent value in seconds and store it into the 32-bit register formed
by combining D and D+1. If the result = 0, then set the "D = 0" flag as 1.
z
Among the FBs-PLC instructions, the hour: minute: second time related instructions (FUN61 and 62) use 3
words of register to store the time data, as shown in the diagram below. The first word is the second register,
the second word is the minute register, and finally the third word is the hour register, and in the 16 bits of
each register, only B14~B0 are used to represent the time value. While bit B15 is used to express whether
the time values are positive or negative. When B15 is 0, it represents a positive time value, and when B15
is 1 it represents a negative time value. The B14~B0 time value is represented in binary, and when the time
value is negative, B14~B0 is represented with the 2's complement. The number of seconds that results from
this operation is the result of summation of seconds from the three registers representing hours: minutes:
seconds.
B15
B14
B0
B15B0
S
(sec)
-
32768 sec
~
32767 sec
D
the sec. value.
S
+
1 (min)
-
32768 min
~
32767 min
D
+
1
S
+
2 (hr)
-
32768 hr
~
32767 hr
Ö
B31 B30
B16
↑
↑
B31 is used to represent the positive or
The B15 of each registers is used to represent the sign of each time value
└
negative nature of the sec. value
z
Besides FUN61 or 62 instruction which treat hour: minute: second registers as an integral data, other
instructions treat it as individual registers.
z
The example program at below converts the hour: minute: second data formed by R20~R22 into their
equivalent value in seconds then stored in the 32-bit register formed by R50~R51. The results are shown
below.
R20
0E11H
=
3601 sec
S
R21
FD2FH
=
−
721 min
R22
03F3H
=
1011 hr
Ø
X0
=
R50
EE45H
X0
EN
S : R 20
61P. SEC
D : R 50
D=0
D
R51
0036H
=
3599941 sec