Sub topic 12
Binary signals and logic levels
This chapter assumes you know basic AC and DC, Ohm's law, and how to read a voltage-versus-time graph. It introduces the digital signals that logic gates process. The gates come in the next chapters.
Analog and digital signals
An analog signal can take any value in a range. A sine wave from an AC supply is an example, and so is the output of a microphone.
A digital signal takes only a small set of distinct values. In digital electronics that set has two members. The signal is either high or low, and nothing is read in between.
Two values are enough because they are easy to tell apart. A circuit only has to decide which side of a threshold the voltage is on. Small noise or drift in the voltage does not change the answer.
Binary digits and logic levels
A binary digit, or bit, is a quantity that is 0 or 1. Each bit is carried by a voltage level.
- Logic 1 is the high level. It is a voltage near the supply voltage, for example 5 V.
- Logic 0 is the low level. It is a voltage near 0 V.
This is called positive logic, and NEET problems use it. Negative logic swaps the two assignments. It is rarely tested.
A real gate does not need an exact voltage. It accepts a range for each level. For a 5 V circuit, the table below shows typical ranges.
| Voltage range | Interpreted as |
|---|---|
| 0 V to about 0.8 V | Logic 0 (low) |
| About 0.8 V to 2.0 V | Undefined, avoid |
| About 2.0 V to 5 V | Logic 1 (high) |
The undefined zone is the reason designers keep signals clearly high or clearly low.
A signal over time
A digital waveform switches between the two levels. The diagram shows how a gate input might be read as a bit sequence.
Turning voltages into bits
The short program below does what the diagram describes. It reads a list of voltage samples and converts each to a bit, using a threshold of 2.0 V.
threshold = 2.0 # volts, minimum voltage read as logic 1
samples = [0.1, 4.9, 5.0, 0.3, 4.8, 0.0]
bits = [1 if v >= threshold else 0 for v in samples]
print(bits)The output is [0, 1, 1, 0, 1, 0]. Notice that 4.8 V and 5.0 V both become 1. Small differences in voltage do not matter once the signal is digital.
Common errors
- Treating logic 0 as "no signal" or a broken wire. A low level is a valid, actively driven value.
- Reading a voltage as a decimal quantity. A signal of 5 V does not mean "five". It means logic 1.
- Forgetting that a 1 is defined by the circuit's supply voltage. In a 3.3 V circuit, logic 1 is near 3.3 V.
- Mixing up positive and negative logic when reading a problem. Assume positive logic unless the question says otherwise.
Why this matters for gates
A logic gate is a circuit whose output level depends on the levels of its inputs. The next chapter gives each gate a truth table, which lists the output for every input combination. With n inputs there are 2 to the power n rows. A two-input gate has 4 rows. A three-input gate has 8.
Exercise
A circuit uses positive logic with a 5 V supply. Inputs A and B are read at 4.7 V and 0.2 V. What bits do they represent? How many rows would a truth table for a three-input gate have?
Show answer
A = 4.7 V is near the supply, so A = 1. B = 0.2 V is near 0 V, so B = 0. A three-input gate has 2^3 = 8 rows in its truth table.
Exercise
A signal sampled at equal intervals reads 0.2 V, 4.6 V, 4.9 V, 0.1 V in a 5 V positive-logic circuit. Write the bit sequence. Then write it again for negative logic.
Show answer
Positive logic: 0, 1, 1, 0. Negative logic swaps the meanings, so the sequence reads 1, 0, 0, 1.