# Electronic Essentials: Analogue and Digital Signals, Binary Operations and Logic Gates

Electronics Learning Material
Tutorial IDTitleTutorialVideo
Tutorial
Revision
Notes
Revision
Questions
17.1Electronic Essentials: Analogue and Digital Signals, Binary Operations and Logic Gates

In this Physics tutorial, you will learn:

• What are electronic circuits?
• What are signals? What is the difference between the two types of signals?
• What is the binary system? Why it is used in digital electronics?
• How do we do the four basic operations in binary system?
• What is Boolean Algebra? How is it applied in electronics?
• What are logic gates?
• What are the outputs of each logic gate when the inputs are known?

## Introduction

Have you ever wondered how a computer can make a large number of calculations in a very short time? Or, how is possible that a small microphone is able to amplify the sound, how an electronic microscope can magnify the image by millions of times so that we are able to see the bacteria or viruses?

All these and much more, represent the wonders of electronics - the pride of humanity. Electronics is a fascinating branch of science, which nowadays is in continuous and rapid development.

This tutorial will provide a general overview of electronic essentials, so that you will be able to understand easily the next tutorials of this section, which are more specific.

## Electronic Circuits

An electronic circuit is any circuit containing electronic components such as microchips, capacitors, resistors, diodes, transistors, inductors, coils, transformers etc. Electronic circuits are found in computer-based systems such as PCs, PLCs (programmable logic controllers), TVs, amplifiers, CD players etc.

Most electrical circuit operate at low currents. However, electrical circuits can control very large and powerful circuits through the programs installed in them.

An electronic system works on the base of signals, which are tiny changes in current that occur when the external source oscillates. For example, a sound wave causes the surrounding air to oscillate and as a result, the current in the microphone changes in proportion to the amplitude of sound oscillations. In this way, we obtain oscillating EM signals which when enforced (magnified) are converted again into sound waves in the loudspeaker. In this way, the output sound wave is enforced (magnified) and we therefore hear a stronger (louder) voice.

Obviously, the extra sound power produced does not come from nothing; the power supply brings extra energy to the sound, making it more powerful.

The device used to convert sound waves to EM waves and vice-versa is known as "processor". It is the "brain" of all electronic systems.

Roughly speaking, an electronic system is composed by three main parts: input (sensor), processing unit (processor) and output. Look at the figure:

## Analogue and Digital Signals

In tutorial 16.14 "Alternating Current. LC Circuits", we have explained that the current we get from the power source (AC) is sinusoidal, i.e. it changes in a sinusoidal fashion. Likewise, sound waves can be expressed as sinusoidal waves as well. Therefore, the audio system we mentioned earlier, [i.e. normal sound → input device (microphone) → processor (amplifier) → output device (loudspeaker) → louder sound] is made entirely from sinusoidal signals, which we call analogue.

On the other hand, there are electronic systems, which operate by combining only two types of signals: HIGH and LOW (ON and OFF). These are known as digital signals. In other words, in digital systems there is a fixed number of known inputs and outputs which are combined together to give a certain result.

The difference between analogue and digital signals is shown in the figure below.

Digital signals are produced when there are only two possible input voltages: 0V (LOW) and 5V (HIGH). Symbolically, the LOW voltage is denoted as 0 and the HIGH voltage is denoted by 1. This is just for convenience, i.e. to make these values appear easier on the screen. If we consider only one of these signals (one 0 or 1), this represents a bit (binary digit).

For example, if you see on the screen the number 10110010, you may think it as the scheme below.

Any combination of 8 bits as in the above example, represents one Byte. In other words, 1 Byte represents the number obtained by the combination of 8 different input signals (either 0V or 5V input voltages).

## Number Systems. Binary System

In daily life, we use the decimal system to represent numbers. This is a base 10 number system, i.e. there are 10 digits used to represent the numbers. These digits are: 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9. We can write every number by combining these 10 digits. In the decimal system, the value of a certain digit increases 10 times when moving from right to left.

The digits in the decimal system are placed in their place value. The smallest place value is that of units (ones); it is the rightmost digit of the number. Then, there are tens, then hundreds and so on. Look at the figure below.

The number 304197 can split as

304197 = 3 × 100000 + 0 × 10000 + 4 × 1000 + 1 × 100 + 9 × 10 + 7 × 1

This number can be expressed in terms of powers of tens as

