ENGR 43 Lab Activity Student Guide LAB 10 – Tek MSO 2014 and NI ELVIS Digital Tools Student Name: ___________________________________________________ Overview Getting Started This activity introduces the digital capabilities of the Tektronix MSO 2014 and NI-ELVIS. The student will generate and monitor parallel digital signals. Lab Activity and Deliverables: It should take students approximately 2 hours to complete the lab activity, and 1 hours of homework time to complete the lab report. Before Starting This Activity Additional information on the digital measurement capabilities may be found in the MSO 2014 Users Manual. Learning Outcomes For Activity Relevant knowledge (K), skill (S), or attitude (A) student learning outcomes K1. Identify the virtual instruments available in the NI-ELVIS. K2. Identify basic precautions and limitations of the NI-ELVIS hardware. K3. Identify digital measurement capabilities of the MSO 2014 scope. S1. Generate digital outputs from the NIELVIS S2. Assemble and monitor the operation of a basic microcontroller circuit. S3. Perform basic digital measurements with the MSO 2014. S4. Equipment & Supplies Item NI-ELVIS Probes and jumper wires as required PIC 16F88 microcontroller with LED chaser program Tek MSO 2014 scope with P6316 digital probe Digital probe header adapter set 5.6 kΩ ¼ W resistors 0.1 µF capacitor Qty 1 A/R 1 1 1 2 1 Special Safety Requirements None Lab Preparation Open the Measurement & Automation Explorer. If your connected ELVIS is not listed as “Dev1”, right-click on the disconnected Dev1 icon, select “Delete,” then right-click on the connected ELVIS icon, select “Rename,” and name it Dev1. Compile data into a test report. A1. Appreciate the differences between typical analog and digital signal measurement tools. LAB 10 –Tek MSO 2014 and NI ELVIS Digital Tools ENGR 43 1 © 2013 ENGR 43 Lab Activity Student Guide Task #1 – NI ELVIS - Visualizing Digital Byte Patterns The NI ELVIS II protoboard has a bank of eight green LEDs with input pin sockets labeled LED <0..7>. You can use them as visual indicators of digital logic states (On = HI and Off = LO). Complete the following steps to output a digital pattern using the Digital Writer: 1. Wire the LEDs <0..7> to the corresponding socket pins labeled DIO <0..7>. For example, connect DIO 0 to the pin socket LED <0>. Only one lead is required because the grounds are connected internally within NI ELVIS II. Note The digital I/O lines are located on the right side of the protoboard. 2. Launch the NI ELVISmx Instrument Launcher. 3. Select the Digital Writer (DigOut) icon. A new digital logic diagnostic window opens, so you can set/reset any of the digital lines to a HI or LO state. By default, the digital I/O lines <0..7> are selected from the three 8-bit ports in the Lines to Write box. 4. The digital output lines are labeled 0 to 7 reading right to left in the Manual Pattern box. You can set/reset (HI/LO) any bit by clicking on the top or bottom portion of the virtual switch. Collectively, these 8 bits constitute a byte that can be read in a binary, octal, hexadecimal, or decimal format, or in an SI notation in the display box above the switches. By clicking on the grayedout portion, you can set the radix (format) of this indicator. 5. After you have set a digital pattern, turn on the power to the protoboard and click Run (green arrow) to send the pattern to the parallel output digital I/O lines <0..7>, which in turn are passed on to the green LEDs. Note You can set the Generation Mode to output a single pattern or to continuously output the pattern. In continuous operation, the hardware is updated continuously with the current pattern. 6. What condition of the LED is associated with the connected digital output in the “1” state? Out = 1, LED is [ ON / OFF ] 7. The set pattern is echoed on the line states (blue LED indicators) of the Bus State on the SFP. Also, with the Action buttons of the SFP, you can toggle, rotate, or shift the bit pattern right or left. 8. Press the Stop button (red box) to cease updating the port. In testing a digital circuit, you can select from several commonly used patterns for diagnostic checks. LAB 10 –Tek MSO 2014 and NI ELVIS Digital Tools ENGR 43 2 © 2013 ENGR 43 Lab Activity Student Guide 9. Click the Pattern selector on the SFP to view the options available: Manual Load any 8-bit pattern Ramp (0 – 255) Computer Instruction INC Alternating 1/0s Computer Instruction INVERT Walking 1s Computer Instruction SHIFT LEFT 10. Try to output each bit pattern. Leave your circuit connected for the next task. Task #2 – Tek MSO 2014 Digital Signal Measurement Set up the MSO2014 as follows: 1. Connect the P6316 digital probe to the D0-15 input on the MSO2014. Gently push the connector into the scope until it clicks into place. 2. Locate the D0-D7 end of the digital probe. Note that one row of connectors connect the 8 digital inputs, and the other row has 8 ground connections. Insert the ground lead header adapter into two of the ground row connectors. Insert the 8-pin header adapter into rows 35-42 of the NI-ELVIS P3 connector (LED0-LED7). Connect the D0-D7 inputs of the P6316 digital probe to the header adapter. Note that the input label on the P613 will be facing down. Connect the ground lead adapter wire to the NI-ELVIS ground (P3 connector, row 53). 3. On the MSO 2014 scope, push the Default Setup button. By default, only analog input 1 is enabled. Since we will be using the digital inputs, press the Ch 1 menu button (yellow) twice to turn off Ch 1 input. 4. Press the D15 - D0 front panel button to display the digital input menu. 5. Push the lower-bezel D15 - D0 button to access the D15 - D0 On or Off menu. Turn on (enable) inputs D0 – D7 6. Push the lower-bezel Thresholds button. You can assign a different threshold value to each pod. For this exercise the default threshold should suffice. 7. Push the lower-bezel Height button repeatedly to set the signal height. You only need to do this once to set the height for all of the digital channels. Set the height to M. LAB 10 –Tek MSO 2014 and NI ELVIS Digital Tools ENGR 43 3 © 2013 ENGR 43 Lab Activity Student Guide 8. By default, the scope trigger input is set to analog Ch 1. Press the Trigger Menu button and change the trigger input to digital input D0. 9. Set the horizontal scale to 100 ms/div 10. Generate patterns with the NI-ELVIS Digital Writer tool. Compare the LED display with the scrolling timing diagram displayed on the scope. 11. While generating the Walking 1s pattern, adjust the scope horizontal scale to display a minimum of one complete cycle of the pattern. 12. Press the B1 Bus button. Select D0-D7 for input using the bezel buttons and multipurpose knob “a.” Note the hexadecimal values for the eight states (stages) of the Walking 1s pattern: ______ ______ ______ ______ ______ ______ ______ ______ 13. Leave the P6316 probe connected to the P3 connector. Remove the jumper wires between the DIO 0-7 and LED 0-7 rows. Task #3 – Microcontroller Output Measurement Pin 1 Assembly Diagram LAB 10 –Tek MSO 2014 and NI ELVIS Digital Tools ENGR 43 Pin 1 Location 4 © 2013 ENGR 43 Lab Activity Student Guide Components 8 Channel LED Chaser R1-R2 5K6 C1 100nF IC2 PIC 16F88 LED0-7 NI-ELVIS Indicators modi ed from: R1 VDD VDD = +5V VSS= Ground IC1 P3-41 LED7 LED6 LED5 LED4 LED3 LED2 P3-42 1. On the top of the 16F88, locate the dot next to Pin 1, and the notch on end of the package near Pin 1. The pins are numbered counter-clockwise from pin 1. 2. Verify that the proto board power switch is in the OFF position. 3. Insert the 16F88 in the proto board, with pin 1 in row 40, column E, as shown in the assembly diagram. IMPORTANT: Connecting and applying power to the IC backwards will destroy the IC. Verify the connections with the instructor if you are unsure about identifying Pin 1. VSS VSS VSS VSS DIO-0 VSS PIC16F88 P3-39 P3-40 LED1 16 15 4 3 2 1 18 17 P3-37 P3-38 VSS RA7/ASC1/CLKIN RA6/OSC2/CLKOUT RA5/MCLR/VPP RA4/TOCKI/CMP2 RA3/AN3/CMP1 RA2/AN2/VREF RA1/AN1 VSS RA0/AN0 P3-35 P3-36 LED0 5 13 12 11 10 9 8 7 6 VSS C1 RB7/T1OSI/PGD VDD RB6/T1OSO/1ICKI/PGC RB5 RB4/PGM RB3/CCP1 RB2/TX/CK RB1/RX/DT RB0/INT VSS 14 VSS Resistors 5% 1/4 or 1/8 watt carbon film Capacitors multilayer ceramic R2 VDD (c) 2008 VDD http://picprojects.org.uk 4. Cut and strip four 2” and four 4” 22 AWG jumper wires. Use these to wire the 16F88 outputs (pins 6-13) to the eight LEDs on the NI-ELVIS P3 connector. 5. Reference the schematic and assembly drawings to make the remaining connections: Pin 14 to VDD (+5V) Pin 5 to VSS (Ground) Pin 4 to R2 Pin 3 to R1 and to DIO-0 Connect the open ends of R1 and R2 to VDD Connect a 0.1 µF cap between VDD and VSS LAB 10 –Tek MSO 2014 and NI ELVIS Digital Tools ENGR 43 5 © 2013 ENGR 43 Lab Activity Student Guide 6. After double-checking your connections (ask the instructor if you need help), turn on the proto board power switch. 7. Open the Digital Writer NI-ELVIS tool, set bit 0 to “0” and click on the Run arrow. This bit controls the selection input to the 16F88, and will be referred to as Input in the remaining steps. 8. After about three seconds, LED 5, 6, or 7 should be lit. Once this happens, set Input to 1. This places the 16F88 in configuration mode. 9. Momentarily set Input to 0, and then back to 1. Note that each time Input is pulsed the lit LED steps to the next LED. Pulse the Input until LED 5 is lit. This selects “manual step” mode for the LED sequence patterns. 10. Set Input to 0 for three seconds to exit configuration mode and start the LED Chaser sequence. As soon as you see the sequence start, return Input to 1. 11. Pulse input (0, then back to 1) to select the next sequence. Continue to step through the patterns until you reach pattern 1, which is a Walking 1s pattern with the LEDs stepping at approximately 0.5-second intervals. 12. Set the MSO 2014 horizontal scale to 1s/div. To see a scrolling display of the individual digital signals, press the B1 Bus button to turn off the bus display. 13. Examine the timing display and the LED indicators. Is the LED “On” state indicated by a logical “0” or “1” on the display? _____________________________ 14. Which LED corresponds to display bit D0? _____________________________ 15. If necessary, set the scope horizontal scale to view between one and two complete cycles of the pattern. 14. Press the B1 Bus button to view the hexadecimal value of the 8 data bits. What are the 8 values? ______ ______ ______ ______ ______ ______ ______ ______ Are these the same as the Walking 1s pattern from Task 1, Step 12? ________________________________ 15. Pulse the Input to step to pattern 2. Refer back to steps 12 through 14 to acquire and display the pattern on the MSO 2014. How many steps are in this pattern? _______________________________ 16. Adjust the scope display to view between one and two complete cycles of the pattern and the hex bus value. Note the hexadecimal values for each step in the pattern. Save this image on your USB drive to paste into the Performance Report at the end of this lab procedure. 17. Repeat steps 15 and 16 for patterns 3, 4, and 5. Note that patterns 4 and 5 cycle at a faster speed than patterns 1, 2, and 3. Number of steps in pattern 3 _______ Number of steps in pattern 4 _______ Number of steps in pattern 5 _______ 18. Leave your circuit connected for the next step. LAB 10 –Tek MSO 2014 and NI ELVIS Digital Tools ENGR 43 6 © 2013 ENGR 43 Lab Activity Student Guide Task #4 – Pulse-Width Modulated Patterns 1. Pulse the Input to step to pattern 6. Instead of sequencing from one LED to the other, this pattern changes the brightness of the LEDs with a technique called pulse-width modulation, or PWM. 2. Press the Acquire menu button. Set the record length to 1.25 M (million) samples. 3. Press the B1 Bus menu button twice to turn off the B1 display (with PWM, the values are either 00 or FF). Observe the scrolling display. The traces will be white when the data is alternating between 0 and 1. What color are the traces when the value is a steady 0? ____________________________ What color are the traces when the value is a steady 1? _____________________________ 4. Press the Run/Stop button to stop data collection. Press the Wave Inspector button (the magnifying glass icon) to zoom in on the areas where the data are alternating between 0 and 1. Find an area of the pattern where the LEDs are dimly lit (immediately before or after the steady “0” areas). 5. What is the period between the short “1” pulses? ________________________________ 6. What is the width of the pulse? 9. What is the period between the “1” pulses? ________________________________ 10. What is the width of the pulse? ________________________________ 11. What is the duty cycle of the waveform? (duty cycle = pulse/period*100%) ________________________________ 12. Use the results from steps 7 and 11 to complete the following table: LED Off Duty Cycle 0% Low Med High 100% 13. Do the steps in brightness follow a linear or exponential increase? _________________________________ What does this indicate about how your eye perceives brightness? _________________________________ _________________________________ ________________________________ 7. What is the duty cycle of the waveform? (duty cycle = pulse/period*100%) ________________________________ 8. Move the wave inspector to the moderate brightness area (just before or after the full brightness area). LAB 10 –Tek MSO 2014 and NI ELVIS Digital Tools ENGR 43 7 © 2013 ENGR 43 Lab Activity Student Guide Task #4 – Extra Credit – Advanced PWM Patterns 1. Pulse the Input to step to pattern 7. This is a complex pattern that sequences between LEDs and also uses PWM. Capture the waveform of pattern 7. Provide a description for this pattern on a separate page. You may use a combination of text description, captured waveforms, and/or a table for each step to describe the pattern. 2. Similar to Step 1, describe pattern 8. Deliverable(s) Print the last three pages of the performance report with your pasted images of the timing diagrams and save them with this activity guide in your Lab Activity Binder. LAB 10 –– Performance Report Task #3 – Microcontroller Output Measurement Paste and print the screen images of patterns 2, 3, 4 and 5 on a separate page. The next page has a sample template you may use. For each pattern, identify the number of steps and the hexadecimal values of each step. LAB 10 –Tek MSO 2014 and NI ELVIS Digital Tools ENGR 43 8 © 2013 ENGR 43 Lab Activity Performance Report Pattern 2: Number of steps = _____, Hexadecimal values = _____________________________________ Paste Pattern 2 MSO2014 screen here Pattern 3: Number of steps = _____, Hexadecimal values = _____________________________________ Paste Pattern 3 MSO2014 screen here LAB 10 –Tek MSO 2014 and NI ELVIS Digital Tools ENGR 43 9 © 2013 ENGR 43 Lab Activity Performance Report Pattern 4: Number of steps = _____, Hexadecimal values = _____________________________________ Paste Pattern 4 MSO2014 screen here Pattern 5: Number of steps = _____, Hexadecimal values = _____________________________________ Paste Pattern 5 MSO2014 screen here LAB 10 –Tek MSO 2014 and NI ELVIS Digital Tools ENGR 43 10 © 2013