Sie sind auf Seite 1von 13

EE2112 Circuit II Lab

Experiment 10: Introduction to LabVIEW

1 Introduction and Objectives

LabVIEW is a type of simulation software, but unlike PSpice, LabVIEW can be used to connect
to the real world. Many of the devices that you have already used in the lab have the ability to
be connected to a LabVIEW computer by what is called GPIB (General Purpose Interface Bus).
This allows LabVIEW to take user-defined inputs and create outputs for real world instruments
such as power supplies and multimeters. The labs youll be doing in this class deal with simulations.
This week, you’ll be introduced to some basic structures of LabVIEW by first simulating a function
generator, then simulating some digital logic circuits.

Note 1: No hand written assignments submission will be accepted. Create a tem-


plate inside a Microsoft word document (or other word processing software) like the
sample template provided for you for Lab 01 and answer questions in this document.

Note 2: Laboratory TA’s have primary responsibility to check your final results. You
must get your laboratory instructor(TA)’s signature for any part of lab’s short form
report during lab/open lab time if it is required. If your lab has “Laboratory Helper”,
do not ask Lab helper to give you laboratory instructor approval.

2 Pre-lab Assignment

Everything for submission in this lab will be done on the canvas page. Each person writes and
submits an individual and unique data collection sheet include student name and lab section and
TA name and submit it on canvas course page in pre lab assignment BEFORE your appropriate
lab section starts.
∗ As stated in the EE2112 Lab Policy Document for every lab you are required to bring a flash
drive.
Perform the following:

1. Figure 1 shows a logic circuit. Give the truth table (Table 1) for the circuit in the Prelab
created report.
EE2112 Circuit II Lab Experiment 10: Introduction to LabVIEW

Figure 1: Prelab Logic Circuit

Table 1: Prelab Truth Table for Fig. 1

Input 1 Input 2 Output


A B X
0 0
0 1
1 0
1 1

2. Table 2 a hypothetical logic circuit output. On your data sheet, draw a circuit that would
produce the output shown in Table 2 from the inputs shown.

Table 2: Prelab Truth Table 2

Input 1 Input 2 Output


A B X
0 0 1
0 1 0
1 0 0
1 1 1

3. Before going to lab, open up LabVIEW, then go to the File menu and select New> Blank VI.
There are three main palettes that allow you to build in and interact with LabVIEW. What
are they? Use the LabVIEW Environment section of Help>VI, Function, and How to Help,
and write the three palette names and tell what they do on your data sheet.

3 Part 1: Function Generator

The first portion of our show will be to build a function generator from the step-by-step instructions
that follow. At the end, youll demonstrate to your instructor that the simulator works, and answer
a few questions about its operation on your data sheet.

Rev. November 27, 2017 Michigan Technological University Page 2 of 13


EE2112 Circuit II Lab Experiment 10: Introduction to LabVIEW

1. Open LabVIEW. This can be done from following path:


Start menu ⇒ All Programs ⇒ National Instruments ⇒ Labview.
Once that is open choose, Blank VI from the window. This will open at least one new window.
If there are two windows it is alright, we will need them both.

2. Put down a digital control from the controls palette. This can be done by:
View ⇒ Controls Palette ⇒ Express ⇒ Num Ctrls.
Dragging and dropping the control on Front Panel Window. Now type Function Number
before doing anything else. This will save us some work in the future. Once this is done you
should have a window like that of Fig. 2.

Figure 2: Front Panel After Step 2

3. Right click on the new control that you just placed and select the Properties window then
from Display Format, Format and Precision. This will give a new window titled Format
and Precision like that of Fig. 3. Change the dropdown selection from Significant Digits to
Digits of Precision and enter 0 (zero) in the corresponding field. Click OK. This could also
be accomplished by right clicking on Function number and clicking properties.

Rev. November 27, 2017 Michigan Technological University Page 3 of 13


EE2112 Circuit II Lab Experiment 10: Introduction to LabVIEW

Figure 3: Format and Precision Dialog Window

4. At this point it is time to put down some more controls. Find the Dial under the controls
palette, or using:
Controls Palette ⇒ Express ⇒ Num Ctrls ⇒ Dial.
Place this on the Front Panel Window and type Amplitude. This will be the amplitude of
the waveforms.

5. Place another dial in the same manner and type Frequency. This will be the frequency of
the waveforms

6. Now, under the Graph part, place a Waveform Graph. This can be found under:
Controls Palette ⇒ Express ⇒ Graph Indicators ⇒ Graph
Type in Waveform Output before doing anything further. Right click on the Waveform Chart
and select Visible Items Plot Legend from the menu. This will remove the Plot Legend from
the chart. After this the Front Panel should look like that of Fig. 4.

