312
Conversion Instructions
Section 5-20
5-20-14 SECONDS-TO-HOURS – HMS(––)
Limitations
S and S+1 must be within the same data area. R and R+1 must be within the
same data area. S and S+1 must be BCD and must be between 0 and
35,999,999 seconds.
DM 6143 to DM 6655 cannot be used for R.
Description
HMS(––) is used to convert time notation in seconds to an equivalent in
hours/minutes/seconds.
The number of seconds designated in S and S+1 is converted to hours/min-
utes/seconds and placed in R and R+1.
For the results, the seconds are placed in bits 00 through 07 and the minutes
are placed in bits 08 through 15 of R. The hours are placed in R+1. The maxi-
mum is 9,999 hours, 59 minutes, and 59 seconds.
Flags
ER:
S and S+1 or R and R+1 are not in the same data area.
S and/or S+1 do not contain BCD or exceed 36,000,000 seconds.
Indirectly addressed EM/DM word is non-existent.
(Content of
*
EM/
*
DM word is not BCD, or the EM/DM area boundary
has been exceeded.)
EQ:
ON when the result is zero.
Example
When 00000 is OFF (i.e., when the execution condition is ON), the following
instruction would convert the seconds given in HR 12 and HR 13 to hours,
minutes, and seconds and store the results in DM 0100 and DM 0101 as
shown.
S
:
Beginning source word (BCD)
IR, SR, AR, DM, EM, HR, TIM/CNT, LR
R
:
Beginning result word (BCD)
IR, SR, AR, DM, EM, HR, TIM/CNT, LR
Ladder Symbols
Operand Data Areas
000
:
No function
000
HMS(
−−
)
S
R
000
@HMS(
−−
)
S
R
000
HMS(
−−
)
HR 12
000
00000
HR 12
5
9
2
7
HR 13
1
0
1
3
DM 0100
3
2
0
7
DM 0101
2
8
1
5
10,135,927 s
2,815 hrs, 32 min, 07 s
Address Instruction
Operands
00000
LD NOT
00000
00001
HMS(
−−
)
HR
12
DM
0100
000
DM 0100