EE109 – Spring 2018 Introduction to Embedded Systems

EE109 – Spring 2018: Introduction to Embedded Systems

Lab 2

Digital Logic - Gates


This lab assignment has three purposes:

Part 1: Using an Oscilloscope

An oscilloscope like the Agilent MSO-X 3024A models in VHE 205 are used to show a graph of one or more signals as they change with time. The scope plots the signals showing their:

By displaying multiple signals on the same plot, it's possible to see how they are interacting with each other. The scopes in VHE 205 are capable of displaying signals from four signals (channels 1-4) at the same time on the display.

Note: The oscilloscopes in VHE 205 were made by Agilent, but the company is now called Keysight. Some of the pictures of the scope screens many show the Agilent name, while others may say Keysight, but the only difference is in the name. If the name on your scope screen doesn't match the one in this web page, just ignore the mismatch.

To get started follow the steps below.

  1. Turn on the oscilloscope by pressing the white button in the lower left of the front panel and wait for it to go through a bunch of self tests. In less than a minute it should be ready to go.
  2. Press the "Default Setup" button in the upper right portion of the front panel.
  3. After it says on the screen that the default setup has been restored, press the "Back" button in the lower left corner. This should restore the scope to the default settings in case someone has altered them. You should see a screen like this.

Notice the grid lines on the screen. There are eight vertical grid spaces (a.k.a. "divisions") and ten horizontal "divisions". These are used in conjunction with the vertical and horizontal scale factors to measure the voltages and timing of signals. The first two numbers to look for are the scale factors for the vertical and horizontal axis. The vertical scale factor is shown in the upper left corner of the screen, and the horizontal scale factor is also along top about 2/3 of the way to the right side.

Note: Each of the four channels can have a different vertical scale factor and these are shown along the upper left of the screen (i.e. channel 1 can be displayed with each division representing 1V while channel 2 is displayed 5V per division). In the default settings, only channel 1 (yellow) is turned on, and the display shows that the vertical scale factor is "5.00V". This means that each of the grid lines represents 5 volts of signal level. The horizontal scale factor is set to "100μs" meaning that the signal is plotted with each horizontal grid space representing 100 microseconds of time. We'll be using the grid lines and the vertical and horizontal scale factors to make voltage and time measurements on signals.

Since there is no input signal connected to channel 1, the plot or "trace" for channel 1 is just a horizontal line across the screen. Look at the left side of the screen where the horizontal line ends. You should see a small "Ground" symbol there aligned with the line. This is how the scope shows you where the Ground or 0 Volt level is displayed on the screen. Since there is no input signal on channel 1, the whole display for that channel is at the ground level.

The position of the trace can be adjusted with the small knob just below the illuminated "1" in the Vertical section of the front panel. Try rotating that knob back and forth and observe how the trace moves up and down on the screen. The position knobs for the four channels are used to spread the four traces out on the screen so you can see them.

Now let's look at some signals.

    1. Open up the storage compartment on the top of the scope and remove the scope probe that has the yellow markers on the cable.
    2. Insert the probe's connector onto the metal BNC connector for channel one. To make proper contact, the connector needs to be pushed onto the scope's connector fully and then rotated clockwise to lock it in place. You'll know it's locked in place if you can't pull it off (with a gentle pull) without first rotating it counter-clockwise. The probe has a metal hook at the tip that is exposed by pulling back on the plastic body of the probe. At the lower edge of the scope, hook the probe tip onto the metal tab that says "Probe Comp" just right of the USB port.

      Note 1: The "Probe Comp" metal tab is only used for testing and calibrating the scope. We don't use it for any of our normal measurements. This is probably the only time this semester that you will be attaching the probe to it.

      Note 2: The black ground clip on the probe does not have to be connected to a ground point when the probe is attached to the Prop Comp test point. In all other situations the ground lead must be connected to the circuit ground in order work.

You should now see two yellow lines going across the screen about a half a grid spacing apart. To get a better view of the signal we need to change the vertical scale factor to make the signal bigger on the screen.


The scope can be set to trigger when the input signal meets a set of conditions and it will then display the signals on all the channels that occurred before and after that time. It will then wait until the conditions are met again, and then display the signal again. With periodic signals this gives you stable display of the signals since each time they are drawn on the screen they are in the same position. When the scope doesn't know what to trigger on (like now), it just shows a running (live-stream) display of the incoming signal which usually results in the plot of the signal dancing around on the screen. While you are seeing the signal, it probably won't be stable on the screen and it will be difficult to analyze. When the triggering has been adjusted properly a stable display will be shown and you can get a clear look at the shape of the signal.


Part 2: Construct a Digital Circuit

