9. Binary Numbers

In previous chapters, we’ve repeatedly stated that a digital signal generated by an analog-to-digital converter is merely sequences of numbers, as shown in Figure 9-1.

Image

Figure 9-1 Digital signal generation.

To be specific, the numbers comprising a digital signal are not the normal decimal numbers that we deal with in our daily lives. The numbers in a digital signal are called binary numbers and this chapter describes the characteristics, utility, and necessity of using binary numbers.

Number Systems

Understanding the nature of binary numbers is easy if we first recall what we learned about decimal numbers in grade school. Let’s do that.

Decimal Numbers, a Base-10 Number System

In our decimal number system, we have 10 digits, 0 through 9, and we can represent any whole number using a series of decimal digits as shown in Figure 9-2. In that figure, we show the decimal number 1203, one thousand two hundred and three. Figures 9-2(a) and 9-2(b) remind us of the values of each decimal digit in our 4-digit number. The value of a single digit depends on its place, or position, within the 4-digit number. For example, the value of the “2” digit in our number is not 2. The value of the “2” digit in our number is 200. That is, the value of the “2” depends on its place within a multidigit decimal number. This scheme is called a place-value system of writing numbers.

Image

Figure 9-2 Digit values of the decimal number 120310.

We use the subscripted 10 in Figure 9-2(c), 120310, to remind us that our number 1203 is a decimal number. The numerical concepts in Figure 9-2 are so familiar to us that we use them effortlessly in our everyday life.

Mathematicians refer to our familiar Figure 9-2 decimal number system as a base-10 number system because it has 10 different digits, 0 through 9.

A Base-4 Number System

To reinforce our understanding of the place-value method of writing numbers, in preparation for discussing binary numbers, let’s consider a hypothetical base-4 number system that has only four digits, 0 through 3. Using the same place-value concepts in Figure 9-2, Figure 9-3 shows us how to interpret the number 12034, in a base-4 number system.

Image

Figure 9-3 Digit values of the base-4 number 12034.

The value of the “2” digit in our 12034 number is 2 times 4 squared—that is, 2 times decimal 16. The value of the “1” digit in our 12034 number is 1 times 4 cubed, 1 times decimal 64. Figure 9-3(c) shows us that the decimal value of our base-4 12034 number is 9910. If you understand the numerical notation conventions in Figures 9-2 and 9-3, pat yourself on the back. You’re becoming well-versed in the mathematics of place-value number systems.


By the Way

The place-value system of representing numbers is very old—so old, in fact, that its origin is obscure. However, with its inherent positioning of the units digit as the right-most digit, this number system is so convenient and powerful that its importance has been compared to that of the first alphabets.


Binary Numbers, a Base-2 Number System

The binary number system—used by all computers, cell phones, compact discs, and hand calculators—is a base-2 system that has only two digits, 0 and 1. (The word binary comes from the Latin word binarius, which means consisting of two; for example, bicycle, bilingual, and binoculars.)

As a binary number example, Figure 9-4 presents the binary number 11012, where Figure 9-4(a) and Figure 9-4(b) show the decimal value of each digit in the binary number. Figure 9-4(c) shows us that our binary number 11012 has a decimal value of 1310. We used the subscripted 2 in Figure 9-4 to make clear that our number 11012 is a binary number; a base-2 number system. (Hardware and software engineers who routinely work with binary numbers don’t bother using the 2 subscript.)

Image

Figure 9-4 Digit values of the binary (base-2) number 11012.

Table 9.1 shows the first 16 binary numbers and their equivalent decimal values. The numbers in the table’s left column are called 4-bit binary numbers because they each have 4 Binary digits. A bit, a single binary digit of either 0 or 1, is the smallest unit of information in a binary number.

Image

Table 9.1 First 16 Binary Numbers

As strange as they look, binary numbers are just as useful and practical as our decimal numbers. Any decimal number can be written in the binary number system. Figure 9-5 shows how to write the decimal number 1234 as a binary number. 123410 = 100110100102. All of the arithmetic operations that we perform on decimal numbers can also be performed on binary numbers, such as addition, subtraction, multiplication, and division.

What we’re demonstrating here is that a sequence of binary bits (ones and zeros) can be used to represent a decimal number. And in that context, we call such a sequence of binary bits a binary number. However, as we discuss in the next section, we can use binary bits to represent other types of information.

Image

Figure 9-5 Binary number equivalent of the decimal number 1234.


By the Way

Now you’re able to understand the computer geek joke, “There are only 10 kinds of people—those who understand binary numbers, and those who don’t.”


As it turns out, there are a number of different ways to represent decimal numbers with sequences of binary bits. For the interested reader, those representations, known as binary number formats, are presented in Appendix D.

Using Binary Numbers at Home

