.. _cmos: ******************* CMOS Logic Circuits ******************* .. Changes: .. + Inverter chains with feedback was added. 1-, 2-, and 3-inverter ring based exercises were added on Oct. 11, 2012. .. 2-, and 3-inverter ring based exercises were removed on Jan. 4, 2013. Objectives ================================================== #. Reinforce basic principles of CMOS logic from ELEC 2210 lecture #. Gain experience with complex CMOS gates #. Learn to construct CMOS transmission gates #. Work with chains of CMOS inverters Required Soft Front Panels (SFPs) ==================================================== #. Function Generator (FGEN) #. Scope #. Digital Writer #. Digital Reader Required Components ============================================= #. 3 x CD4007 (dual CMOS pair plus inverter). You can download or view the data sheet :download:`here <./datasheet/cmos/ti-cd4007ub.pdf>` or :download:`here <./datasheet/cmos/MC14007UB-D.pdf>`. #. 3 x 1K Ohm resistor. .. Commented out #. 3 x 1 :math:`\mu` F capacitor. Overview ============================ CD4007 ----------------- The CD4007 consists of 3 pairs of complimentary MOSFETs, as shown in :num:`figure #fig-cd4007-functional`. Each pair shares a common gate (pins 6,3,10). The substrates of all PMOSFETs are common (pin 14), as well as those of the NMOSFETs (pin 7). For the left pair, one of the two NMOS N+ terminals is tied to the NMOS substrate, and one of the two PMOS P+ terminals is tied to PMOS substrate. The other two pairs are more general purpose. For the right pair, a N+ terminal of the NMOS is tied to a P+ terminal of the PMOS (pin 12). .. _fig-cd4007-functional: .. figure:: images/cmos/cd4007-functional.png :scale: 100 % :alt: CD4007 functional diagram :align: center CD4007 functional diagram. The CD4007 is a very versatile IC with many uses. For example, a single CD4007 can be used to make a chain of 3 inverters, an inverter plus two transmission gates, or a complex logic gate. Inverters and transmission gates are particularly useful for building D flip-flops. Static Discharge ------------------------- While the CD4007 is very versatile, it is also easily damaged by static, like all CMOS electronics. The CD4007 includes diodes to protect it from static discharge, but it can still be damaged if it is not handled carefully. Normally one would use anti-static mats and wrist straps when working with static sensitive electronics. However, we do not have those in the 2210 lab. A low budget way to avoid static discharge is to ground yourself before touching an IC. The ELVIS breadboard includes a metal pad in both top corners labeled "ESD PAD TOUCH TO DISCHARGE." Discharging any built up static charge before picking up a CD4007 will help ensure that you do not have a broken chip half way through the lab. Wiring Notation ----------------------- When specifying wiring between the pins of an IC, engineers often use a shorthand for connections. For example, instead of saying, "connect pin 22 to pin 5 and pin 7," one might write "(22,5,7)". Groups of pins that are not connected are separated by a semicolon. For example, consider (22,5,7);(1,3,18). This notation is often used in datasheets, and is used below as well. Pre lab ================================== #. Study the CD4007 datasheet thoroughly. #. Draw an equivalent circuit for the following wiring description using a CD4007: (1,5,10);(3,8,13);(14,2,11);(7,4,9);(14,Vdd);(7,Ground). You do not have to draw a gate level schematic if you can determine the logic function implemented. If you only give a logic diagram, show pin numbers between logic elements. #. Make a pin-level wiring diagram for a transmission gate using a CD4007. Use the top right PMOSFET and the bottom center NMOSFET shown in :num:`figure #fig-cd4007-functional-small` below. .. _fig-cd4007-functional-small: .. figure:: images/cmos/cd4007-functional-small.png :scale: 100 % :alt: CD4007 functional diagram :align: center CD4007 functional diagram. #. Determine the logic function implemented by the following connections to a CD4007: (2,14);(8,9,4);(12,13,5);(1,11);(14,Vdd);(7,Gnd). Pin 3 is A, pin 10 is B, and pin 6 is C. The output is pin 12,13, or 5. Draw a transistor level diagram and a truth table for the circuit. Lab Exercises ========================================= CMOS Inverter Chain ---------------------- #. Construct 3 inverters using a CD4007 by making the following connections: (4,9,7);(1,5);(8,13);(14,2,11);(14,Vdd);(7,Ground). Use +5v for Vdd. Connect AI0+ to FGEN. Set the function generator to output a 500Hz sine wave, 5vpp, 2.5vdc offset. #. Test each inverter by connecting the function generator to the input and connecting AI1+ to the output. Remember to ground the AI- terminals. The respective input-output pairs are: 6-8,3-5,10-12. You should see 3 waveforms similar to the one shown in :num:`figure #fig-inverter-chain-first`. .. _fig-inverter-chain-first: .. figure:: images/cmos/inverter-chain-first.png :scale: 100 % :alt: inverter output :align: center Output of first inverter. #. Build a chain of 3 inverters by connecting your inverters in the order shown in :num:`figure #fig-inverter-chain`. .. _fig-inverter-chain: .. figure:: images/cmos/inverter-chain.png :scale: 100 % :alt: inverter chain :align: center Inverter chain. #. Keeping the input (from FGEN) at pin 6, connect AI1+ to the output of each inverter (one-after-another) and take a screenshot similar to :num:`figure #fig-inverter-chain-second`. You should take a total of three screenshots, one each, corresponding to each inverter output. .. _fig-inverter-chain-second: .. figure:: images/cmos/inverter-chain-second.png :scale: 100 % :alt: inverter chain output :align: center Output of second inverter. #. Do not dissassemble the inverter chain. It will be reused later. .. topic:: What to do in lab report Show 3 screen shots of inverter outputs. Describe the differences between the screenshots (other than that they are inverted). .. Inverter Chains with Feedback -- Three Inverter Ring Oscillator ---------------------------------------------------------------- In the previous section, we observed the inverter chain operating in an open loop. We will now see the effects of adding a feedback (or closed loop operation) with three inverters in a closed loop. #. For the inverter chain built in the previous step, add a feedback by connecting 12 to 6 as shown in :num:`Figure #fig-three-inverter-ring` below. #. Connect a 1 :math:`\mu` F capacitor at the outputs of each inverter in the chain i.e., pins 8, 5, and 12 as shown in the circuit below. .. _fig-three-inverter-ring: .. figure:: images/cmos/three_inverter_ring.png :scale: 100 % :alt: inverter ring :align: center Three Inverter ring oscillator. #. Connections to the scope are as follows: pin 8 to AI2+, pin 5 to AI1+ and pin 12 to AI0+. AI2-, AI1-, AI0- should be connected to Ground. #. Connect pin 14 to Variable Power Supply VPS+. Use SFP to set VPS to 5V. #. Enable channels AI0, AI1, and AI2 on the 8-channel scope. The 8-channel oscilloscope is available near the bottom end under the Featured instruments tab of instrument launcher (SFP) as shown in :num:`Figure #fig-oscope`. You should observe oscillations at each node with waveforms as shown in the screenshot of :num:`Figure #fig-three-inv-ring-with-five-volt` below. .. _fig-oscope: .. figure:: images/cmos/oscope.png :scale: 60 % :alt: oscope :align: center 8-channel oscilloscope is available under the Featured instruments drop-down menu in the Soft Front Panel. .. _fig-three-inv-ring-with-five-volt: .. figure:: images/cmos/fig-three-inv-ring-with-1uF-at-each-load-5V_PS.png :scale: 60 % :alt: three-inv-ring-with-five-volt :align: center Voltage waveform at each node of the ring oscillator with 5V supply. #. Change the supply voltage first to 10V, then to 2.5V. Take a screenshot in each case. You should see the amplitude and time period of oscillation change in each case as shown in :num:`Figure #fig-three-inv-ring-with-ten-volt` and :num:`Figure #fig-three-inv-ring-with-two-point-five-volt` respectively. How does frequency and amplitude of oscillation vary with supply voltage? .. _fig-three-inv-ring-with-ten-volt: .. figure:: images/cmos/fig-three-inv-ring-with-1uF-at-each-load-10V-PS.png :scale: 60 % :alt: three-inv-ring-with-ten-volt :align: center Voltage waveform at each node of the ring oscillator with 10V supply. .. _fig-three-inv-ring-with-two-point-five-volt: .. figure:: images/cmos/fig-three-inv-ring-with-1uF-at-each-load-2p5V-PS.png :scale: 60 % :alt: three-inv-ring-with-two-point-five-volt :align: center Voltage waveform at each node of the ring oscilator with 2.5V supply. #. Just remove the feedback conncection that you now have from pin 12 to pin 6. Remove all the capacitors. Keep the rest of the connections as it is. You will need it in future exercise on building D-latch. .. topic:: What to do in lab report? Show 3 screenshots corresponding to each supply voltage for the three inverter ring oscillator. Mention how supply voltage changes the frequency of oscillation, and its amplitude. If possible, cite your reasons. CMOS Transmission Gates ------------------------- #. Build a double transmission gate using a new CD4007 chip as shown in :num:`Figure #fig-transmission-gate-schematic`. We will test the two transmission gates by connecting FGEN to the input, and connecting a load of 1k :math:`\Omega` on either (output) sides. #. Connect FGEN to (1,12,5); attach 1k :math:`\Omega` resistors to (2,9) and (4,11) as shown in :num:`Figure #fig-transmission-gate-schematic`. #. Connect pins (2,9) to CH0, and pins (4,11) to CH1. Remember to ground the CH(-) terminals. .. _fig-transmission-gate-schematic: .. figure:: images/cmos/double-tgates.png :scale: 100 % :alt: transmission-gate-schematic :align: center Double transmission gate connections. #. Set the function generator to produce a 500Hz square wave, 5vpp, 2.5vdc offset. #. Connect CLK to DIO7 to set CLK to 0 and 1. Observe the waveforms on CH0 and CH1 for CLK=0 and CLK=1. In each case take a screen-shot. D-latch ----------------------------- We will now combine the double transmission gate built in the previous exercise with inverter chain of the first exercise to build a D-latch as shown in :num:`Figure #fig-dlatch`. The two transmission gates work in tandem to realize the D-latch. During the transparent phase of the latch, i.e. CLK=0, the first transmission gate (left) is ON while the second (right) is OFF. D is transmitted to the output (Q) through the first transmission gate and the two-inverter cascade. During the hold phase of the latch, i.e. CLK=1, the first transmission gate is OFF but the second transmission gate is ON. As a result, any change in the input D is not reflected at the output Q. However, the second transmission gate, which is now turned ON ensures that the previous logic level at Q is retained through the closed loop with the two-inverter cascade. #. Connect pin 9, which serves as D input of the latch to DIO0. Connect pin 4, which serves as Q output of the latch to DIO8. Connect pin 6, which serves as CLK to DIO7. .. _fig-dlatch: .. figure:: images/cmos/D-latch-rev.png :scale: 100 % :alt: dlatch :align: center Schematic of D latch. #. Now insert two inverter chain you built earlier (and retained from the first exercise) to the circuit you have just built. It is shown in the dashed box labeled as chip 2 in :num:`Figure #fig-dlatch` above. #. First apply logic Low to CLK by starting the SFP and turning DIO7 low. Apply logic High to the D input by flipping DIO0 to high. #. Observe the output Q of the latch on DIO8 (by using the digital reader from the SFP). A steady high should appear. Capture a screen shot. #. Apply logic Low to the D input by flipping DIO0 to low. Observe the output on DIO8. This is the transparent phase of the latch. You should see that DIO8 is also low. #. Now apply logic High to CLK by making DIO7 high. Also apply logic High to the D input. #. Observe the DIO8 pin. A steady low should appear inspite of changing D to logic High since the previous value at D-input was low. Capture a screen shot. This is the opaque phase of the latch. Two copies with opposite phase clocks will then make a master-slave D Flip Flop. Bonus ------------------------------ Consider the circuit shown in :num:`figure #fig-oscillator`. Can you tell what it does? .. _fig-oscillator: .. figure:: images/ald1105/oscillator.png :scale: 100 % :alt: oscillator :align: center Application of CMOS logic. First, assume the voltage at the input to the first inverter is zero. The output of the first inverter will be Vdd and the output of the second inverter will be zero. The capacitor will begin to charge. Because the input to a CMOS inverter is very high impedance, the resistor R2 can be ignored. Thus, the input to the first inverter is close to the voltage at node C. When node C reaches 1/2 Vdd, the inverters will change states, and the voltage at the output of the second inverter will now be Vdd. Because the voltage across the capacitor cannot change quickly, the voltage at the bottom center node will now be Vdd + Vcap, or about 3/2 Vdd. Because the output of the first inverter is now zero, the capacitor will begin to discharge through R1, and the opposite side will be charged. When the voltage at node C drops to 1/2 Vdd (making the voltage across the capacitor -1/2 Vdd), the inverters will change states. The output of the second inverter will be 0v again, and the voltage at node C will now be 0 + Vcap or 0 -1/2 Vdd. The capacitor will begin to charge through R1 until node C reaches 1/2 Vdd and the process repeats. In summary, the output of the inverters will oscillate between 0 and Vdd. Therefore, this circuit is an oscillator. #. Construct the circuit shown in :num:`figure #fig-oscillator`. The two inverters can be built from a CD4007 by making the following connections: (4,7);(1,5);(3,8,13);(14,2);(14,Vdd);(7,Ground). You may find the diagram shown below in :num:`figure #fig-mosfet-cd4007` helpful. .. _fig-mosfet-cd4007: .. figure:: images/cmos/cd4007-functional-small.png :scale: 50 % :alt: mosfet-cd4007 :align: center CD4007 functional diagram. #. Connect AI0- to ground. #. Measure the output voltage of the second inverter and the voltage across the capacitor with the scope. Save a screenshot. #. Measure the output voltage of the second inverter and the voltage at node C with the scope. Save a screenshot. #. Experiment with different values of C1 and R1 and try to determine their relationship to the frequency of the output. .. topic:: What to do in the lab report Show 1 screenshot. How does changing R1 and C1 affect the frequency of the output?