In your ee109 folder, create a lab2 folder. From the class web site download into the lab2 folder the file "" and extract the contents: "Lab2_Answers.txt". This is a text file that you can edit with your text editor to record your answers to the questions below. This file must be uploaded to Vocareum by the lab due date.

We want to build the digital circuit shown in the schematic diagram below.

Important: Scroll down to see the pin diagrams for how to map the inputs/outputs of gates to the pins of the chips provided.

The circuit has two pushbuttons for inputs, A and B, and one output Z which has an LED connected to it. Note: The circuit diagram above does not show the power and ground connections required for the 74LS00 and 74LS04 integrated circuits, but these will be required (see step 4 below).

From the instructor's podium get the following items:

In addition to these new parts you will need the following from last week's lab:

If you don't have those parts they are also available at the podium.

Follow the steps below to install the the two switches, two ICs, LED and resistors on the breadboard.

  1. Install the two buttons and wire their associated 1kΩ pull-up resistors and their connections to ground. When installing the buttons position them so you have access to at least one of the holes in the row the button's pins are inserted. Remember to orient the switches so the flat side of the switch is towards either of the long sides of the breadboard.
  2. Install The 74LS04 inverter and the 74LS00 quad NAND gate. Note: both ICs should be installed with their pin 1 in the same orientation (to the left or the right) to help reduce wiring errors.
  3. Install the LED and its current limiting resistor.

This picture shows the buttons, ICs and LED installed on the breadboard. (Note: You will also need to connect the pull-up resistors to the buttons and a current-limiting resistor to the LED. But that is not shown in this picture.)

This diagram shows the buttons, pull-up resistors, ICs and LED installed on the breadboard.

  1. Make connections from the +5V (red) bus strip to pin 14 off both ICs, and from the ground (blue) bus strip to pin 7 of both ICs.
  2. The 74LS04 contains six inverter (NOT) gates as shown below. You use any of them for your circuit. Make connections from the 'A' button to the inputs of one of the inverters in the 74LS04.
  3. Before going any further, it is strongly recommended that you test the circuit you have assembled to this point. As you did last week set up the power supply for 5.0V. Using a pair of red and black test leads with banana plugs on one end and the pins on the other, connect the red power banana jack to the red bus strip on the breadboard and the black power supply banana jack to the blue bus strip for ground.Turn on the DMM, set it to measure DC Volts, and connect the test leads to the inverter output and to ground. Turn on the power supply 5V output to the breadboard. If the A switch is not pressed, the inverter input will be a logical 1, and the output should be a logical 0 (<0.5 volts). When the switch is pressed, the inverter output should go to the 1 state (>4 volts). Also check that the signal from button B changes in this range when it is pushed. If something is not working, you might as well fix it now before proceeding since the overall circuit is not going to work until it's fixed.
  4. The 74LS00 contains four independent two-input NAND gates as shown below.You can pick any of these to be either of the two in the schematic. Follow the schematic diagram above and make the connections to the inputs and outputs of the NAND gates.
  5. Connect the LED and current limiting resistor to the output of the NAND gate.

Once the circuit is wired, turn on the power to the board and test all four input combinations with the buttons. Remember the inputs will be a logical 0 when the button is pushed.

Have one of the instructors come and confirm that your combinational circuit is working properly. They will mark this task as completed on one of the check-off sheets available on the front table.

Whoops! It doesn't seem to be working. Now what do I do?

If your circuit isn't working (LED stays on or off for all four input combinations), then it's time to do some debugging. When a circuit doesn't work it's probably only one part that isn't functioning correctly but that makes the whole circuit not work right. When trying to debug a circuit it's necessary to isolate where the problem is by testing separate parts of the circuit to see if they work or not. For this circuit try the following.

Your goal is to figure out what is working and what isn't, so you can isolate the problem to a subset of the whole circuit. Here are some other debugging tips.

Question 1:
Fill in the truth table for the circuit on the answer sheet. (Take Care: It is easy to get confused when generating the various input combinations of the truth table. Think carefully what input value is generated when you PRESS a button vs. when you do NOT PRESS a button).
Question 2:
Based on the truth table, this circuit performs the same function as which other 2-input logic gate?

Part 3: Observing Signal Transitions

In this section you will configure the scope to watch for a non-repeating event, one that only happens occasionally, as opposed to the repetitive periodic signals we have observed earlier in this lab. Being able to look at signals that only change occasionally can be very useful when debugging a digital system. For example, in the circuit you just built when a button is pressed the output may change and we want to be able to use the scope to observe the nature of the input and output signals at the instant the signals changes.