Rev. November 27, 2017 Michigan Technological University Page 4 of 13


EE2112 Circuit II Lab Experiment 10: Introduction to LabVIEW

Figure 4: Completed Front Panel after adding the Waveform Graph

7. This will take care of the Front Panel for now. Now switch to the block diagram window by
choosing:
Window ⇒ Show Block Diagram
From the menu on the top of the screen. This will open a window like that of Fig. 5. If
the window doesn’t look exactly like that of Fig. 5, don’t worry, it is about to be changed
anyway. This is where the coding for LabVIEW takes place. Like SPICE, LabVIEW has its
own work environment.

Figure 5: LabVIEW 7 Block Diagram Window

8. The mouse arrow is context sensitive. It changes as it scrolls over different parts of the
window. It will look like an arrow when it thinks there's something to choose, or grab and
drag.

Rev. November 27, 2017 Michigan Technological University Page 5 of 13


EE2112 Circuit II Lab Experiment 10: Introduction to LabVIEW

9. Click on the orange box below the labels to move components around. Drag the components
labeled Amplitude, Frequency, and Function Number to the left side of the window so that
theyre arranged in a column.

10. Right click on the orange box for the Function Number and choose Representation I 8 from
the pop up menu. This will change the indicator from a double precision variable to an integer
value.

11. The next step will be to draw a case selection box. This can be done by choosing:
View ⇒ Functions Palette ⇒ Express ⇒ Exec Control ⇒ Case Structure
Now click and drag from somewhere near the amplitude box to somewhere down towards the
right of the screen. You should get something that looks like Fig. 6 below. (Later in the
lab, you will be asked to explain what the case statement does. For now, the case selection
box can be thought of as a graphical representation of a case statement in a programming
language.)

Figure 6: Diagram window before adding the waveforms

12. The tricky part begins. Right click on where the case box says True and select Add Case
After. Enter 1 from the key board. Repeat this 2 more times entering 2 and 3 from the
keyboard. Now, click on the selector label between the two arrows and go back to one of the
two cases (True or False). Then right click again and select Delete This Case from the menu.
Repeat this for the False (or True) case also.

13. To make the case selection work as designed, we need to give it some value that it can be
selected from. Again, the mouse is context sensitive and changes to suit what it thinks you
want to do. When its on a connector, like one of the little triangle connectors, it will change
to something that looks like a little spool of wire. This could also be found by View, Tools.
If you left click on the mouse when it is on top of one of the connectors, the connector will
be highlighted. Hold the button down and drag the wire to the other connector. Click on

Rev. November 27, 2017 Michigan Technological University Page 6 of 13


EE2112 Circuit II Lab Experiment 10: Introduction to LabVIEW

the blue box below Function Number and drag to the little question mark on the side of the
Case Selection Box.

14. Before continuing, make sure that case 1 is in the little box at the top of the Case Selection
Box. Now right click between the arrows and choose Make this the Default Case from the
menu. This sets case 1 as the default if no case is selected. When done you should have
something that looks like Fig. 7.

Figure 7: Diagram window after case additions and wire

15. From here we have to add the specific waveforms. Under case 1, we are going to put a sine
wave. This can be found under:
Functions Palette ⇒ Express ⇒ Signal Analysis ⇒ Simulate Sig
Place this in the middle of the case selection box. You can double click on this component at
any time to configure its properties but as soon as you drop the icon inside the case statement
the Configure Simulate Signal Window will pop up whether you want it to or not. In the
Configure Simulate Signal Window:

• Under Timing, set Samples /second (Hz) to 1000.


• Next to Number of Samples, uncheck the Automatic checkbox.
• Set Number of Samples to 1000.

These settings will set the x-axis to 1 second.

16. The Configure Simulate Signal window should look similar to Fig. 8. Click OK.

Rev. November 27, 2017 Michigan Technological University Page 7 of 13


EE2112 Circuit II Lab Experiment 10: Introduction to LabVIEW

Figure 8: Configuring a sine wave for case 1

17. Case 2 will be a square wave. Switch to case 2 by clicking on the arrow on the right on top of
the case selection box. Inside of case 2, place another Simulate Sig component in the middle
of the case selection box. In the Configure Simulate Signal window, change the wave type to
Square. Make the same changes as described in 15a-c.

18. Case 3 will be a triangle wave. Switch to case 3. By now you should be able to figure out
how to add the triangle wave simulator. (Its just like the last two steps!) You should end up
with a block diagram window that looks like Fig. 9

Rev. November 27, 2017 Michigan Technological University Page 8 of 13


EE2112 Circuit II Lab Experiment 10: Introduction to LabVIEW

Figure 9: Diagram window after adding the waveforms to the Case Selection Box