Let’s use an example of a birthday party to show how the binary number system works. If you’re celebrating someone’s twenty-first birthday and only have five candles, there’s no need to run to the store for more candles: binary numbers to the rescue. You merely arrange and light the candles as shown in Figure 9-6. A lit candle represents binary one bit and an unlit candle represents binary zero bit. This way, your five candles represent the decimal number 21. You can then explain binary numbers to your birthday party guests and proudly announce, “We often use the binary number system in this household.”

Image

Figure 9-6 Celebrating a twenty-first birthday with five candles and binary numbers.


By the Way

Using the binary birthday candle technique means that all you’ll ever need are seven candles. Seven lit candles, 11111112 = 12710, enable you to celebrate birthdays up to the age of 127 years. (This would cover even the ages of the authors of this book!)


Binary Data

A very common application of binary bits is to use them to represent letters. For example, Table 9.2 lists the industry-standard convention for representing lowercase English letters using 8 binary bits.

Image

Table 9.2 Industry-Standard Binary Data Convention for Lowercase English Letters

So if you use your computer’s word-processing software to create the word cat and decide to print that word on your printer, your computer sends the three 8-bit binary data words 01100011, 01100001, and 01110100 by way of a cable to your printer. In turn, your printer is designed to interpret those three binary words as the English letters c a t, which it then prints.


By the Way

A sequence of 8 binary bits is called a byte. So if you have a digital photo whose file size is 50 kilobytes (50,000 bytes), that photo’s file contains 400,000 binary bits. Likewise, an 8-gigabyte hard disk drive can store approximately 64 billion binary bits. And before you ask, yes, there is a nibble. It’s half a byte, or 4 bits.


For another example of binary data, in a high-definition television (HDTV), each tiny colored dot (called a pixel, short for picture element) on the television screen is controlled by three 8-bit binary words. Each 8-bit binary word represents the light intensity level of red, blue, and green colors that are combined to define the final color of a single pixel.

Why Use Binary Numbers?

At first glance, it’s reasonable to ask why in the world would we use this apparently very limited binary number system to represent our decimal numbers. The answer lies in the practicality of building electric circuits that can represent the two binary digits of 1 and 0.

Digital Hardware Is Easy to Build

For all our power and sophistication, we use electric switches in digital hardware to represent a binary digit of 1 or 0. By electric switch we mean exactly the same function as the electric light switch on a wall. That is, if the switch is open (off), we interpret that to represent a binary 0 bit. And if the switch is closed (on), we interpret that to represent the binary bit of 1. (Even the power switches on many modern electrical appliances are labeled 1/0 instead of On/Off.) As such, to represent an arbitrary 8-bit binary word in hardware, we assemble a set of eight switches, each of which are either open or closed. However, the switches we use are not those familiar electrical light switches on a wall. In computer hardware, our switches are extremely small transistors, many millions of which can be fabricated) as a single integrated circuit (a chip), a miniaturized collection of interconnected (integrated) transistors encapsulated in a small plastic or ceramic block. Digital engineers refer to these transistor switches as having two states, either opened or closed.

A reliable 0 to 9 electric circuit that has 10 states, so it can represent the 10 decimal digits of 0 to 9, could be built. But for a number of practical engineering reasons, the cost of such circuits would be far greater than binary circuits. The average person could never afford to buy a home computer, cell phone, or high-definition television built with decimal-like circuits.


By the Way

Because a single transistor’s On/Off state can represent a binary bit, a 0 or a 1, transistors are used for data storage in a computer’s memory. A home computer’s USB flash drive (thumb drive) memory device contains billions of transistors. In 2002, electronic industry analysts, who study such things, estimated there were more transistors produced that year than grains of rice, and the cost of one rice grain could buy hundreds of transistors. Astoundingly, in 2009 there were more than 250 transistors produced for each grain of rice, and the cost of one rice grain could buy 125,000 transistors.


Binary Data Is Resistant to Degradation

Another powerful advantage of using binary numbers to represent signals is that binary numbers (ones and zeros) can be reliably reproduced (copied). Let’s explain that idea with an example.

Years ago, popular music was sold in the form of audio cassette tapes containing two spools on which a thin, magnetically coated plastic tape was wound. The analog music signal was represented by the intensity of the magnetism on the tape’s magnetic coating. Now, if you recorded a second cassette tape from an original cassette tape, the second-generation music signal would be somewhat degraded in audio quality. That is, a noticeable low-level audio hiss could be heard in the background of the music on the second-generation cassette tape. And, if you recorded a third cassette tape from a second-generation cassette tape, the ever-increasing amount of audio hiss made the third-generation music signal generally unacceptable in audio quality.

Although cassette-player manufacturers produced dual-tape-drive products so people could make illegal bootleg copies of analog music cassette tapes, the practice never did become very popular.

