7-20
Section
Conversion Instructions
455
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, min-
utes, and seconds and store the results in DM 0100 and DM 0101 as shown.
HMS(––)
HR 12
DM 0100
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
7-20-12
2’S COMPLEMENT – NEG(––)
S
: Source word
IR, SR, AR, DM, HR, TC, LR, #
Ladder Symbols
Operand Data Areas
R
: Result word
IR, SR, AR, DM, HR, LR
NEG(––)
S
R
000
@NEG(––)
S
R
000
000
Not used. Set to 000.
Limitations
This instruction is available in the
CPM2A/CPM2C/SRM1(-V2) only
.
DM 6144 to DM 6655 cannot be used for R.
Converts the four-digit hexadecimal content of the source word (S) to its 2’s
complement and outputs the result to the result word (R). This operation is effec-
tively the same as subtracting S from 0000 and outputting the result to R; it will
calculate the absolute value of negative signed binary data.
If the content of S is 0000, the content of R will also be 0000 after execution and
EQ (SR 25506) will be turned on.
If the content of S is 8000, the content of R will also be 8000 after execution and
UF (SR 25405) will be turned on.
Note
Refer to
2-16 Calculating with Signed Binary Data
for more details.
Flags
ER:
Indirectly addressed DM word is non-existent. (Content of
*
DM word is
not BCD, or the DM area boundary has been exceeded.)
EQ:
ON when the content of R is zero after execution; otherwise OFF.
UF:
ON when the content of S is 8000; otherwise OFF.
N:
ON when bit 15 of R is ON; otherwise OFF.
Description