19. Wire the output of the Frequency function to the Frequency input connector of the sine wave.
Then wire the amplitude box to the amplitude of the sine wave. Then wire the sine wave
output to the Waveform Output box. Check this against Fig. 10 to verify that it is correct.

Figure 10: Completed Diagram Window after wiring the Sine Wave Function

20. Repeat this same process for the other two cases also. This exact wiring scheme works for all

Rev. November 27, 2017 Michigan Technological University Page 9 of 13


EE2112 Circuit II Lab Experiment 10: Introduction to LabVIEW

three functions.

21. Return to the Front Panel Window and click the Run Continuously button. This button looks
like two arrows chasing each other. Now you can change the values of Amplitude, Frequency,
and Function Number. Notice that if Function Number is less than 1 or greater than 3 the
waveform defaults back to the sine wave. The simulation is complete as Fig. 11.

Figure 11: Completed Front Panel Window continuously executing the Triangle Function

To Turn In:

22. Demonstrate to your TA that the simulator you built works, and have your TA initial your
data sheet in the appropriate spot.

23. What is a case structure? On your data sheet write a paragraph describing what a LabVIEW
case structure does in general, and how it operates, then describe how it operates specifically
in your function generator simulator.

24. On your data sheet, write a few sentences about what the differences are between the Front
Panel window and the Block Diagram window.

25. Write a paragraph describing what a LabVIEW case structure does in general, and how it
operates, then describe how it operates specifically in your function generator simulator.

4 Part 2: Logic Simulation

1. In this part of the lab we are going to create a digital logic circuit in LabView. The circuit
youll build is the one that you drew using Table 2 from Question 2 of the Pre-Lab.

2. Add a Boolean toggle switch to the Front Panel from the Controls Palette. This is found
under:
Controls Palette ⇒ Express ⇒ Buttons&Switche
Any type of switch. Name this A. Add another switch and name this B.

Rev. November 27, 2017 Michigan Technological University Page 10 of 13


EE2112 Circuit II Lab Experiment 10: Introduction to LabVIEW

3. Add a Boolean indicator from the:


Controls Palette ⇒ Express ⇒ LEDs
This is an LED that will light up when the Boolean is in the True state. Name this X (or
something appropriate).

4. Switch to the Diagram and wire up the circuit you drew from the pre-lab (Table 2).

5. Switch back to the Front Panel and run the circuit continuously and fill in the truth table for
the circuit into new created Table 3 on your data collection report.

Table 3: Truth table for simulation or prelab circuit

Input 1 Input 2 Output


A B X
0 0
0 1
1 0
1 1

6. Demonstrate operation for the TA and have the TA initial your data collection report.

5 Part 3: Logic Simulation II

Simulate a circuit in LabVIEW that behaves according to the truth table in Table 4. You can do
more than two inputs of an AND or OR gate, add the following component to the diagram window:
Functions Palette ⇒ Programming ⇒ Boolean ⇒ Compound Arithmetic
Once this is done, right click on the input side and choose Add Input until the desired number
of inputs is reached. The mode can be changed also, by right clicking and choose Change Mode
Desired Modeon the output side.

Figure 12: Compound Arithmetic operator with several inputs

Here, first you should reduce the truth table using what you know from digital logic class, then
build the simpler circuit. Draw ’Karnaugh maps’to facilitate the simplification of Table 4 and write
your mathematical expiration for it. Have your TA initial in your data collection report after you
demonstrate it.

Rev. November 27, 2017 Michigan Technological University Page 11 of 13


EE2112 Circuit II Lab Experiment 10: Introduction to LabVIEW

Table 4: Truth Table for Part 3

Input 1 Input 2 Input 3 Output


A B C X
0 0 0 1
0 0 1 1
0 1 0 0
0 1 1 1
1 0 0 1
1 0 1 1
1 1 0 0
1 1 1 1

Rev. November 27, 2017 Michigan Technological University Page 12 of 13


EE2112 Circuit II Lab Experiment 10: Introduction to LabVIEW

6 Laboratory Data Collection Requirements for lab

• Each person writes and submits an individual and unique data collection report. Include the
following in your written report:

– The lab title.


– Student full name
– Lab TA name
– Student section number

• Include images and data tables, o-scope images, screen captures and any other figures.

• Include at least two sentences to explain describe each figure. Reference any relevant data
table or figure that was collected.

• Answer all blue questions in complete sentences.

• Discuss and comment on all result and conclude your work. Describe any general trends and
important results interpreted from the collected data.

• Get your TA’s initials when you finalize your data collection file.

Rev. November 27, 2017 Michigan Technological University Page 13 of 13

Das könnte Ihnen auch gefallen