Chapter 1

Understanding Digital Electronics

In This Chapter

arrow Comparing analogue and digital circuits

arrow Counting in binary code

arrow Building simple logic circuits with switches and lamps

Welcome to the world of digital electronics. In this chapter, you discover the fundamental building-block circuits that you can use ultimately to create computers and other advanced electronic devices. This material sets you up nicely for the other chapters in this minibook, where you explore the amazing world of digital electronics.

This area of electronics is a complex, almost-overwhelming topic, but fortunately the essentials are fairly simple. We introduce you to the basic principles, such as the differences between analogue and digital circuits and how the binary system and basic logic operations work.

Hang on in there! Digital electronics really isn’t as hard as you may expect.

Distinguishing Analogue and Digital Electronics

Electronics can be divided into two broad categories:

check.png Analogue electronics: Refers to circuits in which quantities such as voltage or current vary at a continuous rate. When you turn the dial of a potentiometer, for instance, you change the resistance by a continuously varying rate. The resistance of the potentiometer can be any value between the minimum and maximum allowed by the pot. We talk more about potentiometers in Book II, Chapter 6.

If you create a voltage divider by placing a fixed resistor in series with a potentiometer, the voltage at the point between the fixed resistor and the potentiometer increases or decreases smoothly as you turn the knob on the potentiometer.

check.png Digital electronics: Quantities are counted rather than measured and they vary in discrete steps. The term digital is a reference to your digits. The most natural way for humans to count is with their fingers.

A good everyday example of this difference is in clock faces. Figure 1-1 shows two clocks: one analogue and the other digital. On the analogue clock, the time is shown by hands that spin around a dial. The hands move continuously and therefore show an infinite number of positions. On a digital clock, a numeric display indicates the time in numbers. It counts the time in seconds and minutes, for example.

9781118589717-fg060101.eps

Figure 1-1: An analogue clock (left) and a digital clock (right).

Another example is the thermometer. A traditional glass–mercury thermometer has a small amount of liquid mercury inside a glass column. Mercury expands when it gets warm, and so the warmer the mercury, the higher it climbs in the glass column. Little tick marks are printed on the column to help you read the temperature. On a digital thermometer, the temperature is indicated by a numeric display.

Understanding Binary

Most digital electronic circuits work with the binary number system. Therefore, to comprehend the details of how digital circuits work you need to understand the workings of the binary numbering system.

remember.eps Saying that a system is digital isn’t the same as saying that it’s binary. Binary is a particular type of digital system in which the counting is all done with the binary number system, using only the numerals 0 and 1. Nearly all digital systems are also binary systems, but the two terms aren’t interchangeable.

Many systems are a combination of binary and analogue systems. In a system that combines binary and analogue values, special circuitry is required to convert from analogue to digital or vice versa. An input voltage (analogue) may be converted to a sequence of pulses, one for each volt. The pulses can then be counted to determine the voltage.

Knowing your number systems

A number system is simply a way of representing numeric values. Number systems use symbols called numerals to represent numeric quantities. The numerals 1, 2 and 3 represent the numeric quantities commonly known as one, two and three.

In most number systems, numerals can be strung together to create larger numeric values, and the position of each numeral in the string determines its relative value. For example, in the number 12, numeral 1 represents the quantity ten and numeral 2 represents the quantity two. In the number 238, numeral 2 represents the quantity two hundred, numeral 3 represents the quantity thirty and numeral 8 represents the quantity eight.

This system is so familiar that you can easily miss its brilliance and overlook the fact that it’s completely arbitrary.

People have ten numerals in the everyday counting system – called the decimal system or base 10 – probably as a result of the fact that humans have ten fingers. If humans had evolved with 12 fingers, you may well have learned how to count in base 12 and be using two additional invented numerals.

tip.eps Different number bases may seem strange, but you encounter them every day without thinking about it. One common example is the system for keeping time, which works in several different number bases. An hour contains 60 minutes, for example, and you recognise straight away that 1:30 is halfway between 1:00 and 2:00. You may not realise it, but you’re thinking in base 60 when you tell the time.

Counting by ones

Binary is one of the simplest of number systems because it has only two numerals: 0 and 1. In the decimal system, you use ten numerals: 0 through 9. In an ordinary decimal number, such as 3,482, the rightmost digit represents ones, the next digit to the left tens, the next hundreds, the next thousands and so on. These digits represent powers of ten: first 100 (which is 1); next 101 (10); then 102 (100); then 103 (1,000) and so on.

In binary, you have only two numerals rather than ten, which is why binary numbers look somewhat monotonous, as in 110011, 101111 and 100001.

remember.eps The positions in a binary number (called bits rather than digits) represent powers of two rather than powers of ten: 1, 2, 4, 8, 16, 32 and so on. To figure out the decimal value of a binary number, you multiply each bit by its corresponding power of two and then add the results. You calculate the decimal value of binary 10111, for example, as follows:

9781118589717-eq0601001.eps

