Page 406 - Introduction to Microcontrollers Architecture, Programming, and Interfacing of The Motorola 68HC12
P. 406
Appendix 1 Number Representations and Binary Arithmetic 383
zero. The remaining binary digits c m_2 • • • ,CQ are then used to represent the magnitude
of N with (1).
Figure Al.l. 4-Bit Binary Representations
This particular representation, called the signed-magnitude representation, has two
problems. First, carrying out addition and subtraction is clumsy, particularly from a
logic design point of view. Second, the number zero has two representations, 10 .. . 0
and 00 . . .0 , which, at best, has a perplexing feeling to it. The following
representation, the two's-complement representation, essentially solves both of these
problems.
Looking again at Figure Al.l, notice that when we subtract the representation of N
from M, we get the same thing as adding the representation of M to that of 2 —N because
moving N positions counterclockwise is the same thing as moving clockwise 2 -N
positions. Thus, as far as modulo-16 addition is concerned, M-l = M + (-1) is the same
as M + 15, M-2 = M + (-2) is the same as M + 14, and so on. Letting — 1 be represented
with the sequence for 15, -2 with the sequence for 14, and so on, we get the two's-
complement representation shown in Figure Al.l for m equal to four.
We choose to represent the negative integers -1 through -8 in Figure Al.l because,
with this choice, the leading bit is a sign bit, as with the signed magnitude