To observe non-periodic signals start with the following steps.

  1. Get two probes from the scope's storage compartment. Note that the probes probably have colored bands on them, either yellow or green. These are there so you can easily see which probe is associated with each signal trace on the screen. Attach the probe with the yellow band to channel 1, and the one with the green band to channel 2.
  2. Turn on channel 2 by pressing the button with the big "2" on it above the position knob for channel 2. This should put a green signal trace somewhere on the screen.
  3. Adjust the vertical scale for both channels to be 2.0V per division.
  4. Use the positioning controls to put the yellow trace three divisions below the top of the screen, and put the green trace one division above the bottom.
  5. Adjust the horizontal scale setting to 100ns per division.
  6. Set the triggering for edge triggering, channel 1 and falling edge. We have to set it to a falling edge since we want to trigger when the button pressed, and when that happens the button signal goes from 1 to 0.
  7. Use the Level knob to set the trigger voltage to 2.0 Volts. This is about midway between the voltage for a logical 1 and a logical 0.
  8. Press the horizontal position knob near the top of the controls to move the trigger point to the middle of the screen.

The next step is to connect the scope to both the input signal and the output signal so both can be observed together. We are going to use channel 1 to observe the input signal and channel 2 to see the output signal.

  1. Attach the probe for channel 1 to the circuit node where button A, its pull-up resistor and the inverter are connected. This is the node labeled "P1" on the schematic.
  2. Attach the probe for channel 2 to the output of the inverter (point P2).
  3. Attach one or both of the two probe ground wires to the breadboard ground.

With button A not pressed the input signal is a logical 1 and you should see the yellow trace at just under 5V, indicating a logical 1 state. The green trace should be near 0V indicating a logical 0 state on the inverter output.

Press button A to make the input go to a logical 0 state. Both traces should move, the yellow from around 5V down to 0V, and the green from 0V up to near 5V. This shows the inverter circuit is working but about all we can see is two horizontal lines moving up and down as the button is pressed and released. The signals change too quickly to see the point where they make a transition from a logical 0 to a logical 1 or vice-versa. To see that we have to capture the signals at the instant they change and freeze the display.

Press the "Single" button in the upper right. This tells the scope to wait for the next time the input matches the trigger condition, capture and display the signals, and then freeze the display so we can look at them. Both traces will disappear from the screen since the scope is waiting for that trigger condition to occur. Now try pressing button A to change the input. The scope should acquire the signals as they are changing and display them frozen on the screen as shown in the picture below.

From the scope display we can see the input (yellow trace) made a transition from 1 to 0 when button A was pressed, and the inverter output (green trace) responded by going from 0 to 1. you may also be able to see a small propagation delay from the input to the output since the output signal (green) is lagging behind the input signal (yellow).

Part 4: Sequential Circuits

In this part of the lab we will build a small sequential digital circuit and measure how fast it can be operated. This circuit will use a register (remember this is the primary building sequential building block in digital circuits and can remember 1 value when you trigger it with a clock signal) and a combinational adder circuit (performs SUM = A + B in binary). The result of the circuit will be a 2-bit counter. You should eventually see two LEDs producing all the 2-bit numbers starting at 00 then progressing to 01, 10, 11, and then wrapping back to 00 again. A block diagram is shown below.

We will start at the output, Q, of the register. This represents the 2-bit number you will see on the LEDs. Notice how it feeds back to the A input of the adder and gets summed with 01 binary (i.e. Q+1). This value then becomes the D-input to the register and, on the next clock edge, will become the new Q value. So this is a clear example of sequential logic. We need to remember the last value (Q) to produce the next value (Q+1).

To implement the circuit you will use two integrated circuits: a 74LS283 four-bit adder circuit and 74LS175 four-bit register. The schematic for this part of the circuit is shown below. (Note: the small numbers on the schematic are the pin numbers of each IC.)

The 74LS283 and 74LS175 are "Medium-Scale Integration", or MSI, integrated circuits. They are the next step up in complexity above ones like the 74LS00 that just contain a few gates. MSI circuits perform more complex operations, in this case a four-bit adder (74LS283) and a four-bit register (74LS175). By combining them we can create a four-bit counter but here we will only build a two-bit counter.

The 74LS283 adds the two four-bit numbers consisting of the bits A4,A3,A2,A1 and B4,B3,B2,B1 to form the sum Y4,Y3,Y2,Y1. Our circuit saves the low two bits of the sum (Y2,Y1) in the register each time the clock signal goes from the 0 state to the 1 state. The saved sum bits appear on the register outputs Q2 and Q1. This sum is then fed back to the "A" input of the adder (Q2 → A2 and Q1 → A1) where it is added to the the "B" input that has been set to the value of 1 (B2 = 0 and B1 = 1) to create a new sum. The result is that each time there is a clock signal, the value on the output of the register increments by one from 0,0 to 0,1 to 1,0 to 1,1 and then back to 0,0 and repeats.

