Файл: Digital design with CPLD applications and VHDL (R. Dueck, 2000).pdf
ВУЗ: Не указан
Категория: Не указан
Дисциплина: Не указана
Добавлен: 13.06.2025
Просмотров: 8117
Скачиваний: 6
7.2 • NAND/NOR Latches |
287 |
WYSIWYG synthesis, resulting in unequal delays from the inputs to the Q output, which can lead to instability.
Latch as a Switch Debouncer
Pushbutton or toggle switches are sometimes used to generate pulses for digital circuit inputs, as illustrated in Figure 7.23. However, when a switch is operated and contact is made on a new terminal, the contact, being mechanical, will bounce a few times before settling into the new position. Figure 7.23d shows the effect of contact bounce on the waveform for a pushbutton switch. The contact bounce is shown only on the terminal where contact is being made, not broken.
FIGURE 7.23
Switches as Pulse Generators
Contact bounce can be a serious problem, particularly when a switch is used as an input to a digital circuit that responds to individual pulses. If the circuit expects to receive one pulse, but gets several from a bouncy switch, it will behave unpredictably.
A latch can be used as a switch debouncer, as shown in Figure 7.24a. When the pushbutton is in the position shown, the latch is set, since S 0 and R 1. (Recall that the NAND latch inputs are active LOW.) When the pushbutton is pressed, the R contact
FIGURE 7.24
NAND Latch as a Switch
Debouncer
288 C H A P T E R 7 • Introduction to Sequential Logic
bounces a few times, as shown in Figure 7.24b. However, on the first bounce, the latch is reset. Any further bounces are ignored, since the resulting input state is either S R 1 (no change) or S 1, R 0 (reset).
Similarly, when the pushbutton is released, the S input bounces a few times, setting the |
|
latch on the first bounce. The latch ignores any further bounces, since they either do not |
|
change the latch output (S R 1) or set it again (S 0, R 1). The resulting waveforms |
|
at Q and Q are free of contact bounce and can be used reliably as inputs to digital sequen- |
|
tial circuits. |
|
EXAMPLE 7.3 |
A NOR latch can be used as a switch debouncer, but not in the same way as a NAND latch. |
Figure 7.25 shows two NOR latch circuits, only one of which works as a switch debouncer. |
|
Draw a timing diagram for each circuit, showing R, S, Q, and Q, to prove that the circuit in |
|
Figure 7.25b eliminates switch contact bounce but the circuit in Figure 7.25a does not. |
|
FIGURE 7.25 |
|
Example 7.3 |
|
NOR Latch Circuits |
SOLUTION Figure 7.26 shows the timing diagrams of the two NOR latch circuits. In the circuit in Figure 7.25a, contact bounce causes the latch to oscillate in and out of the forbidden state of the latch (S R 1). This causes one of the two outputs to bounce for each contact closure. (Use the function table of the NOR latch to examine each part of the timing diagram to see that this is so.)
By making the resistors pull down rather than pull up, as in Figure 7.25b, the latch oscillates in and out of the no change state (S R 0) as a result of contact bounce. The first
FIGURE 7.26
Example 7.3
NOR Latch Circuits
7.3 • Gated Latches |
289 |
bounce on the SET terminal sets the latch, and other oscillations are disregarded. The first bounce on the RESET input resets the latch, and further pulses on this input are ignored.
The principle illustrated here is that a closed switch must present the active input level to the latch, since switch bounce is only a problem on contact closure. Thus, a closed switch must make the input of a NOR latch HIGH or the input of a NAND latch LOW to debounce the switch waveform.
N O T E
The NOR latch is seldom used in practice as a switch debouncer. The pull-down resistors need to be about 500 or less to guarantee a logic LOW at the input of a TTL NOR gate. In such a case, a constant current of about 10 mA flows through the resistor connected to the normally closed portion of the switch. This value is unacceptably high in most circuits, as it draws too much idle current from the power supply. For this reason, the NAND latch, which uses higher-value pull-up resistors (about 1 k or larger) and therefore draws less idle current, is preferred for a switch debouncer.
SECTION 7.2 REVIEW PROBLEM
7.2Why is the input state S R 1 considered forbidden in the NOR latch? Why is the same state in the NAND latch the no change condition?
7.3Gated Latches
K E Y T E R M S
Gated SR latch An SR latch whose ability to change states is controlled by an extra input called the ENABLE input.
Steering gates Logic gates, controlled by the ENABLE input of a gated latch, that
steer a SET or RESET pulse to the correct input of an SR latch circuit.
Transparent latch (gated D latch) A latch whose output follows its data input when its ENABLE input is active.
Gated SR Latch
It is not always desirable to allow a latch to change states at random times. The circuit shown in Figure 7.27, calleda gated SR latch, regulates the times when a latch is allowed to change state.
The gated SR latch has two distinct subcircuits. One pair of gates is connected as an SR latch. A second pair, called the steering gates, can be enabled or inhibited by a control signal, called ENABLE, allowing one or the other of these gates to pass a SET or RESET signal to the latch gates.
The ENABLE input can be used in two principal ways: (1) as an ON/OFF signal, and
(2) as a synchronizing signal.
Figure 7.27b shows the ENABLE input functioning as an ON/OFF signal. When ENABLE 1, the circuit acts as an active-HIGH latch. The upper gate converts a HIGH at S to a LOW at S, setting the latch. The lower gate converts a HIGH at R to a LOW at R, thus resetting the latch.
When ENABLE 0, the steering gates are inhibited and do not allow SET or RESET signals to reach the latch gate inputs. In this condition, the latch outputs cannot change.