304197 = 3 × 105 + 0×104 + 4 × 103 + 1 × 102 + 9×101 + 7× 100

(Recall that 100 = 1).

In digital electronics however, we use the binary system instead of decimal system. As stated earlier, the binary system includes only two digits: 0 and 1. This system is used for convenience, as it is much easier for computers to recognize and process only two types of signals instead of ten types of different signals contained in the decimal number system. In this regard, a decimal number written as a combination of only two digits: 0 and 1, represents a binary number, whose place values are powers of 2 instead of powers of 10.

The similarity between these two number system consists on the value of place values, which increase from right to left in both systems. However, in binary system a given digit has twice the value of the same digit on its left. In the decimal system, this factor of increase is 10 times.

For example, the value of binary number 10110010 when written using the decimal system is

(10110010)2 = 1 × 27 + 0 × 26 + 1 × 25 + 1 × 24 + 0 × 23 + 0 × 22 + 1 × 21 + 0 × 20
= 1 × 128 + 0 × 64 + 1 × 32 + 1 × 16 + 0 × 8 + 0 × 4 + 1 × 2 + 0 × 1
= 128 + 32 + 16 + 2
= 178

Thus, the binary number 10110010 corresponds to 178 in the decimal system.

We can convert a decimal number to a binary one as well. For this, we must consider the remainders of the division by two and write them from the last to the first. For example, if we want to express the number 89 as a binary number, we obtain

89 ÷ 2 = 44 (1)
44 ÷ 2 = 22 (0)
22 ÷ 2 = 11 (0)
11 ÷ 2 = 5 (1)
5 ÷ 2 = 2 (1)
2 ÷ 2 = 1 (1)
1 ÷ 2 = 0 (1)

Thus, when taking the remainders form the last to the first, we get the equivalent number of 89 written in the binary system:

(89)10 = (1111001)2

If we write the above number according the scheme used earlier, we have for the above number:

Another number system which is worth to discuss and which is widely used in digital electronics is the hexadecimal system. It is a number of system containing 16 digits, from 0 to 15. However, the numbers from 10 to 15 are expressed using the letters from A to F. For example, the decimal equivalent of the hexadecimal number A8B3 is

(A8D3)16 = 10 × 163 + 8 × 162 + 13 × 161 + 3 × 160= 10 × 4096 + 8 × 256 + 13 × 16 + 3 × 1= 40960 + 2048 + 208 + 3= (43219)10= 43 219

For decimal numbers it is not necessary to write the base as a subscript.

## Binary Arithmetic

We can do the four basic operations (addition, subtraction, multiplication and division) in the binary system in the same way as we them do in the decimal system. The only difference is that in addition, the value of the digit on the left increases by 1 when the value on its right becomes 2 (like in decimal system in which the value of the digit on the left increases by 1 when the place value on its right becomes 10). On the other hand, in subtraction we borrow 2 instead of 10 from the place value on the right to make the subtraction when this is impossible. Let's consider a couple of examples in this regard.

### Example 1

Do the following operations:

1. (11000101)2 + (01111010)2
2. (11001100)2 + (00111001)2

### Solution 1

We can write the numbers in columns to make the operations easier. Thus, we have:

In multiplication, we can use the same procedure as used in the decimal system as well. Putting the numbers in column is very helpful. For example, if we have to multiply (1101)2 and (101)2, we get

If you are in doubt about the correctness of your result, you can quickly convert the numbers in base 10 numbers and do the multiplication. This can be used as a proof for your work. Thus, (1101)2 = 8 + 4 + 1 = (13)10 and (101)2 = 4 + 1 = (5)10. Therefore, we have 13 × 5 = 65 for the product. Let's check whether (1000001)2 = (65)10. We have

(1000001)2 = 1 × 26 + 0 × 25 + 0 × 24 + 0 × 23 + 0 × 22 + 0 × 21 + 1 × 20
= 64 + 1
= 65

Therefore, the result obtained by the binary multiplication is correct.

As for the division of binary numbers, we use the same procedure as in decimal system. For example, we known that 12 ÷ 4 = 3. When this division is done in the binary system, we obtain:

Thus, we obtained (1100)2 ÷ (100)2 = (11)2

We can also express the decimal numbers written in base 10 number system using the decimal place to divide the whole and the non-whole part of the number. For example, the binary number 11010.101 corresponds to