Fortunately, converting a number between binary and decimal is something that a computer is good at – so good, in fact, that you’re unlikely ever to need to do any conversions yourself. The point of understanding binary isn’t to be able to look at a number such as 1110110110110 and say instantly, ‘Ah! Decimal 7,606!’ (If you can do that, Hollywood may make a film about you with Dustin Hoffman in the lead role.)

Instead, the point is to have a basic understanding of how computers store information and – most importantly – of how the binary counting system works.

If you do find that you need to convert binary numbers to decimal, or vice versa, and you have access to a computer, you can use the Calculator program that comes free with Windows to do the conversion for you. For more information, see the later sidebar ‘Using Windows Calculator for binary conversions’.

Here are some interesting characteristics of binary, which explain how the system is similar to and different from the decimal system:

check.png In decimal, the number of decimal places allotted for a number determines how large the number can be. If you allot six digits, for example, the largest number possible is 999,999. Because 0 is itself a number, however, a 6-digit number can have any of 1 million different values.

Similarly, the number of bits allotted for a binary number determines how large that number can be. If you allot 8 bits, the largest value that number can store is 11111111, which happens to be 255 in decimal. Thus, a binary number that’s 8 bits long can have any of 256 different values (including 0).

check.png tip.eps To work out quickly how many different values you can store in a binary number of a given length, use the number of bits as an exponent of two. An 8-bit binary number, for example, can hold 28 values. Because 28 is 256, an 8-bit number can have any of 256 different values. This is why a byte – 8 bits – can have 256 different values.

check.png technicalstuff.eps The ‘powers of two’ thing is why digital systems don’t use nice, even, round numbers for measuring such values as memory capacity. A value of 1 k, for example, isn’t an even 1,000 bytes: it’s 1,024 bytes because 1,024 is 210. Similarly, 1 MB isn’t an even 1,000,000 bytes, but 1,048,576 bytes, which happens to be 220.

All good geeks know their powers of two because they play such an important role in binary numbers. Just for the fun of it, but not because you need to know, Table 1-1 lists the powers of two up to 32. The table also shows the common shorthand notation for various powers of two. The abbreviation k represents 210 (1,024). The M in MB stands for 220, or 1,024 k, and the G in GB represents 230, which is 1,024 MB.

tb060101

A saying among computer programmers goes as follows: there are ten types of people in this world – those who know binary and those who don’t. If you understand that, you’re already thinking in binary!

Doing the logic thing

One of the great things about binary is that it’s very efficient at handling special operations called logical operations, which compare two binary bits and render a third binary bit as a result. Logic circuits can use combinations of these logical operations to do very complex tasks.

In total, 16 possible logical operations exist and you can discover all 16 in Book VI, Chapter 2. Here, however, we introduce you to three basic logical operations:

check.png AND: An AND operation compares two binary values. If both values are 1, the result of the AND operation is 1. If one value is 0 or both of the values are 0, the result is 0.

check.png OR: An OR operation compares two binary values. If at least one of the values is 1, the result of the OR operation is 1. If both values are 0, the result is 0.

check.png XOR: An XOR operation compares two binary values. If exactly one of them is 1, the result is 1. If both values are 0 or if both values are 1, the result is 0.

Table 1-2 summarises how AND, OR and XOR work.

tb060102

You can apply logical operations to binary numbers that have more than one binary digit by applying the operation one bit at a time. The easiest way to do this manually is to line the two binary numbers on top of one another and then write the result of the operation below each binary digit. The following example shows how to calculate 10010100 AND 11011101:

9781118589717-eq0601002.eps

As you can see, the result is 10010100.



Using Switches to Build Gates

In Book II, Chapter 6, you read about gates in relation to transistors. But to give you a good idea of how basic gates work in digital circuits, we provide Projects 1-1, 1-2 and 1-3, which show you how to assemble an AND gate, an OR gate and an XOR gate, respectively (see the preceding section for descriptions of these three logical operations). Each gate uses simple DPDT (double pole, double throw) knife switches (for descriptions of DPDT and knife switches, turn to Book II, Chapter 1). Figure 1-2 shows these three projects fully assembled:

check.png AND gate circuit (Project 1-1): On the left of the figure. As you can see, the AND gate is implemented by connecting two switches together in series. Both switches need to be closed for the lamp to light.

check.png OR gate circuit (Project 1-2): In the middle of the figure. To implement an OR gate with switches, you simply wire the switches in parallel. The lamp lights if either of the switches is closed.

check.png XOR gate circuit (Project 1-3): On the right of the figure. This wiring is a bit trickier. The DPDT switches are cross-connected in such a way that the circuit to the lamp is completed if one of the switches is in the A position and the other is in the B position. If both switches are in the same position, the circuit isn’t complete and so the lamp doesn’t light.

9781118589717-fg060102.eps

Figure 1-2: Implementing AND, OR and XOR gates with knife switches.

9781118589717-un060101_a.eps

9781118589717-un060101_b.eps

9781118589717-un060102_a.eps

9781118589717-un060102_b.eps

9781118589717-un060103_a.eps

9781118589717-un060103_b.eps

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

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