Exercises: Logic gates and digital circuits
Explain what a digital signal is and how it differs from an analogue signal, giving an everyday example of each.
Explain what a digital signal is and how it differs from an analogue signal, giving an everyday example of each.
Write the truth table of a NOT gate and explain its behavior with an example: an indicator light that comes on when a machine is NOT running.
Write the truth table of a NOT gate and explain its behavior with an example: an indicator light that comes on when a machine is NOT running.
The figure shows three logic gates with their truth tables, in which two output values are missing. Fill in the missing values and write the name of each gate.
The figure shows three logic gates with their truth tables, in which two output values are missing. Fill in the missing values and write the name of each gate.
Write the complete truth table of a two-input OR gate and explain its behavior with an example: two doorbells, one on each floor, that sound the same chime.
Write the complete truth table of a two-input OR gate and explain its behavior with an example: two doorbells, one on each floor, that sound the same chime.
If an AND gate receives A = 1 and B = 0, what is its output value? What if it were an OR gate with the same inputs? Reason each answer.
If an AND gate receives A = 1 and B = 0, what is its output value? What if it were an OR gate with the same inputs? Reason each answer.
Explain in your own words what a NOT gate does and describe its symbol. Give an example: a green indicator light that comes on when a machine is NOT faulty.
Explain in your own words what a NOT gate does and describe its symbol. Give an example: a green indicator light that comes on when a machine is NOT faulty.
Classify these signals as analogue or digital and justify your answer: the volume knob on an audio dial, a light switch, the temperature shown on a mercury thermometer,…
Classify these signals as analogue or digital and justify your answer: the volume knob on an audio dial, a light switch, the temperature shown on a mercury thermometer, and the status of a door (open or closed).
How many rows does the truth table of a circuit with two inputs have? And with three? Deduce the general rule for $n$ inputs and test it with four.
How many rows does the truth table of a circuit with two inputs have? And with three? Deduce the general rule for $n$ inputs and test it with four.
Write the complete truth table of a two-input AND gate and describe a real-world situation that works with the same logic, for example in gate security or account…
Write the complete truth table of a two-input AND gate and describe a real-world situation that works with the same logic, for example in gate security or account security.
A warehouse wants the alarm to sound if the door is opened or the window is opened. State which logic gate reproduces this behavior and write its truth table using A =…
A warehouse wants the alarm to sound if the door is opened or the window is opened. State which logic gate reproduces this behavior and write its truth table using A = door open, B = window open and S = alarm sounding.
A circuit connects a NOT gate to the output of an AND gate. Complete its truth table and find out what this combined gate is called: $$\begin{array}{c c | c} A & B & S…
A circuit connects a NOT gate to the output of an AND gate. Complete its truth table and find out what this combined gate is called:
$$\begin{array}{c c | c} A & B & S \\ \hline 0 & 0 & \\ 0 & 1 & \\ 1 & 0 & \\ 1 & 1 & \end{array}$$Write the truth table of a three-input OR gate (A, B and C) and explain in a single sentence in which case its output is 0.
Write the truth table of a three-input OR gate (A, B and C) and explain in a single sentence in which case its output is 0.
A system waters only when the soil is dry (H = 1 means "dry soil") and it is also night time (N = 1 means "it is night time"). Which logic gate reproduces this behavior?…
A system waters only when the soil is dry (H = 1 means "dry soil") and it is also night time (N = 1 means "it is night time"). Which logic gate reproduces this behavior? Write its truth table with the names of the variables.
The figure shows a circuit with two gates: inputs A and B go into an AND gate, and its output along with C goes into an OR gate. Write the complete truth table of the…
The figure shows a circuit with two gates: inputs A and B go into an AND gate, and its output along with C goes into an OR gate. Write the complete truth table of the circuit and calculate the value of S for the specified case.
Explain what happens when two NOT gates are connected one after the other and prove it by writing the truth table for the combination. What is this equivalence called in…
Explain what happens when two NOT gates are connected one after the other and prove it by writing the truth table for the combination. What is this equivalence called in logic?
An obstacle detector gives an output of 1 when there is NO obstacle in front. Your robot needs to turn on an indicator light precisely when there IS an obstacle. Which…
An obstacle detector gives an output of 1 when there is NO obstacle in front. Your robot needs to turn on an indicator light precisely when there IS an obstacle. Which gate do you add between the sensor and the indicator light? Justify your answer using the truth table.
A fan must switch on ($F = 1$) only when it is hot ($C = 1$) and the user allows it ($P = 1$), but never when the window is open ($V = 1$). A classmate has built the…
A fan must switch on ($F = 1$) only when it is hot ($C = 1$) and the user allows it ($P = 1$), but never when the window is open ($V = 1$). A classmate has built the control with two logic gates: an AND gate combining $C$ and $P$, and an OR gate combining that result with $V$, as shown in the diagram. When tested in the workshop, the fan switches on whenever the window is open, even in the middle of winter!
- a) Draw up the truth table of your classmate's circuit and point out the cases where it does not meet the specification.
- b) Explain the conceptual mistake of using the OR gate with $V$.
- c) Design the correct circuit: write the simplified logic function and state the gates needed.
In a parking lot, the barrier raises if a car is detected and the driver presses the button; a red indicator light must be ON whenever the barrier is not raising. Design…
In a parking lot, the barrier raises if a car is detected and the driver presses the button; a red indicator light must be ON whenever the barrier is not raising. Design the logic circuit diagram using gates (name them and draw or describe it) and write the truth table for the set.
Imagine a critical safety system in an industrial boiler with two independent overtemperature sensors (T1 and T2). There is a debate over whether to trigger the…
Imagine a critical safety system in an industrial boiler with two independent overtemperature sensors (T1 and T2). There is a debate over whether to trigger the emergency stop (P) using AND logic (P = T1 · T2) or using OR logic (P = T1 + T2). Analyse how each option behaves in the face of two real faults:
-
One of the sensors fails and gets stuck at 0 (does not detect heat).
-
One of the sensors short-circuits and gets stuck at 1 (continuous false alarm).
Justify which of the two architectures prioritises "fail-safe" operation (avoiding an explosion at all costs) and which one prioritises "availability" (avoiding unnecessary, costly shutdowns), and propose what intermediate logical solution is used in industry if you add a third redundant sensor (T3).
In the Technology workshop you only have 7400 integrated circuits available, which contain exclusively two-input NAND gates. You need to implement the acoustic warning…
In the Technology workshop you only have 7400 integrated circuits available, which contain exclusively two-input NAND gates. You need to implement the acoustic warning system for a machine, whose simplified logic function is S = A + NOT B.
- a) Apply De Morgan's laws to transform this function into an equivalent expression that uses exclusively NAND operations and negations.
- b) Demonstrate how to construct a NOT gate using only a NAND gate and write its truth table.
- c) Draw or describe step by step the resulting circuit diagram using only two-input NAND gates, indicating the total number of gates required and explaining whether any of them can be simplified.
In an industrial washing machine, the spin cycle (C) must only be activated if the door is locked (P = 1), there is no laundry overload (S = 0), and water drainage is…
In an industrial washing machine, the spin cycle (C) must only be activated if the door is locked (P = 1), there is no laundry overload (S = 0), and water drainage is confirmed. To measure the water, two independent redundant pressure switches are installed (A1 and A2, where 1 indicates an empty tank). The spin cycle can only start if both sensors confirm that there is no water (A1 = 1 and A2 = 1). In addition, a fault warning light (V = 1) must turn on whenever the two pressure switches disagree with each other (sensor fault), regardless of the door or load status.
- a) Obtain the logic function and the truth table for the spin cycle (C) and for the fault signal (V).
- b) Which elementary logic gate directly solves the fault condition V? Justify your answer.
- c) Explain why this redundant design is safer than using a single pressure switch.
A student claims: "Since an OR gate outputs 1 when any of its inputs is 1, I connect three perimeter alarm sensors (S1, S2, S3) to a single three-input OR gate and that…
A student claims: "Since an OR gate outputs 1 when any of its inputs is 1, I connect three perimeter alarm sensors (S1, S2, S3) to a single three-input OR gate and that way I will be able to identify on the caretaker's screen exactly which of the three zones has been breached."
- a) Refute their claim by analysing the amount of information: how many possible states can a single binary output transmit, and how many states would you need to distinguish to know whether there is no alarm or which of the three zones has been triggered?
- b) Design the truth table of an encoder that, with three inputs (S1, S2, S3), provides two binary outputs (Y1, Y0) to identify which sensor is at 1 (assuming that only one is activated at a time, and that if none are active the output is 00).
- c) What problem would arise in this circuit if two intruders simultaneously trigger two sensors at the same time?
A technician is designing the control system for a pedestrian green light ($V$) at a tram track crossing. The circuit has three binary input signals: Tram sensor:…
A technician is designing the control system for a pedestrian green light ($V$) at a tram track crossing. The circuit has three binary input signals:
-
Tram sensor: $T = 1$ if a tram is approaching and $T = 0$ if the track is clear.
-
Pedestrian push-button: $P = 1$ if there are waiting pedestrians who have pressed the button and $P = 0$ if it has not been pressed.
-
Night mode: $N = 1$ during the night and $N = 0$ during the day.
The safety specification requires that the green pedestrian light can only turn on ($V = 1$) when no tram is approaching ($T = 0$) and at least one of the following two conditions is met: a pedestrian has pressed the button ($P = 1$) or the system is in night mode ($N = 1$, to allow periodic automatic crossing). Under no circumstances should it turn on if the tram is coming ($T = 1$).
The technician hastily proposes the logic function: $V = (P \times \overline{T}) + N$.
- a) Construct the truth table for the technician's proposal and point out which input combinations will cause a risk of an imminent collision (green pedestrian light with an approaching tram).
- b) Correct the logic function so that it strictly complies with all safety requirements and draw the circuit schematic using basic logic gates (NOT, AND, OR).
- c) Analyse what would happen if sensor $T$ fails and the circuit permanently interprets a low level ($T = 0$): is the system fault-tolerant to this failure or does it create a hazardous situation? Justify your answer.
To illuminate the porch of a house, two automatic control proposals with three sensors are analysed: motion detector (P = 1), dusk/night sensor (N = 1), and manual…
To illuminate the porch of a house, two automatic control proposals with three sensors are analysed: motion detector (P = 1), dusk/night sensor (N = 1), and manual party/override switch (M = 1 to force continuous lighting):
-
Proposal 1: L1 = M + (N · P)
-
Proposal 2: L2 = (M + N) · P
- a) Construct a comparative truth table for both proposals with the 8 possible combinations of M, N, and P.
- b) Analyse in which combinations the behavior of the two systems differs and explain what practical problem Proposal 2 would present if the users are sitting having dinner on the porch without moving, or if they need light during the day to clean.
- c) Reason which of the two designs better optimises the balance between user comfort and energy efficiency, justifying your choice with data from the table.