Файл: Microcontroller Programming. Thi Micro Chip PIC (Julio Sanchez, 2007).pdf
ВУЗ: Не указан
Категория: Не указан
Дисциплина: Не указана
Добавлен: 14.06.2025
Просмотров: 8585
Скачиваний: 0
Circuits and Logic Gates |
91 |
Since an XOR gate’s output is high if the inputs are different it can serve as a difference detector for logic levels. The following equation expresses the XOR relationship for two inputs (labeled A and B) and one output (labeled Y).
Y = A B
The logic symbol for XOR is the symbol for OR (+) enclosed in a circle. The XOR function can also be expressed in terms of Boolean OR and AND operations, as in the following equation:
Y = ( A• B) + ( A• B)
Figure 5-19 is the circuit diagram for the XOR gate constructed from OR, AND, and NOR gates.
A
Y
B
Figure 5-19 XOR Gate Circuit Diagram
Note in the XOR truth table in Figure 5-18 that if one of the inputs is forced high, then the gate functions as an inverter for the other input. Also, note in the truth table for the NOR gate (Figure 5-16) that if both inputs are low or high, then the circuit also functions as an inverter. If the inputs of a NOR gate are tied together the gate performs as an inverter. Often a circuit designer can take advantage of these identities in order to use an available gate for a function other than the one originally intended, thus saving having to use an additional IC.
5.4.8 Schmitt Trigger Inverter
Digital signals used in operating electronic devices consist of pulses. Conceptually, the pulses instantly fluctuate between a high and a low voltage level, ideally generating a square waveform. But signal noise in a circuit often contaminates the waveform into a non-rectangular shape. This noise can be the cause of circuit problems. For example, consider a plot of output voltage versus input voltage for a simple inverter, as shown in Figure 5-20.
92 |
Chapter 5 |
Volts input
5
1.4 volts
3
1
Volts output
1 |
3 |
5 |
Figure 5-20 TTL Input and Output Voltage
In Figure 5-20 you notice that as the input voltage is raised from zero, the output voltage stays high. However, when the input voltage reaches about 1.4 volts (dashed line in Figure 5-20) the output switches sharply from high to low. Now suppose there is noise on the input line and that this noise causes the voltage to go above 1.4 volts and then below this value. In this case, the inverter’s output may also switch its logic state several times during the transition period following the voltage fluctuations.
One common solution to this problem is based on a property of physical systems called hysteresis. Although the term derives from a Greek work meaning deficiency, it can also be related to “history.” In this sense hysteresis refers to the property of an object that does not instantly follow the forces applied to it, but reacts “historically” to these forces. In other words, the new state depends on the object’s immediate history. Adding hysteresis to a circuit’s input makes it so that the point at which the output changes state depends on the current state of the output. For example, if output is high, it does not go low until the input voltage is raised above 1.7 volts. On the other hand, once the output goes low it will not change back to high until the input falls below 0.9 volt. This “lag” before changing to a new state makes the output much less susceptible to being inadvertently switched by noise. Figure 5-21 shows a plot of the input versus the output currents on a circuit with hysteresis.
Volts input
5 |
||
3 |
||
1 |
||
Volts |
||
output |
||
1 |
3 |
5 |
Figure 5-21 Effect of Hysteresis in an Inverter Circuit
Circuits and Logic Gates |
93 |
Logic gates whose input has hysteresis are often known as a Schmitt trigger. Figure 5-22 shows a 7414 hex Schmitt trigger inverter.
+5V |
|||||||
14 |
13 |
12 |
11 |
10 |
9 |
8 |
|
In |
Out |
||||||
7414 |
H |
L |
|||||
L |
H |
||||||
1 |
2 |
3 |
4 |
5 |
6 |
7 |
|
GND |
|||||||
Figure 5-22 7414 Hex Schmitt Trigger Inverter
Note in Figure 5-22 that there is a small hysteresis curve inside each inverter symbol. This indicates that the inverters are the Schmitt triggers.
5.5 Other TTL Logic Families
In 1971 a major advance in TTL logic occurred with the introduction of TTL devices that incorporate Schottky diodes. They are based on the property of aluminum to act much like a p-type semiconductor when in contact with n-type silicon. The Schottky diode acts like an ordinary p-n diode except that it has a faster response time and the voltage drop is about 0.3 volts instead of 0.6 volts. When a Schottky diode is connected between the base and the collector of a bipolar transistor, the transistor is prevented from going into saturation. The Schottky diode/transistor combination, known as a Schottky transistor, has a significantly faster switching speed. Schottky TTL logic devices have part numbers 74SXXX and give three times the speed of standard TTL using only twice the power.
By increasing the resistor sizes, low-power Schottky TTL was developed giving the same speed as standard TTL, but using only 1/5 the power. These devices, whose part numbers are in the format 74LSXXX, were the standard TTL logic parts for many years. In 1980, more sophisticated Schottky-type logic circuits using smaller, higher performance transistors were developed by Texas Instruments. These are the advanced Schottky and advanced low-power Schottky logic families. Their part numbers are 74ASXXX and 74ALSXXX respectively.
5.6 CMOS Logic Gates
Around the same time that the original TTL circuits using bipolar transistors were introduced, a line of logic circuits using CMOS (complementary metal-oxide semiconductor) technology became available. A line of TTL-compatible CMOS ICs have part numbers 74XXX. TTL series pinouts are also available with part numbers 74CXXX.
CMOS logic circuits have two significant advantages over TTL. In the first place, CMOS circuits operate with very low power dissipation. A CMOS input requires virtually no current to remain at a given logic level. In fact, the entire circuit draws insignificant current when it is not switching between logic levels. In CMOS, power is
94 |
Chapter 5 |
consumed only during switching, while bipolar logic power dissipation is only weakly dependent on the switching rate. At low switching rates, CMOS provides huge savings in power dissipation.
A second advantage of CMOS is the smaller size of the circuits. Since no resistors and only two simple types of transistors are needed, the resulting logic gates require less area on a silicon wafer than their bipolar counterparts. The combined advantages of less power consumption and less area make CMOS the choice for VLSI (very large scale integration) integrated circuits such as microprocessors.
However, there are also significant drawbacks to CMOS which have prevented it from completely replacing bipolar logic. One of them is that CMOS circuits have slower switching speeds and propagation delays compared to bipolar circuits. The original CMOS logic gates had switching speeds that were about five to ten times slower than the 74XXX bipolar logic gates. High-speed CMOS, introduced in 1980, have improved processing technology and smaller transistor sizes, resulting in higher switching speeds and improved output drive current capability.
The CMOS 74HCT parts are completely TTL-compatible and can be freely intermixed with bipolar TTL parts. The 74HC series, on the other hand, have a logic transition threshold of 2.5 V when using a 5-volt power supply, compared to the 1.4 volts TTL standard. Since CMOS outputs have 5-volt and 0-volt logic levels, a 2.5-volt threshold provides better noise immunity than TTL; however, 74HC series parts cannot be mixed with standard TTL parts. For this reason, in mixed circuits, it is preferable to use the 74HCT parts.
An advanced CMOS technology family was introduced in 1985 having part numbers 74ACXXX. The TTL-compatible versions have part numbers 74ACTXXX. These new ICs have about double the speed of HC and HCT with yet another increase in drive power. The result is that the propagation delays for 74ACT parts approach those of bipolar TTL, although they are not quite equal to the fastest TTL families. To further increase CMOS speeds manufacturers turned to a process known as BiCMOS, which uses a mixture of bipolar and MOS transistors on the same chip. By strategically placing bipolar transistors at critical points in the circuit, the switching speed can be improved with only a small increase in power dissipation. The most popular BiCMOS logic family is the 74FCTXXX (fast CMOS) series of logic ICs.
Still another drawback to CMOS logic is that the circuits are susceptible to static electricity. The static discharge of the human body in a dry environment can destroy a CMOS transistor. Although protective diodes on CMOS circuit inputs provide some protection to static breakdown, all CMOS circuits are susceptible. For this reason ICs and circuits boards should be stored in conductive pouches and not handled until you have discharged yourself by touching a good electrical ground.
Chapter 6
Circuit Components
This chapter covers the most common general-purpose circuit components often found in microcontroller boards. Some simpler circuit devices such as diodes, LEDs, and logic gates, were discussed in chapter 5. Here we mention other common components including power supplies, switches, clocks and timers, flip-flops, decoders, seven-segment displays, and liquid crystal displays (LCDs). Other components sometimes found in microcontroller-based digital circuits are not discussed either because of their simplicity (buzzers and relays), their passive nature (connectors, adapters, batteries, and wiring), or their specialized features (motors, digital-to-analog and ana- log-to-digital converters, and memory).
6.0 Power Supplies
Standard logic circuits usually require a power source of +5 VDC. One possible source of +5 VDC is in one or more batteries. A D- cell battery generates 1.5 volts, so three of them can be connected in series to produce 4.5 VDC. An alternative power source can be from the standard wall outlet. Household electrical service in the United States is in the form of 110 volt AC (alternating current) power. Actually, 110 volts is the root mean square value of a sine wave that oscillates 60 times per second from about +155 volts to about -155 volts. The circuitry required to convert 110 VAC into 5 VDC is known as a power supply.
To obtain +5 VDC from 110 VAC requires scaling down the voltage and converting alternating current to direct current. In addition, most power supplies include a voltage regulator component that ensures that the circuit voltage is exactly +5 volts. The circuit in Figure 6-1 (in the following page) is a regulated 5-VDC power supply. The transformer reduces the household voltage from 110 to about 12 VAC. The diodes rectify the input to an oscillating signal of about +12 VDC. The 100mF electrolytic capacitor smoothes out the oscillation producing a largely DC voltage with little ripple. The 7805 is a voltage regulator that accepts an input voltage from about 8 volts to about 35 volts and produces a constant 5V output. Voltage regulator ICs are Zener diodes with a precise, reverse-biased breakdown voltage.
95
96 |
Chapter 6 |
12.5V |
||
CENTER-TAPPED |
+5V DC |
|
TRANSFORMER |
||
REGULATED |
||
IN |
OUT |
|
OUTPUT |
+ 100mF |
78L05 |
0.1mF |
110V AC INPUT
Figure 6-1 Regulated +5 VDC Power Supply
The 7805 is usually mounted on a metal base with a drilled hole so that a heat sink can be attached to it. With a heat sink the 7805 can produce up to 1 amp output. Figure 6-2 shows a 7805 voltage regulator IC.
output
ground
input
Figure 6-2 7805 Voltage Regulator IC
6.1 Clocked Logic and Flip-flops
In the digital circuits considered so far the outputs are entirely determined by the inputs to these circuits. In other words, if the inputs change so do the outputs. However, we often need a digital component whose output remains unchanged even if there is a change in input, for example, to store a binary number. A flip-flop is such a circuit since it performs as a 1-bit memory that stores either the value 0 or 1.
6.1.1 The RS Flip-flop
A circuit is said to be bistable if it has two, and only two, stable states. For example, a toggle switch which can be either OPEN or CLOSED is a bistable device. In a sense the toggle switch has memory since it remains in any one of the two positions until changed.
A flip-flop is an electronic circuit with two stable states, since its output is either 0 or +5 VDC. In this context we say that a flip-flop is set if it stores a binary 1 and reset otherwise. The RS designation refers to the Reset and Set stages. The flip-flop can also be said to have memory since its output remains set or reset until it is intentionally changed. When the flip-flop output is 0 VDC it can be regarded as storing a logic 0 and when its output is +5 VDC as storing a logic 1.