The following steps should be followed to build the circuit.

  1. Remove the two pushbuttons and the two ICs (74LS00 and 74LS04) from the breadboard. Leave the LED and its 470Ω current limiting resistor on the board.
  2. Get one each of the 74LS283 and 74LS175 from the instructor's podium. Also get an additional LED and a 470Ω resistor.
  3. Mount the two ICs on the breadboard. As done previously, make sure they are installed with pin 1 in the same orientation.
  4. First install the wiring for the power and ground connections. Both ICs should have pin 16 connected to +5V, and pin 8 to ground.
  5. Make the other connections required to +5V and ground. These are for the input pins that need to have a logical 0 or 1 on them.
  6. Follow the diagram and make the rest of the wiring between the two chips, the resistors and the LEDs. Make sure to note which LED is connected to the Q1 output and which to the Q2 output.

The only thing missing from the circuit is the "CLOCK" signal that causes the counter to operate. The next section describes how we will generate that. But at this point your breadboard should look something like the following image.

Clock Generation

The clock is a simple digital signal that constantly switches back and forth between 0 and 1 at a known rate. The oscilloscopes contain a waveform generator that can be used to create a clock signal.

  1. From the podium at the the front of the room, get one of the black cables that has a BNC connector on one end, and the other end is a pair of white and black wires with pins on the end. Attach the cable to the BNC connector just to the right of the scope's on/off button that's labeled Gen Out.
  2. If you haven't done so already, disconnect the scope probe on channel 1 from the Probe Comp tab and connect it to the pin on the end of the cable's white wire. Also attach the black alligator clip on the scope probe to the pin on the end of the cable's black wire. (So right now the scope is not attached to the actual circuit, instead we are just connecting it to the BNC cable and ensuring the clock signal is correct by viewing it on the scope's display. Once it is correct, we will connect it to the circuit on your protoboard.)
  3. In the Trigger portion of the controls, press the Wave Gen button to bring up the wave generator options. You should see something like in picture below. The tabs along the bottom are used to change the type and shape of the wave that is being produced.
  4. Select "Waveform" and use the knob to select "Square".
  5. Select "Frequency" and use the knob to adjust it to 1Hz.
  6. Select "Amplitude" and adjust it to 5Vpp.
  7. Select "Offset" and adjust it to 2.5V.
  8. Adjust the scope's controls to
    • Vertical = 2V/division
    • Horizontal = 500msec/division
    • Trigger = 2.5V

The scope display will take a relatively long time to move across the screen at 500ms/div but eventually you should see a stable display of the waveform being generated that looks like the one below. This should work fine as a clock signal for your circuit.

  1. Disconnect the cable from the scope probe and it's ground clip and connect the cable's black wire to ground on your breadboard.
  2. Connect the cable's white wire to the clock input of the 74LS175 (pin 9). So now the clock signal should be connected to your counter circuit and you should see the output "counting".

At this point your circuit should be counting and the two LEDs should be going on and off. Observe the LEDs and confirm that they are counting with the Q1 LED the least significant bit and the Q2 LED the MSB. The Q2:Q1 sequence should be 00, 01, 10, 11, 00, 01, etc. Make certain the LEDs are blinking in this sequence and they should be spending the same amount of time in each of four counter states.

Have one of the instructors come and confirm that your sequential circuit is working properly and record this on your check-off sheet.

Part 5: Counter Propagation Delay

Your two-bit counter is being clocked at a 1Hz rate which makes it easy to see the changes in the count values. The digital circuits used to build the counter can run much faster than 1Hz so let's try speeding it up.

  1. If the waveform generator settings are not shown across the bottom of the scope display, press the Wav Gen button to bring them up.
  2. Adjust the frequency of the clock signal to 10Hz. You should be able to still see the LEDs flashing in the 00, 01, 10, 11 sequence.
  3. Continue to increase the frequency. As the LEDs blink faster eventually they simply appear to be on all the time but dimmer than at low frequencies. Your eyes are integrating the on-off-on-off pattern into something that looks like its on continuously at 50% brightness.
Question 3:
At approximately what frequency does it become impossible to see any blinking and the LEDs appear to be on all the time?


The answers to the above questions should be edited into the "Lab2_Answers.txt" file
and the file uploaded to the Vocareum web site by the due date. See the Assignments page of the class web site for a link for uploading.

Please return the various ICs to the instructor's podium. Keep the buttons, resistors and LEDs you acquired for this lab in your project box. These will be needed for next week's lab and you can return them at a later date.

Lab 2 check off sheet