Unfortunately for the commercial music industry, this situation drastically changed with the advent of compact discs (CDs) containing digital (binary) music signals. Because the digital signals on music CDs are nothing more than sequences of binary ones and zeros, exact duplication of such binary number sequences is simple and reliable. All we have to do is ensure that a one doesn’t get copied as a zero, and vice versa. Because digital signals can easily be copied (reproduced) without error or degradation, bootlegged music CDs have the identical high-fidelity audio quality of the original CDs from which they were copied.

This resistance to signal-quality degradation during recording, transmission, and reproduction is why today’s music audio, telephone audio, Internet video, and television video signals are now implemented as digital signals rather than the old-fashioned analog signals of years past.

Binary Numbers and Analog-to-Digital Converters

As we stated at the beginning of this chapter, binary numbers have a special significance in the field of digital signal processing. That’s because the numerical sample values of all digital signals obtained from analog-to-digital converters are in the form of binary numbers.

For example, in Chapter 4 we used Figure 4-14 and Figure 4-15 to show how the telephone company accepts an analog audio touch-tone keypad signal and converts it to a digital signal (a sequence of numbers). Telephone companies use analog-to-digital converters whose outputs are 8-bit binary numbers. Given what we now know about binary numbers, we can draw an 8-bit digital signal generation process as shown in Figure 9-7. In that figure, we see the individual 8 bits where each arrow exiting the analog-to-digital converter represents a single electrical wire. If there is a voltage on a wire, then that bit is a binary 1. If there is no voltage on a wire, then that bit is a binary 0. A given set of 8 binary bits represents a single number in the binary number system.

Image

Figure 9-7 Digital signal generation showing individual 8-bit analog-to-digital converter output bits.

Commercial analog-to-digital converters are available with outputs that have anywhere from 6 bits to 24 bits. Given that, you might wonder how many bits an analog-to-digital converter should have for converting an analog signal to a digital signal. The answer lies in how accurately we want a digital signal to represent an analog signal.

For example, Figure 9-8(a) shows an analog voltage signal being converted to a 2-bit binary digital signal that is routed to a digital-to-analog converter producing a final analog voltage output. In that figure, we can see that using a 2-bit analog-to-digital converter produces a final output analog voltage that is a very crude version of the original input analog voltage signal. On the other hand, Figure 9-8(b) shows the same scenario using a 4-bit binary analog-to-digital converter. In that figure, we can see that using a 4-bit analog-to-digital converter produces a final output voltage that is somewhat similar to the original input analog voltage signal. Using 4-bit digital signals provided improved performance compared to using only 2 bits.

Image

Figure 9-8 Performance in using 2- and 4-bit digital signals: (a) 2 bits; (b) 4 bits.

The choppy analog output analog signal in Figure 9-8(b) may be acceptable in some signal processing applications, but using only 4 bits for digital signals is unacceptable in voice or music applications. If the analog output analog signal in Figure 9-8(b) was a human voice signal, you would hear the sound of a voice but you’d also hear an intolerable amount of background audio hiss (like the sound of loud static on an AM radio). Figure 9-9 shows the Figure 9-8 conversion scenario when 2-, 4-, 6-, and 8-bit binary numbers are used for the digital signal. In that figure, we see that 8-bit analog-to-digital conversion provides an output analog voltage that’s very similar to the original input analog signal. That’s why 8-bit analog-to-digital conversion is deemed acceptable for landline telephones.

Image

Figure 9-9 Output analog voltage signal quality for 2-, 4-, 6-, and 8-bit binary analog-to-digital conversion.

So why don’t we just use 24-bit analog-to-digital converters for all analog-to-digital conversion applications? The answer is, analog-to-digital converters that have more bits are more difficult to build and more expensive to buy. So if an application only requires an 8-bit analog-to-digital converter for acceptable operation, there’s no need to spend extra money for unnecessary bits. For comparison purposes, Table 9.3 provides a short list of the number of binary bits used in various signal processing applications.

Image

Table 9.3 Digital Signal Applications and Number of Bits Used to Represent an Analog Signal Value

What You Should Remember

The concepts you should remember from this chapter are:

• Digital signals are sequences of numbers, and in digital hardware (computers, cell phones, digital cameras, high-definition televisions), those numbers are in the form of binary numbers.

• A binary number is a sequence of digits in which each digit can have only one of two possible values, zero and one. A single binary digit is called a bit.

• Binary numbers can be used to represent the decimal numbers that we’re so familiar with.

• Binary numbers have the same place-value behavior as our everyday decimal numbers.

• A sequence of binary bits can also represent other information, such as letters of the alphabet.

• We use binary numbers in digital hardware to keep the hardware both reliable and inexpensive.

• The greater the number of bits used for digital signal samples, the more precise (more accurate) are those sample values (see Figure 9-9).

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.15.235.188