Page 322 - Embedded Microprocessor Systems Real World Design
P. 322
Appendix 6
Number Systems
This book assumes knowledge of certain basic concepts. This appendix and the following
two briefly review some of these concepts. This limited space cannot serve as a thorough
treatment of these topics, but the essentials are covered.
Number Bases
Before looking at computer numbering systems, we will make a quick review of the decimal
system. If we have a fourdigit number like 1234 we can write it this way:
(4 x 1) + (3 x 10) + (2 x 100) + (1 x 1000)
As we move from right to left in a decimal number, each digit is the next power of 10. The
least significant digit, in the ones position, is 4. This is multiplied by 10' (10' = 1). The digit
3 is in the texis position and is multiplied by 10'. The 2 is in the hundreds position, multi-
plied by 10'. Finally, the 1 is in the thousands position, 10'. As you can see, the exponent of
10 starts at zero in the rightmost digit and increases by one for every digit you move to the
left. Ten is the base of the decimal system.
The digits in any decimal number can range from zero to 9. Since the decimal system is
base 10, there are 10 possible digits, including zero. This is necessary because any number
system needs a unique character for every possible value in a single digit. When working
with different number bases, it is common to use a subscript to indicate what the number
base is. So 1,234 in decimal would be written 1234,,,.
Microprocessors use digital, or binary, logic, where everything is a one or a zero. As there
are two digits in a binary system, the base is 2. A binary number looks like this:
10011010010
Each position, or digit, in a binary number is called a bit (binary digit). Just like the decimal
system, each binary digit is an increasing power as you move from right to left. Only in this
case, each position represents an increasing power of two instead of ten. The rightmost digit
is in the ones position (2'), the next digit is the 2's position (2'), the next digit is in the 4's
position (2')), and so on. We can rewrite the binary number to show what value each bit
corresponds to as follows:
303