Documents

ECEN 1400 Lab 6 Counters

Description
lab counter
Categories
Published
of 4
All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.
Related Documents
Share
Transcript
  ECEN 1400 Lab 6 Counters Version 1.1, 8/25/32 R. McLeod from earlier versions 1 ! !# ! ## ! ! #$%&'(#)% #% + ,-%. , & /).)#,- 0-1(#$% )(2   #$ %& '()*+,-. 1   I  NTRODUCTION  The goal of this lab is to introduce a new digital circuit, the counter. As you might expect from its name, this chip counts the periods of an input line in the binary number system. Here we will work with 4 bit counters that can count from 0 to 15. For your convenience, questions and lab procedures are introduced in a unique color  . 2   C OMPONENTS AND T OOLS REQUIRED   ã   From your kit: o   Breadboard o   Wires o   Wire-cutter and pliers o   Various resistors and capacitors ã   From your TA o   Two 74161 counter chips ã   On the lab bench: o   Variable DC power supply o   Function-generator o   Oscilloscope 3   C OUNT A SWITCH  In this section you will build a simple 4-bit counter driven by a switch. The counter will count the number of times the switch is pressed and display this count with 4 LEDs. When a mechanical switch is opened or closed, it vibrates, causing fast oscillations  between short and open, as shown in Figure 1. This switch “bounce” will cause a digital circuit to randomly respond to several switch events when only one is intended. For example, a switch used to increment a counter in (say) a digital clock would be very annoying to use because the count could increment a random number of digits each time the button was pushed. Capacitors provide a way to smooth out these fast oscillations, “de-bouncing” the switch. Figure 1. Switch bounce. Note the cursor time interval is 2.6 ms. Source = http://en.wikipedia.org/wiki/Switch#Contact_bounce.  ECEN 1400 Lab 6 Counters Version 1.1, 8/25/32 R. McLeod from earlier versions 2 Get a little micro-switch and socket from your T.A. Put the socket in your breadboard and then mount the switch into the socket. There is a “natural” way to put the switch into the socket. If you have any questions, check with your T.A. The switch has four leads coming out of it. Using the multimeter, check which leads are the ends of the switch. Figure 2 may help you determine which leads are which. Figure 2. Switch wiring diagram. Figure 3 shows a switch (J1) and a  pull-up  resistor wired to the clock input of a counter. This combination allows the switch to present either 5V or 0V to the chip input. Look at the data sheet for the counter to understand the other pins of the 74161 counter. Pins that are particularly important are A-D: inputs to load the initial count when pin 9 is taken low QA-QD: the count output RCO: counter rollover – tells you when QA-QD = 1111 CLOCK: Increment the count by one Four LEDs have been connected to the output lines. Although the counters can provide a high enough voltage level to turn on the LEDs, they do not provide enough current. Actually, the counter chip will try to provide as much current as the LED wants for a given voltage level. However, if the amount of current the LED demands is larger than what the chip is designed to handle, the chip will overheat and perhaps burn out. A secondary issue is that even if the counter can provide enough current to the LEDs, the current flow must still be limited to about 6mA to 10mA so the LEDs don’t burn out. Check the datasheets of the counter for the maximum amount of output current that the counter can produce with a high output level. You should find that this value is only a few tenths of a milli-amp. Clearly this is not good enough to turn on an LED.  Now check the maximum amount of output current that the counter can produce with a low output value. What is this value? It should be more than 6mA.With this being the case, an LED can be switched on and off by the output of the counter. The circuit is similar to LED and transistor circuit from a couple weeks ago. The “+” end of the LED is connected to 5 Volts through a current-limiting resistor. The “-” end of the LED is connected to the counter output pin.  Note that the LEDs are displaying NOT(QA), NOT (QB) etc. When the counter output is  producing a logic high voltage level, there is not enough voltage across the LED for it to turn on. When the counter is producing a logic low voltage level, there is enough of a  ECEN 1400 Lab 6 Counters Version 1.1, 8/25/32 R. McLeod from earlier versions 3 voltage drop across the LED for it to turn on. Notice that this is the reverse of what you might expect. A logical “1” turns the LED off, and a logical “0” turns it on. Figure 3. A four-bit counter driven by a bouncing switch and a pull-up resistor.  Build and test the counter with a “bouncy” switch . Open and close the switch and observe the counter output. What specifically condition on the CLOCK pin causes a counter increment? That is, does the counter increment continually when the CLOCK  pin is high, for example? Look at the datasheet for confirmation – this is typical behavior for digital circuits. You should sometimes see the count increment by more than one due to switch bounce. However, bounce is random and depends on the individual switch, so you might get lucky and not witness this. Increment the counter past roll-over (1111) and observe what happens to the count. Finally, put the counter in an intermediate count  between 0 and 15, then ground pin 9 which loads the values on A-D into the counter. A-D are default low (0000).  Debounce the switch . Add an RC combination to smooth-out the switch transition as shown in Figure 4. Select a combination of resistor and capacitor to produce a time constant around 20 msec. Explain, using Figure 1, why 20 msec is reasonable and (for example), 20 µ sec or 20 sec would probably not work well. Making this time constant a little larger is better than making it smaller. After you have re-wired your circuit with this RC circuit, try using the switch again. Check that you get the correct count sequence with no skips.  ECEN 1400 Lab 6 Counters Version 1.1, 8/25/32 R. McLeod from earlier versions 4 Figure 4. A four-bit counter driven by a debounced switch and a pull-up resistor. 4   T AKE THE “ MODULO ”  OPERATION OF A SQUARE WAVE  Remove the switch and other elements driving the CLOCK pin and instead connect the function generator to CLOCK. Set the waveform to be a 1 Hz square wave, 5 volt peak-to-peak and a +2.5 offset so that the voltage swings between 0 and 5 V. Observe the output of the counter on the LEDs. What is the frequency of the QA, QB, QC, and QD outputs? Increase the frequency to 32 KHz and use your oscilloscope to measure the frequencies of QA, QB, QC, and QD. What is the relationship between the clock and these frequencies? This demonstrates that a single oscillator frequency can be divided down to a lower frequency, which might be a handy capability in the near future. In the next section, we’ll divide it even further by cascading two counters. In the Digital Logic lab, we’ll use logic gates to access divisors that are not just multiples of two. 5   C ASCADE TWO COUNTERS  Remove the LEDs and pull-up resistors. Place a second 74161 counter on the breadboard and configure it like the first. Wire QD of the first counter to CLOCK of the second counter. Using your oscilloscope, measure the frequencies of QA, QB, QC, and QD on the second counter.  Accuracy using a RC relaxation oscillator: If you had used your 555 oscillator as the input to CLOCK of the first counter with a nominal oscillation frequency of 32 KHz, what would be the potential range of frequencies you would measure on QD of counter 2 if the resistors you used to set the 555 frequency had a gold, silver or no band in the final color-code position? What would be the frequency drift with a 50 degrees C temperature swing if the temperature coefficient   of the resistor was 25 parts per million per degree C? When you are finished, leave both counters wired on your breadboard.
We Need Your Support
Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

Thanks to everyone for your continued support.

No, Thanks