(11010.101)2 = 1 × 24 + 1 × 23 + 0 × 22 + 1 × 21+0 × 20 + 1 × 2-1 + 0 × 2-2 + 1 × 2-3
= 16 + 8 + 2 + 1/2 + 1/8
= 26 + 4 + 1/8
= 26 5/8
= 26.625

in the decimal system. Obviously, not all decimal numbers can be converted into binary ones; they must be powers of 2 to do this.

## Boolean Algebra. Logic Gates

The English mathematician George Boole introduced several relationships between the mathematical quantities that contain only two values: either True or False, which as explained earlier, can also be denoted by a 1 or 0 respectively. This system was later given the name "Boolean Algebra". The results of all mathematical operations performed on these values can also possess only two values: 1 or 0.

Logic gates are small electronic devices. They contain two inputs and a single output which perform a Boolean function. Obviously, all data in logic gates are binary digits.

The seven basic operations of Boolean Algebra are: AND, OR, NOT, NAND, NOR, XOR and XNOR. We will explain below the logic of each of these operations.

### 1: AND operation

This operation gives TRUE (otherwise known as HIGH or 1) as an output when all inputs are TRUE (otherwise known as HIGH or 1). This operation is similar to intersection of sets in the set theory in mathematics, in which an element belongs to the intersection set only if it is an element of each individual set. Recall that sometimes the intersection of set is also represented through the multiplication symbol ( · ).

The AND operation is represented by the symbol ( ˄ ) and in electronic diagrams is shown by:

The following truth table gives the relationship between inputs and output for the AND logic operation.

### 2: OR operation

This operation gives TRUE (otherwise known as HIGH or 1) as an output when at least one of inputs is TRUE (otherwise known as HIGH or 1). This operation is similar to union of sets in the set theory in mathematics, in which an element belongs to the union set if it is an element of either of individual sets. Recall that sometimes the intersection of set is also represented through the addition symbol ( + ).

The OR operation is represented by the symbol ( ˅ ) and in electronic diagrams is shown by:

The following truth table gives the relationship between inputs and output for the OR logic operation.

#### Example 2

Draw a logic diagram for:

1. (A + B) · (C + D)
2. A · B + C · D
3. A + B · C
4. (A + B) · C

#### Solution 2

1. The symbol ( · ) stands for AND and the symbol ( + ) for the OR operation. Thus, we have:
2. In this case, the results of two AND operations form an OR one. Thus, we obtain:
3. Here we have only three inputs, A , B and C, where the output of AND operation of inputs A and B forms an OR operation with the input C. Hence, we obtain the following diagram:
4. In this case, the output of the OR operation of inputs A and B forms an AND operation with the input C. Hence, we obtain the following diagram:

### 3: NOT operation

This is a logic operation that inverts the value of input. This means when the input is 1 the output is 0 and when the input is 0 the output is 1.

The NOT operation is shown symbolically through a horizontal line above the input letter (the negation symbol). The symbol used in schematic diagrams for the NOT operation is shown below:

The NOT operation does not require necessarily the presence of two inputs. One input is enough to reverse the result of the corresponding output. The truth table for NOT operation is:

#### Example 3

Draw a logic diagram for A ∙ B + C

#### Solution 3

The input of B is first reversed through the NOT operation. Then, it forms an AND operation with the input A. The output of this operation forms an OR operation with the input C.

Thus, we obtain the following diagram:

### 4: NAND operation

NAND is an abbreviation for NOT AND. Thus, a NAND logic operation reverses the output of the corresponding AND. It is represented mathematically through the symbol A∧B or simply A∙B, while in circuit diagrams the NAND operation is represented through the symbol shown in the figure below:

The truth table for NAND logic operation is:

#### Example 4

1. Draw a logic diagram for A · B + A + C
2. What is the output signal if all inputs are HIGH (or 1)?

#### Solution 4

1. The output of NAND logic operation for the inputs A and B forms an OR logic operation with the output of OR operation between the input A and the NOT input C. Thus, we obtain the following diagram:
2. If all inputs are 1, then A · B = 1. This means the corresponding NAND operation is A ∙ B= 0.
On the other hand, since input C = 1, the corresponding NOT operation is C = 0. Thus, A + C = 1 because this is an OR logic operation which gives 1 when at least one input is 1 (here we have input A = 1).
Therefore, the output of this logic expression is 1 as there is another OR operation between the two above outputs where the first is 0 and the second is 1. This means the output signal gives HIGH.

### 5: NOR operation

