CHAPTER 1
Number Bases, Codes, and Binary Arithmetic
1.1 INTRODUCTION
A digital system processes discrete information using electronic circuits that respond to and operate in a finite number of states, usually two states, on and off, which can be represented by the binary digits 1 and 0. The information so processed may represent anything from arithmetic integers and letters of the alphabet to values of physical quantities such as mass, velocity, and acceleration, or current, voltage, and impedance. A digital system accepts digital input representing numbers, symbols, or physical quantities, processes this input information in some specific manner, and produces a digital output.
Digital systems are used in all types of control systems due to their flexibility, accuracy, reliability, and low cost. Flexibility is due to the ease with which digital systems can be reprogrammed. Accuracy is limited only by the number of bits (BInary digiTs, consisting of 1s and 0s) one wishes to use in representing the digital quantities being processed. Reliability is due to the ability of digital circuits to correctly interpret logical 1s and 0s. For example, in transistor-transistor logic or TTL technology, a logical 1 is represented by a voltage in the range of roughly 2.5 to 5.0 V, and a logical 0 is represented by a voltage of from 0 to about 1 V, and minor fluctuations in voltage levels are not misinterpreted by the hardware.
The cost of all digital chips has dropped dramatically in the past three decades. This is primarily due to the number of transistors that can be put on a single chip. This number has been doubling almost every year for three decades, from a single transistor on a chip in 1960 to several million transistors per chip in 1990.
This chapter starts with a discussion of number bases and how to convert from one number base to any other number base. Next, the topics of binary addition and subtraction and then multiplication and division are covered. Following this, binary codes are discussed, specifically the binary-coded decimal, and the excess-three, the Gray, and error-detecting codes are covered. This leads into the concept of Hamming distance and the requirements for detecting and/or correcting codes. The American standard code for information interchange (ASCII) alphanumeric code is also introduced.
Boolean cubes are defined and discussed as a means of graphically portraying Hamming distances. One’s and two’s complements and nine’s and ten’s complements are covered next, followed by an introduction to modulo arithmetic. Complementary arithmetic converts subtraction to addition. Binary subtraction by means of one’s and two’s complement arithmetic is covered.
1.2 NUMBER BASES
The number system most often used in everyday figuring is the decimal, or base 10, system, which uses ten characters, 0 through 9. This system is not convenient for computer applications, which are normally carried out in binary, or base 2, arithmetic. For this reason, one must be able to convert from base 10 to base 2 at computer/operator interfaces. This is easy to do using a weighted positional notation, and positional notation has been used since the discovery of zero. The Roman numeral system, for instance, is not a weighted positional system.
In a positional number system any number can be represented by a string of characters, with each character position assigned a weight which is a power of the radix or base. In the familiar decimal system the number 1234.5 represents 1 ¥ 1000 + 2 × 100 + 3 × 10 + 4 × 1 + 5 × 0.1. Except for leading and trailing 0s, the representation of any number in positional notation is unique. (i.e., 01234.500 is the same number as 1234.5). This idea will be pursued...