NOR is an abbreviation for NOT OR. Thus, a NOR logic operation reverses the output of the corresponding OR. It is represented mathematically through the symbol A ∨ B or simply A + B, while in circuit diagrams the NOR operation is represented through the symbol shown in the figure below:

The truth table for the NOR logic operation is:

#### Example 5

1. Draw a logic diagram for A + B + B · C
2. What is the output signal if all inputs are LOW (or 0)?

#### Solution 5

1. The operation A + B is a NOR logic operation while the operation of B and C is an OR type. But first, the input of C must be reversed (C means NOT C).
On the other hand, the two above outputs are connected through an OR logic operation. Therefore, we obtain the following diagram:
2. Since the inputs A and B are both 0, the OR operation A + B is 0 as well. Therefore, the corresponding NOR operation A + B gives 1.
On the other hand, since the input C is 0, the corresponding NOT operation C is 1. Therefore, the OR operation B · C is 0 · 1 = 0.
Finally, the output of the OR operation A + B + B · C is:
A + B + B · C
= 1 + 0
= 1

Therefore, the output signal is HIGH (or 1).

### 6: XOR operation

XOR is an abbreviation for EXCLUSIVE OR. It gives HIGH (or 1) when both inputs are the same (both 0 or both 1) and it gives LOW (or 0) when the two inputs are different. The mathematical symbol of XOR logic operation is ⨁ and the corresponding logic gate in a circuit diagram is shown as:

The truth table for the XOR logic operation is:

#### Example 6

1. Draw a logic diagram for A + (B ⨁ C)
2. Find the value of output if input A = 1, input B = 0 and input C = 1.

#### Solution 6

1. The inputs B and C are connected to each other through the XOR logic operation. Their output forms an OR logic operation to the NOT gate of input A. Hence, we obtain:
2. Since input A = 1, then A = 0 because this is a NOT operation. On the other hand, since input B = 0 and input C = 1, the corresponding XOR operation gives 0 (see the truth table above). Therefore, we have two new 0 inputs which are connected via an OR operation. From the truth table of OR logic operation, it is clear that the result (output) of this operation gives 0 as well (no signal).

### 7: XNOR operation

XNOR is an abbreviation for EXCLUSIVE NOR (EXCLUSIVE NOT OR). In this logic operation, there is an inversion on the NOR gate to get the XNOR gate. The output is just opposite to that of the XOR gate. If any of the inputs is high (1) excluding the condition of both, the output is low or 0.

The mathematical symbol that expresses the XNOR logic operation is ⨀. This logic operation is shown in circuit diagrams by the following symbol:

The truth table for the XNOR logic operation is:

#### Example 7

1. Draw a logic diagram for A ⊕ (B ⊙ C)
2. Find the output if all inputs are HIGH (or 1).

#### Solution 7

1. The XNOR logic operation between input B and the inverse (NOT) of the input C forms a XOR logical operation to the inverse (NOT) of the input A. Hence, we obtain the following diagram:
2. If the inputs A, B and C are all 1, then A = 0 and C = 0. The XNOR logic operation B ⊙ C therefore gives 1 because the inputs are different.
Therefore, the XOR operation between A and B ⊙ C gives 0 because one of inputs is 0 and the other is 1. Hence, the output is 0.

## Whats next?

Enjoy the "Electronic Essentials: Analogue and Digital Signals, Binary Operations and Logic Gates" physics tutorial? People who liked the "Electronic Essentials: Analogue and Digital Signals, Binary Operations and Logic Gates" tutorial found the following resources useful:

1. Physics tutorial Feedback. Helps other - Leave a rating for this tutorial (see below)
2. Electronics Revision Notes: Electronic Essentials: Analogue and Digital Signals, Binary Operations and Logic Gates. Print the notes so you can revise the key points covered in the physics tutorial for Electronic Essentials: Analogue and Digital Signals, Binary Operations and Logic Gates
3. Electronics Practice Questions: Electronic Essentials: Analogue and Digital Signals, Binary Operations and Logic Gates. Test and improve your knowledge of Electronic Essentials: Analogue and Digital Signals, Binary Operations and Logic Gates with example questins and answers
4. Check your calculations for Electronics questions with our excellent Electronics calculators which contain full equations and calculations clearly displayed line by line. See the Electronics Calculators by iCalculator™ below.
5. Continuing learning electronics - read our next physics tutorial: Electronic Components and Switching