Home

LabVIEW Hands-On Campus Workshop Seminar Manual

image

Contents

1. National Instruments Corporation 3 LabVIEW Hands On Campus Workshop Section LabVIEW Environment A Set up Your Hardware B Take Your First Measurement e Open and Explore Final Project Audio Equalizer C Demonstration Creating our First VI D LabVIEW Environment E Hands On Exercise Acquiring Data Write a program that reads in a signal from a microphone c7 NATIONAL INSTRUMENTS LabVIEW Hands On Campus Workshop 4 ni com A Setting Up Your Hardware e Data Acquisition Device DAQ Track A NimyDAQ a Configured in Measurement and Automation Explorer MAX Sound Card Track B Available in most PCs No additional configurations required NATIONAL ni com WiNsTRUMENTS This LabVIEW course is designed for audiences with or without access to National Instruments hardware Each exercise is divided into two tracks A and B Track A is designed to be used with the NI myDAQ which is supported by the NI DAQmx driver Track B is designed to be used with your sound card in your PC or laptop National Instruments Corporation 5 LabVIEW Hands On Campus Workshop N my DAQ _ USB controlled Bs e bus powered Power Supply 5 V 8 DIO lines Analog Input 2 channels 200kS s ch 16 bit Analog Output zje Hej i 1 counter 2 channels 200kS s ch 16 bit 4 alk DIO 8 lines i ines e 2A0 lines CTR 1 counter Integrated DMM V A Ohm a B re mi Po
2. 0 0 500 1000 1500 2000 2500 3000 3500 4000 4500 5000 Frequency Hz 6 Add anew case to the case structure a On the block diagram right click the border of the case structure b Select Add Case for Every Value from the right click menu This is shown below 8 ido Equalizer End of Ex5 Track Bwi Block Diagram file Edt View Project Operate Tools Window Help Be ke n ea kol L5pt Appkcaton Font oga go 7 Examine the case structure A third case called Audio Effects has been added Place the Volume 2 and Effect controls inside this case Why did selecting add case for every value automatically name the new case The Run button shows a broken arrow icon indicating that the VI cannot currently run do you know why not If not try clicking the Run button This will open an Error List that lists items that must be resolved for the VI to run Part 2 Description Now that we have modified the architecture of the VI we can add new functionality Many music recordings have different musical elements on the left and right tracks but the same vocal elements By quite literally subtracting one track from the other we can remove the matched vocal track from the output signal In order to do this we ll need to split the signal into its two component tracks LabVIEW Hands On Campus Workshop 92 ni com Procedure 1 Wire the Volume 2 control terminal into the orange tunnel o
3. FM Audio Equalizer End of Exd vi Block Diagram file Edit View Project Operate Tools Window Help hai a a es bo M of l5pt Application Font a DAO Assistant Main Application Instance 5 Pass the DAQ Assistant data wire directly through this case to the output tunnel 6 To resolve the empty orange tunnel right click on the terminal and select Create Constant Leave it as the default 0 E 8 Audio Equalizer End of Ex4 vi Block Diagram oo File Edt 5 7 DAQ Assistant P A DAQ Assistant data Spectral Measurements gnals Waveforr Peak ae hase 9 m Graph 7 Return to the front panel and run the VI How has the behavior of the VI changed Does switching tabs change the data on the graph Why doesn t any audio come out when the Plot Frequency Spectrum Only signal tab is selected End of Exercise 4 Track A National Instruments Corporation 75 LabVIEW Hands On Campus Workshop Exercise 4 Creating an Audio Equalizer Track B Goal Use additional filters to create a full audio equalizer Implement a Case Structure to allow the user to turn equalizer on or off Part 1 Description We can add to the existing code in our program to make an audio equalizer that functions like your car stereo In order to do this we ll need to isolate more than just the Bass If we create s
4. Use the buttons on top of the palette windows to navigate search and edit the palettes You can search for controls VIs and functions that either contain certain words or start with certain words Double clicking a search result opens the palette that contains the search result You also can click and drag the name of the control VI or function directly to the front panel or block diagram You can use the Search Bar in the toolbar on the front panel and block diagram the search in the function and control palettes and quick drop to find functions Quick Drop Select View Quick Drop to display the TA Quick Drop Quick Drop dialog box You also can press the lt Ctrl Space gt keys to display Incomplete Beta Function MI_Gmath lib this dialog box Incomplete Gamma Function vi MLGmath belib Riemann Zeta Function ML Gmath belib p i NET Object To Variant Use this dialog box to specify a palette E he SALE a object or project item by and then place 1D Linear Evaluation PtByPti NI_PtbyPt Ivlib f LD Polar to Rectangular PrByPt vi NI_PtbyFt Ilib the object on the block diagram or front LD Polynomial Evaluation PtByPt vi NI_PtbyPt Ivlib 1D Rational Polynomial Evaluation MILAALPra blib p anel Press the lt Enter gt key LD Rectangular to Polar PtByPtwi NI_PtbyFt Ilib double click the name of the object in 2D ANOVA vi NLAALPra lvlib f 2D Cartesian Coordinate Rotation vi MNIL_AALFro lvlib the search resul
5. Bundle Forms a cluster containing the given objects in the specified order Bundle by Name Updates specific cluster object values the object must have an owned label Unbundle Splits a cluster into each of its individual elements by data type Unbundle by Name Returns the cluster elements whose names you specify Note You must have an existing cluster wired into the middle terminal of the function to use Bundle By Name National Instruments Corporation 99 LabVIEW Hands On Campus Workshop Using Arrays and Clusters with Graphs faveform Graph Peo MA The waveform data type contains 3 pieces of data 0 Start time e dt Time between samples e Y Array of Y magnitudes You can create a waveform cluster in two ways 00 00 00 000 PM MMDDJYYYY at NATIONAL INSTRUMENTS The waveform data type carries the data start time and At of a waveform You can create waveforms using the Build Waveform function Many of the VIs and functions you use to acquire or analyze waveforms accept and return the waveform data type by default When you wire a waveform data type to a waveform graph or chart the graph or chart automatically plots a waveform based on the data start time and Ax of the waveform When you wire an array of waveform data types to a waveform graph or chart the graph or chart automatically plots all the waveforms Build Waveform Builds a waveform or modifies an existing waveform with the
6. ao g 3 a 120 iae ndas asi kai eos 00 500 1000 1500 2000 2500 3000 3500 4000 4500 5000 Frequency Hz NATIONAL ni com INSTRUMENTS This is the application we will be building throughout this workshop We will be breaking down each of the components of our audio equalizer and understanding what each aspect of this program is contributing to the final project We will then rebuild the project taking time to explain the LabVIEW environment and helpful programming tips and tricks throughout this session You can find this file by navigating to the lt Workshop VIs gt Audio Equalizer with xxx vi If you are using hardware select Audio Equalizer with Hardware vi and if you are using your sound card select Audio Equalizer with Sound Card vi To run our first VI double click on the VI file and LabVIEW will open up Take some time to explore the two windows that pop up Navigate to the window with the gray back ground In the upper left hand corner click on the white arrow This will start the program so you can explore the VI After starting your VI send audio to the program by either making sounds into the microphone or starting music on your mp3 player You can modify the sound of the audio by clicking on the tabs and sliders to produce different effects and listen to the changes in your headphones speakers Note Make sure you completed Exercise before attempting to run this VI National Instruments Corporation 13 La
7. A Highly Productive Graphical Development Environment for Engineers and Scientists a m7 a T DAQ Assistant i m Tear ahs is li a a aia oli hat data II e Pe ih hal h AA A y TTR L pie JAA Paddy Custom User Interfaces Deployment Targets Technology Abstractions Programming Approaches NATIONAL ni com INSTRUMENTS Definition LabVIEW is a development environment that has been built specifically for engineers and scientists with the intent of making them more productive and ensuring that they have all the tools they need to prototype design and build their applications How can we claim that LabVIEW makes you more productive LabVIEW makes users more productive because it provides all the tools engineers need in a single environment and ensures that they all work and can be used together The key is guaranteed compatibility between engineering tools Technology Abstractions LabVIEW s compiler abstracts complex technological problems like multicore virtualization memory allocation and network communication Hardware APIs Over 8 000 drivers for instruments and a wide range of USB PCI and PXI instruments make it easy to integrate real world signals into software G Programming Language G is acomplete programming language capable of solving the most complex and advanced problems today There are a variety of other programming approaches in LabVIEW but G is the language that ties them together
8. Don t forget to submit your project to ni com studentdesign for a chance to win prizes and a trip to Austin TX NATIONAL INSTRUMENTS LabVIEW Hands On Campus Workshop 60 ni com Section Ill Analyzing and Presenting Your Results A Demonstration Arrays and Auto Indexing B Arrays e Creating Arrays e Auto Indexing C Displaying Data on the Front Panel e Graphs and Charts D Demonstration Case Structures e Decision Making E Hands On Exercise Audio Equalizer c7 NATIONAL INSTRUMENTS National Instruments Corporation 61 LabVIEW Hands On Campus Workshop Demonstration Arrays Creating Arrays and Auto Indexing element Programatically Creating Arrays e7 NATIONAL ni com y INSTRUMENTS LabVIEW Hands On Campus Workshop 62 ni com Arrays An array consists of elements and dimension What do those terms mean When would you use an array In LabVIEW what is the index of the first element in an array NATIONAL INSTRUMENTS An array consists of elements and dimensions Elements are the data that make up the array A dimension is the length height or depth of an array An array can have one or more dimensions and as many as 2 1 elements per dimension memory permitting You can build arrays of numeric Boolean path string waveform and cluster data types You cannot create an array of arrays but you can use a multidimensional array in LabVIEW Consider using arrays when you work wit
9. Input Clear and Sound Output Clear to the Merge Error VI Wire the output of the Merge Errors VI to the Simple Error Handler Wire the data terminal of the Sound Input Read to the Signal input of the Filter Wire the Filtered Signal output and the Bass control into a Multiply function The output of the first Multiply function goes two places One is the Signals input of the Spectral Measurements The second Multiply function receives the Volume control and the output of the first Multiply function The output of the second Multiply is wired into the data terminal of the Sound Output Write E TI Audio Equalizer End of Ex3 Track file Edt View Project Operate Tools Window Help D ay 5 f Measurements Waveform Graph LabVIEW Hands On Campus Workshop 58 ni com 10 Return to the front panel and run the VI If you have an mp3 player or external audio source try connecting it to your microphone input How does the behavior of the finished VI differ from the last exercise Try adjusting the values of the Volume and Bass slides how is the graph affected What sort of sound comes out of your speakers headphones Can you think of a practical application for this type of signal manipulation What is the purpose of the error handling that we did End of Exercise 3 Track B National Instruments Corporation 59 LabVIEW Hands On Campus Workshop Video myDAQ Piano Staircase YouTube Video Link
10. You can add any front panel objects to the active page A page is active when the tab for that page is flush with the page and the objects on the page are visible Terminals for controls and indicators you place on the tab control appear as any other block diagram terminal Note When you add objects to a tab control page frequently go to the block diagram window and arrange the newly added terminals When you add several objects to a tab control the terminals on the block diagram can become cluttered On the block diagram the tab control is an enumerated control or indicator As a control you can pass the value of the active page to other block diagram nodes As an indicator you can wire nodes to control which page is displayed You do not need to wire the tab control terminal for the tab control to operate You can wire the enumerated control terminal of the tab control to the selector of a Case Structure to produce cleaner block diagrams With this method you associate each page of the tab control with a subdiagram in the Case structure You place the control and indicator terminals from each page of the tab control as well as the block diagram nodes and wires associated with those terminals into the subdiagrams of the Case structure National Instruments Corporation 71 LabVIEW Hands On Campus Workshop Exercise 4 Creating an Audio Equalizer Track A Goal Use additional filters to create a full audio equalizer Implemen
11. correspond to the three existing front panel objects 500 1000 1500 2000 2500 3000 3500 4000 4500 5000 Frequency Hz stop NI myDAQ AUDIO IN NI myDAQ AUDIO OUT 5 Place a DAQ Assistant on the block diagram a Right click on the block diagram to open the Functions Palette National Instruments Corporation 31 LabVIEW Hands On Campus Workshop b Select the DAQ Assistant by navigating to Express Input DAQ Assistant c Click on the block diagram to place the DAQ Assistant Functions Y Express AAL edr P Favorites P User Libraries Select a Vi YF 6 Configure the DAQ Assistant a The Create New Express Task window will appear If it does not double click on the DAQ Assistant icon Navigate to Acquire Signals Analog Input Voltage b In the next window expand the myDAQ entry and select audioInputLeft and audioInputRight hold down the Shift key to select multiple channels Click Finish c The DAQ Assistant window appears In the Signal Input Range area change the Max and Min to 1 5 and 1 5 Volts Make sure to do this for both channels Voltage_0 and Voltage_1 Under Timing Settings change the Acquisition Mode to Continuous Samples set Samples to Read to 5k and Rate Hz to 20k Your window should match the one shown on the next page LabVIEW Hands On Campus Workshop 32 ni com i ae DAQ Assistant xs 9 Aja x lt Run Add Channels Remove Ch
12. function inside the Audio Effects case This function is under Express Signal Manipulation From DDT b When you place the function on the block diagram a configuration window will appear On the Resulting data type list select Single waveform Leave Channel as 0 r 3 Configure Convert from Dynamic Data Convert from Dynamic Data c Right click on the Convert From Dynamic Data function s Channel terminal and select Create Constant Leave it as the default 0 d Create a second Convert From Dynamic Data function Use a constant to set its Channel to 1 e Wire the input signal into the Dynamic Data Type terminal on both conversion functions It should look like the image on the next page LabVIEW Hands On Campus Workshop 88 ni com E 3 Audio Equalizer End of Ex5 vi Block Diagram File Edit View Project Operate Tools Window Help Vii P pt Application Font 3 Place a Subtract a Select and a Not function on the Block Diagram These are under Programming in Numeric Subtract Comparison Select and Boolean Not 4 Wire the two conversion Waveform terminals into the Subtract function s inputs x and y and the Subtract output x y into the false f terminal of the Select function 5 In addition wire the Waveform terminal of either conversion function directly into the true t terminal of the Select function 6 Wire the Effect control terminal into th
13. group together LabVIEW and other files create build specifications and deploy or download files to targets A target is a device or machine on which a VI runs When you save a project LabVIEW creates a project file lvproj which includes configuration information build information deployment information references to files in the project and so on You must use a project to build stand alone applications and shared libraries You also must use a project to work with a real time FPGA or PDA target Refer to the specific module documentation for more information about using projects with the LabVIEW Real Time LabVIEW FPGA and LabVIEW Mobile modules Project style LabVIEW Plug and Play instrument drivers use the project and project library features You can use project style drivers in the same way as previous LabVIEW Plug and Play drivers Project Explorer Window Use the Project Explorer window to create and edit projects Select File gt New Project to display the Project Explorer window You also can select Project New Project or select File gt New and then select Empty Project in the New dialog box to display the Project Explorer window LabVIEW Hands On Campus Workshop 104 ni com NI Multisim and Ultiboard World s most popular software for learning electronics 180 000 industrial and academic users Products include Multisim simulation and capture Ultiboard PCB layout Multisim MCU Module microcontroller sim
14. our program to make the equalizing an optional function In this case we will utilize the Tab Control on the front panel When the Audio Filtering tab 1s selected the equalizing functions will work as we just observed If the Plot Frequency Spectrum Only tab is selected those functions will be disabled Procedure 1 Place a Case Structure on the block diagram a Select a Case Structure by navigating to Programming Structures Case Structure b We want the Case Structure to contain the filters signal addition and Volume control As with the While Loop click in the upper left corner and drag to create the Structure c The small green question mark on the left side of the Case Structure is called the case selector Wire the Tab Control terminal into the case selector The case selector should turn blue 44 E 4 Audio Equalizer End of Ex4 vi Block Diagram File Edit View Project Operate Tools Window Help E E xX Eroj F L F LabVIEW Hands On Campus Workshop 74 ni com 2 The case label should change to Audio Filtering The colored boxes on either side of the Case Structure are called data tunnels The two tunnels on the right edge of case structure have white centers because they aren t wired in the other case The VI will only execute if the output value of a tunnel is defined in every case 4 Change to the Plot Frequency Spectrum Only case using the arrows at the top of the Case Structure
15. output of the first Multiply function goes two places One is the Signals input of the Spectral Measurements The second Multiply function receives the Volume control and the output of the first Multiply function d The output of the second Multiply is wired into the data terminal of the second DAQ Assistant analog output l 4 Audio Equalizer End of Ex3 vi Block Diagram File Edt Vie Project Operate Tools Window Help l5pt Application Font 3 6 Return to the front panel and run the VI If you have an mp3 player or external audio source try connecting it to myDAQ instead of the microphone How does the behavior of the finished VI differ from the last exercise Try adjusting the values of the Volume and Bass slides how is the graph affected What sort of sound comes out of your speakers headphones Can you think of a practical application for this type of signal manipulation End of Exercise 3 Track A National Instruments Corporation 55 LabVIEW Hands On Campus Workshop LabVIEW Hands On Campus Workshop 56 Exercise 3 Outputting Sound Track B a b C Goal Apply a variable filter to alter the incoming data and output the modified signal Description We can do more than just acquire and analyze a signal in LabVIEW In this exercise we will use the audio output of your computer to play the signal on speakers or headphones There s no fun in outputting the exact same signal
16. paused execution Click the Pause button E again to continue running the VI LabVIEW Hands On Campus Workshop 22 ni com Select the Text Settings pull down menu to change the font Dpt Application Font 7 eels settings for the VI including size style and color Select the Align Distribute and Resize Objects pull down a oy lag the menu to align objects along axes space objects evenly and change the width and height of objects respectively Select the Show Context Help Window button to toggle the display of the Context Help window Click the Retain Wire Values button to save the wire values at AR each point in the flow of execution so that when you place a probe on the wire you can immediately retain the most recent value of the data that passed through the wire Select Step Into Step Over and Step Out to debug your ba lot program step by step Each node will blink to denote when it is ready to execute ey Click the Clean Up Diagram button to automatically reroute all existing wires and rearrange objects on the block diagram to generate a cleaner layout National Instruments Corporation 23 LabVIEW Hands On Campus Workshop Using the Search Functions Feel free to reference LabVIEW to find the answers Can you name three ways you can search for a function in LabVIEW Where are the following items located z DAQ Assistant Waveform Chart Two Button Dialog NATIONAL ni com INSTRUMENTS
17. start time represented as an Matar Grapa b i Ti Wire data directly to waveform graph absolute timestamp limestamps are accurate to ee eee real world time and date and are very useful for eee WOT Sing le Flot real world data recording a WDT waveform Data Type includes timing info Bundle Others default to for x and 1 for Ax Combine timing information using a bundle node fe a Builds a waveform or modifies an existing T AX cea zs waveform Graph waveform with a relative timestamp The input to y array t is a DBL By building waveforms using the See the example Waveform Graph vi bundle you can plot data on the negative x axis time LabVIEW Hands On Campus Workshop 100 ni com Shift Register Access Previous Loop Data Available at left or right border of loop structures e Right click the border and select Add Shift Register e Right terminal stores data on completion of iteration e Left terminal provides stored data at beginning of next iteration Value 15 Loop First Second Begins Iteration Iteration Iteration NATIONAL ni com OnstRUMENT S Shift registers transfer data from one iteration to the next e Right click on the left or right side of a For Loop or a While Loop and select Add Shift Register e The right terminal stores data at the end of an iteration Data appears at the left terminal at the start of the next iteration e A shift register adapts to any data type
18. terminal of the Waveform Graph e Return to the front panel start your music and click the Run button the white arrow in the upper left corner FH Audio Equalizer End of Ex2 Track B vi Block Diagram File Edit View Wi Vi Project Operate Tools w Help o gt aD CH y 2 bal OP Spt Application Font SIG cnp id What did you see when you clicked the Run button Try running the VI multiple times while making different sounds into the microphone Do the results on the graph change Part 2 Description Oftentimes a user will want to acquire data continuously In order to repeat an operation indefinitely in LabVIEW we can use a While Loop This will repeat the code contained inside until a user defined stop condition is achieved In this case we will use the Stop button on the front panel 1 Place a While Loop on the block diagram a Navigate to Programming Structures While Loop on the Functions Palette We want to enclose only some items in the loop We want everything but the Sound Input Configure and Sound Input Clear VIs in our While Loop Can you think of why We only need to configure and clear our system once so we do not need for these VIs to execute every iteration LabVIEW Hands On Campus Workshop 38 ni com b Click in the upper left corner of the block diagram and drag your mouse to the lower right corner to place the While Loop Ensure that all components except for
19. that we read in so we ll apply a variable filter to isolate part of the signal In this case we ll extract the bass low frequency elements and play them back Procedure 1 Add volume slides to the Audio Filtering tab of the front panel On the front panel select the Audio Filtering tab Right click on the front panel to open the Controls Palette Navigate to Modern Numeric Vertical Pointer Slide Place the slide in the small box in the Audio Filtering tab and name it Volume The default scale is O to 10 but we want ours to be 0 1 Double click the 10 at the top of the slide and type a 1 The rest of the scale will update accordingly Create a copy of the slide by pressing lt Ctrl gt and dragging the slide to the right Name the copy Bass Your front panel should resemble the one shown below 60 Power dB 120 0 0 500 1000 1500 2000 2500 3000 3500 4000 4500 5000 Frequency Hz Plot Frequency Sp A g Volume Bass NI myDAQ 1 i t AUDIO gt IN os os 06 0s 0A OA a 0 2 0 2 c stop ni com 2 Place a filter on the block diagram a Return to the block diagram and add a filter from Express Signal Analysis Filter b Leave the Filtering Type a as Ie ut Lowpass but change Cutoff Frequency Hz to 400 3 Place a Sound Output Configure VI on the block diagram a Right click on the block diagram to open the Functions palette Select the Sound
20. use LabVIEW and upgrade functionality of LabVIEW request technical support om previous versions LabVIEW News 3 You will see that the major elements of the front panel have already been created for you There is a Waveform Graph a Stop button and a Tab Control we will add more items to the front panel in the next exercise 4 Open the block diagram by selecting Window Show Block Diagram or by pressing lt Ctrl E gt You can see the terminals that correspond to the three existing front panel objects 120 i 0 0 500 1000 1500 2000 2500 3000 3500 4000 4500 5000 Frequency Hz stop wn Onh Asisko Filtering Plot Frequency Spectrur NI myDAQ AUDIO IN NI myDAQ AUDIO gt OUT LabVIEW Hands On Campus Workshop 36 ni com 5 Place a Sound Input Configure VI on the block diagram a Right click on the block diagram to open the Functions palette Select the Sound Input Configure by navigating to Programming Graphics and Sound Sound Input Sound Input Configure vi c Click on the block diagram to place the Sound Input Configure VI 6 Place a Sound Input Read VI on the block diagram a Right click on the block diagram to open the Functions palette Select the Sound Input Read by navigating to Programming Graphics and Sound Sound Input Sound Input Read vi c Click on the block diagram to place the Sound Input Read VI d Create a constant for the number of samples
21. variable and choose the object from the Select Item menu Next you must decide to either read or write to the object Right click on the local variable and choose Change to Read or Change to Write LabVIEW Hands On Campus Workshop 102 ni com LabVIEW Navigation Window aaa gt Navigation x gee i i 7 aO Bouncing Cube in an XY Graph vi Block Diagram E parer e a ai eee ae P a cect y x am Shows the current region of view compared to entire front panel or block diagram e Great for large programs Organize and reduce program visual size with subVIs Ww NATIONAL INSTRUMENTS ni com Select View Navigation Window to display this window Use the window to navigate large front panels or block diagrams Click an area of the image in the Navigation Window to display that area in the front panel or block diagram window You also can click and drag the image in the Navigation Window to scroll through the front panel or block diagram National Instruments Corporation 103 LabVIEW Hands On Campus Workshop LabVIEW Project recur RECIFE Group and organize VIs S Project Untitled Project 1 My Computer Manage hardware and I O fa test vi H S Dependencies L Build Specifications Manage VIs for multiple targets Build libraries and executables Manage large LabVIEW applications Enable version tracking and management NATIONAL ni com INSTRUMENTS LabVIEW Project Use projects to
22. 0 Oo A 120 4 BLT Ahaha 0 0 500 1000 1500 2000 2500 3000 3500 4000 4500 5000 Plot Frequency Spectrum Only Audio Filtering NI myDAQ AUDIO IN NI myDAQ AUDIO gt OUT lt W gt Server localhost lt Frequency Hz Volume Bass E 1 ga 0 82 0 8 0 6 o s 0 42 0 42 0 22 0 22 Fe s Dp gt Signal Filtered Signal DAQ Assistant SSS aa Track A Code Tab Control Volume Bq AIRGAS nnnnnannnood Signals Waveform Graph FFT Peak gt gt Filter Bass Eo Deere a EEEEEEEEEEEEIZIEE Signal Filtered Signal gt es Tab Control g E a National Instruments Corporation 111 O A Volume osu _ geak A lp Spectral i Measurements b Signals Waveform Graph LabVIEW Hands On Campus Workshop Solutions Section Audio Equalizer End of Ex4 vi File Edit View Project Operate Tools Window Help Exercise 4 saem Track A ahy r i Aedh a dia Power dB 120 1 1 1 1 1 1 1 1 1 0 0 500 1000 1500 2000 2500 3000 3500 4000 4500 5000 Frequency Hz Plot Frequency Spectrum Only Audio Filtering Midtone Treble NI myDAQ AUDIO IN NI myDAQ AUDIO OUT lt W gt Server localhost lt E P a 3 prea Spectral Measurements Waveform Graph FFT Peak Tab Control Filter Bass mld Signal
23. 4 Track B vi Block Disgram o a jee Eile Edt View Project Operate Toots Window Help at D a 9 es m amp 2 LSpt Application Font i fo IES Oe gt a i e 2 Ma 4 Recombine the three filtered signals a Place two Add functions on the block diagram from Programming Numeric Add b Use one Add function to combine the multiplied Midtone and Treble outputs and use the second Add to combine that sum with the Bass output c This new sum should be wired to the Spectral Measurements and the second multiplier that feeds into the Sound Output Write VI r B tudio Equalizer End of Ex4 Track B vi Block Diagram oo sl File Eda Yiew Project Operate Tools Window Help 4 Jae q eyed 2 leo an 9 ole 5 Return to the front panel and run the VI Try listening to yourself or music through the audio equalizer Do the results match what you expected If you turn all three equalizer slides up does the output signal match the original input signal National Instruments Corporation 77 LabVIEW Hands On Campus Workshop Part 2 Description We now have a working audio equalizer but a key question has been overlooked What if the user wants to turn off the equalizing functions and analyze the original input signal We need to modify our program to make the equalizing an optional function In this case we will utilize the Tab Control on the front panel When the Audio F
24. Corporation 45 LabVIEW Hands On Campus Workshop Drawing a Loop 1 Select the structure Programming Structures Structures LJ E For Loop While Loop Timed Struct W O 8 Case Structure Event Struct In Place Ele n u Flat Sequence Stacked Seq J O Diagram Dis Conditional Formula Node pa Shared Varia Local Variable Global Varia C Decorations Feedback No ni com 2 Enclose code to be repeate rj Gj 3 Wire up the Stop Condition and add any additional code NATIONAL INSTRUMENTS The While and For Loops can be found by navigating to Functions Palette Programming Structures Select the While or For Loop from the palette then use the cursor to drag a selection rectangle around the section of the block diagram you want to repeat When you release the mouse button a loop boundary encloses the section you selected Add block diagram objects to the loop by dragging and dropping them inside the loop LabVIEW Hands On Campus Workshop When selected the mouse cursor becomes a special pointer that you use to enclose the section of code you want to include in the While Loop Click the mouse button to define the top left corner and then click the mouse button again at the bottom right corner The loop boundary appears around the selected code Drag or drop additional nodes in the loop if needed If you draw a While Loop be sure to wire up the Conditional Terminal 46 ni c
25. Filtered Sianal p ee a a se ee ee Spectral e Signal d Measurements Filtered Signal A n aiii m i Signals Waveform Graph FFT Peak gt Phase Filter Treble Filtered Signal p A Tab Control LabVIEW Hands On Campus Workshop 112 ni com Solutions Section Ebi Audio Equalizer End of Ex4 vi a X e I Cl S e File Edit View Project Operate Tools Window Help Track B Code National Instruments Corporation 113 LabVIEW Hands On Campus Workshop l b Power dB O Q 120 1 1 I i 1 1 i I 1 0 0 500 1000 1500 2000 2500 3000 3500 4000 4500 5000 Frequency Hz Plot Frequency Spectrum Only Audio Filtering Midtone Treble NI myDAQ 1 AUDIO IN 8 8 0 8 0 8 0 6 0 6 NI myDAQ E z 0 4 AUDIO Ce pE be FE OUT z lt W gt Server localhost lt ae Plot Frequency Spectrum Only Default gt pp RRIS ea Spectral Measurements Waveform Graph mzn Tab Control 6 Volume Signal j Filtered Signal 1p oT go f g p g f AEE EERE EEEEEEREE gt i PEAK a oy Spectral Filter Midtone Measurements eSignal Ha A Filtered Signal p SS a FFT Peak pea 3 A Filter Treble tz Signal Ta
26. Input Configure by navigating to Programming Graphics and Sound Sound Output Then select Sound Input Configure vi c Click on the block diagram to place the Sound Output Configure VI 4 Place a Sound Output Write vi on the block diagram following the steps outlined above 5 Place a Sound Output Clear vi on the block diagram following the steps outlined in step 3 6 Place two Multiply functions on the block diagram These can be found on the Functions palette at Programming Numeric Multiply 7 Place a Merge Errors VI on the block diagram outside of the While Loop This can be found on the Functions palette at Programming Dialog amp User Interface Merge Error National Instruments Corporation 57 LabVIEW Hands On Campus Workshop 8 Place a Simple Error Handler on the block diagram outside of the While Loop This can be found on the Dialog and User Interface palette as well tle Edit w Project Operate Took Window Help pi B OAR 3 F of Spe Appacation Font tor ta e gt a 9 Re wire the block diagram to include the new functions a Wire the task ID and error out terminals of the Sound Output Configure to the task ID and error in input of the Sound Output Write respectively Wire the task ID and error out terminals of the Sound Output Write to the task ID and error in input of the Sound Output Clear respectively Wire the error out wires of the Sound
27. LabVIEW Hands On Campus Workshop Seminar Manual April 2011 Edition Part Number 351286C 01 Copyright 2008 2011 National Instruments Corporation All rights reserved Under the copyright laws this publication may not be reproduced or transmitted in any form electronic or mechanical including photocopying recording storing in an information retrieval system or translating in whole or in part without the prior written consent of National Instruments Corporation National Instruments respects the intellectual property of others and we ask our users to do the same NI software is protected by copyright and other intellectual property laws Where NI software may be used to reproduce software or other materials belonging to others you may use NI software only to reproduce materials that you may reproduce in accordance with the terms of any applicable license or other legal restriction Trademarks LabVIEW National Instruments NI ni com the National Instruments corporate logo and the Eagle logo are trademarks of National Instruments Corporation Refer to the Trademark Information at ni com trademarks for other National Instruments trademarks Linux is the registered trademark of Linus Torvalds in the U S and other countries Product and company names mentioned herein are trademarks or trade names of their respective companies Members of the National Instruments Alliance Partner Program are business entities independent from Natio
28. Replace with Stacked Sequence Remove Case Structure Add Case After Add Case Before Duplicate Case Delete This Case Show Case Plot Frequency Spectrum Only Default 1 Make This Case Plot Frequency Spectrum Only Default E Make This The Default Case Properties 7 Examine the case structure A third case called Audio Effects has been added Place the Volume 2 and Effect controls inside this case Why did selecting add case for every value automatically name the new case The Run button shows a broken arrow icon indicating that the VI cannot currently run do you know why not If not try clicking the Run button This will open an Error List that lists items that must be resolved for the VI to run National Instruments Corporation 87 LabVIEW Hands On Campus Workshop Part 2 Description Now that we have modified the architecture of the VI we can add new functionality Many music recordings have different musical elements on the left and right tracks but the same vocal elements By quite literally subtracting one track from the other we can remove the matched vocal track from the output signal In order to do this we ll need to split the signal into its two component tracks Procedure 1 Wire the Volume 2 control terminal into the orange tunnel on the right side of the case structure 2 Separate the input signal into left and right tracks a Place a Convert From Dynamic Data
29. S Graphs are very powerful indicators in LabVIEW You can use these highly customizable tools to concisely display a great deal of information VIs with a graph usually collect the data in an array and then plot the data to the graph A waveform graph does not update with every iteration of a loop like a waveform chart does With the properties page of the graph you can display settings for plot types scale and cursor options and many other features of the graph To open the properties page right click the graph on the front panel and choose Properties You can also create technical paper quality graphics with the Export Simplified Image function Right click the graph and select Data Operations Export Simplified Image Export Simplified Image Bitmap bmp j Peak Value Encapsulated Postscript eps Enhanced Metafile emf Export to clipboard Save to file Hide Grid hnim National Instruments Corporation 67 LabVIEW Hands On Campus Workshop Control and Indicator Properties e Properties are characteristics or qualities about an object e Properties can be found by right clicking on a control or indicator e Properties include Size tees Color Plot style Plot color Features include Cursors Scaling o cne He NATIONAL ni com INSTRUMENTS Objects in the front panel window also have property dialog boxes that
30. VIEW n i com kb Graphical Programming Execution Structures Examine the basics of graphical programming and how to See how to loop code and conditionally execute code in Getennine date flow and order of execution in the LabVIEW LabVEW using For Loops While Loops and Case ervirorenert siruchres Programming Tools Help Within Labview NI Developer Zone puea m o we nestat mLa Leann to vee ap eases nave ate me ni com devzone Debugging and Handling Errors Learn how to uss hey debugging and toutleshooting loots that optemecre code LabVIEW Certification ni com lv101 LabVIEW Fundamentals Exam free on ni com academic Certified LabVIEW Associate Developer Exam industry recognized certification INSTRUMENTS ni com y NATIONAL National Instruments Corporation 107 LabVIEW Hands On Campus Workshop The LabVIEW Certification Program Architect Mastery of LabVIEW Certified Expert in large application development LabVIEW Skilled in leading project teams Architect Developer Advanced LabVIEW knowledge and application development experience Project management skills Certified LabVIEW Developer Associate Developer Proficiency in navigating the LabVIEW environment Certified LabVIEW Associate Some application Developer development experience Fundamentals Exam Papae Free Online Fundamentals Exam NATIONAL INSTRUMENTS Today more and more companies and hiring manage
31. Window 3 Demo My First VLvi Block Diagra File Edit View Project Operate Tools Wir i j 1 Output siete PM 3 51 31 740 PM z Terminal 1 7 2011 7 2011 Time Input STOP 3 Terminals Main Application Instancaf lt Boolean Control NATIONAL ni com INSTRUMENTS When you create an object on the front panel a terminal is created on the block diagram These terminals give you access to the front panel objects from the block diagram code Each terminal contains useful information about the front panel object it corresponds to Such as the color and symbols providing information about the data type For example the dynamic data type is a polymorphic data type represented by dark blue terminals Boolean terminals are green with T F lettering In general blue terminals should wire to blue terminals green to green and so on This is not a hard and fast rule you can use LabVIEW to connect a blue terminal dynamic data to an orange terminal fractional value for example But in most cases look for a match in colors Controls have a thick border and an arrow on the right side Indicators have a thin border and an arrow on the left side Logic rules apply to wiring in LabVIEW Each wire must have one but only one source or control and each wire may have multiple destinations or indicators National Instruments Corporation 17 LabVIEW Hands On Campus Workshop LabVIEW Enviro
32. XI System Unidentified F Serial amp Parallel Historical Data aj Scales ears l Software GI Software fi M Drivers gt H M Drivers ii 9 i 5 EY Remote Systems y emate Systems i 5 Change the name of your myDAQ Your myDAQ may appear with a device name which appears in quotes like Dev1 by default Change the device name to myDAQ1 by right clicking on NI myDAQ and selecting Rename This is shown in the right image above 6 With the myDAQ selected click the button labeled Test Panels to open up the MAX Test Panel National Instruments Corporation 9 LabVIEW Hands On Campus Workshop 7 Under the Analog Input tab choose myDAQ audioInputLeft from the Channel Name list Change the Mode to Continuous and set the Max Input Limit and Min Input Limit to 2 and 2 respectively Clicking the Start button should show data in the Amplitude vs Samples Chart 8 Try running the test panel again with the Channel Name set to myDAQ audioInputRight You should see similar results Test Panels NI myDAQ myDAQ Analog Input Analog Output Digital 1 0 Counter 1 0 Amplitude vs Samples Chart Auto scale chart 7 0 06 0 04 0 02 0 0 02 0 04 0 06 Value 2 57m gt Start _ Stop Why is it important to conduct this exercise before starting our LabVIEW program Try running the test panel with the Max and Min limits set back to the
33. al programming environments comments make code more understandable and easier to debug Within the LabVIEW environment inserting comments is as simple as double clicking on empty space and typing Comments can be created for both front panels and block diagrams LabVIEW Hands On Campus Workshop 28 ni com Tips for Working in LabVIEW e Keystroke Shortcuts lt Ctrl H gt Activate Deactivate Context Help Window lt Ctrl B gt Remove Broken Wires from Block Diagram lt Ctrl E gt Toggle between Front Panel and Block Diagram lt Ctrl Z gt Undo also in Edit menu lt Ctrl T gt Tile Front Panel and Block Diagram Tools Options Set Preferences in LabVIEW e File VI Properties Configure VI Appearance Documentation etc e Create Control Constant Indicator Right click on terminal to create NATIONAL ni com INSTRUMENTS LabVIEW has many keystroke shortcuts that make working easier The most common shortcuts are listed above While the Automatic Selection Tool is great for choosing the tool you would like to use in LabVIEW there are sometimes cases when you want manual control Once the Automatic Selection Tool is turned off use the Tab key to toggle between the four most common tools Operate Value Position Size Select Edit Text Set Color on front panel and Operate Value Position Size Select Edit Text Connect Wire on block diagram Once you are finished with the tool you chose you can press l
34. all of your probes even those from subVIs From this central location you can monitor values and see when data was last updated If you see a suspect value double clicking on the value in the Probe Watch Window will highlight the wire on your block diagram Probe Watch Window Probe Display Probes Value Last Update A E Untitled 1 1 Probe Mot Executed EEE 2 Numeric Mot Executed ke e Retain Wire Values Used with probes to view the values from the last iteration of the program e Breakpoint Sets pauses at different locations on the diagram Click on wires or objects with the Breakpoint tool to set breakpoints LabVIEW Hands On Campus Workshop 26 ni com Context Help Window Extract Single Tone Information vi ox ACP H ow m any ways to d j S p ay th e Extract Single Tone Information vi error in no error detected phase deg advanced search error out measurement info context help window can you list ae Takes a signal in finds the single tone with the highest amplitude or signal in input to determine the polymorphic instance to use or manually select the instance Detailed help NATIONAL ni com INSTRUMENTS The Context help window displays basic information about LabVIEW objects when you move the cursor over each object Objects with context help information include VIs functions constants structures palettes properties methods and events To display the Context help w
35. am Otherwise the array terminal appears black with an empty bracket To add dimensions to an array right click the index display and select Add Dimension from the shortcut menu You also can use the Positioning tool to resize the index display until you have as many dimensions as you want LabVIEW Hands On Campus Workshop 64 ni com Building Arrays with Loops Auto Indexing Auto Indexinc N Loops can accumulate arrays at their boundaries with auto indexing For loops auto index by default While Loops output only the final value by default How can you enable disable auto indexing Wire becomes thicker 1D Array Indicator 012345 Auto Indexing Disabled Wire remains the same size Numeric Indicator Only one value last iteration 5 is passed out of the loop Abie INSTRUMENTS For Loops and While Loops can index and accumulate arrays at their boundaries This is known as auto indexing e The indexing point on the boundary is called a tunnel e The For Loop is auto indexing enabled by default Ep e The While Loop is auto indexing disabled by default You can enable or disable auto indexing by right clicking on a tunnel and selecting Enable Indexing or Disable Indexing Examples e Enable auto indexing to collect values within the loop and build the array All values are placed in the array upon exiting the loop e Disable auto indexing if you are interested only in the final value Natio
36. annels Hide Help ni Express Task Connection Diagram Back ER Measuring Yoltage of Most measurement l l l l l l l l l devices are designed for measuring or reading voltage Two common Amplitude O m I Configuration Triggering Advanced Timing Logging voltage measurements are DC and AC Channel Settings DC voltages are useful ya A for measuring X Petals Voltage Input Setup phenomena that change nn slowly with time such as settings temperature pressure Yoltage_1 or strain Signal Input Range Scaled Units n voltages on the other Max and are waveforms Volts that constantly increase Min 1 5 decrease and reverse polarity Most powerlines deliver AC voltage Terminal Configuration Click the Add Channels button des b to add more channels fo Custom Scaling m m iai lt No Scale gt mE This graph displays the analog signals acquired Timing Settings or generated by the Acquisition Mode Samples to Read Rate Hz device Continuous Samples Sk 20k OK Cancel d When finished click OK and wait for the function to build When the build is complete you may see the Confirm Auto Loop Creation prompt Should this occur select No E Confirm Auto Loop Creation You have configured this task with a mode that typically requires you to place the DAQ Assistant Express VI in a loop Would you like to
37. automatically create the loop now You will not be prompted again for this VL 7 Place a Spectral Measurements function on the block diagram a Create a Spectral Measurements function by navigating to Express Signal Analysis Spectral in the Functions palette Place the function on the block diagram b In the Configure Spectral Measurements window change the Selected Measurement to Magnitude Peak Leave all other default settings unchanged Click OK National Instruments Corporation 33 LabVIEW Hands On Campus Workshop 8 Connect the functions and test the VI a Wire the data terminal of the DAQ Assistant to the Signals input of the Spectral Measurements b Wire the FFT Peak output of the Spectral Measurements to the input terminal of the Waveform Graph c Return to the front panel and click the Run button the white arrow in the upper left corner 13 Audio Equalizer End of Ex2 vi Block Diagram Eile Edit View Propect Operate Toos Window elp Dl ajile bo Spt Application Font orf star e gt a Kall What did you see when you clicked the Run button Try running the VI multiple times while making different sounds into the microphone Do the results on the graph change Why are there two different lines blue and gray on the graph Part 2 Description Oftentimes a user will want to acquire data continuously In order to repeat an operation indefinitely i
38. b Control coats i O eae deeeieleguidiamemstacnaieioeac OO wl Solutions Section J Xel cise 4 Audio Equalizer End of Ex5 vi File Edit View Project Operate Tools Window Help Power dB O 120 i i i i i i i i i i 0 0 500 1000 1500 2000 2500 3000 3500 4000 4500 5000 Frequency Hz Plot Frequency Spectrum Only Audio Filtering Audio Effects Volume 2 NI myDAQ I e AUDIO 3 IN ae 0 6 NI myDAQ AUDIO OUT lt W gt Server localhost lt Audio Effects I a Si 2 A K2 E K G o E K ES Ss Sy i H 3 2 3 H a H cy 3 cs H i H DAQ Assistant SE Track A Code OOOO mm FFT Peak gt Phase gt Tab Control Volume 2 a C Spectral A y Measurements 4 p Signals Waveform Graph FFT Peak gt free Tab Control E LabVIEW Hands On Campus Workshop 114 ni com
39. bVIEW Hands On Campus Workshop Time to Break it Down Acquire Analyze Present Gather data from your Extract useful information from Visualize results in graphs and myDAQ or another data your data with interactive charts Create custom user acquisition device wizards and more than 600 built interfaces and reports in text in LabVIEW measurement files HTML Microsoft Word analysis and signal processing Microsoft Excel and more functions NATIONAL INSTRUMENTS LabVIEW is a graphical programming language that uses icons instead of lines of text to create applications In contrast to text based programming languages where instructions determine program execution LabVIEW uses dataflow programming where the flow of data determines execution order In every LabVIEW application there is a general pattern of first acquiring data analyzing and processing the data and then presenting the data in a report or on a graph Acquire With more than 50 million I O channels sold in the last 10 years NI is a global leader in PC based data acquisition LabVIEW provides a single programming interface resulting in seamless hardware and software integration Analyze LabVIEW software has more than 600 built in functions for signal synthesis frequency analysis probability statistics math curve fitting interpolation digital signal processing and more You can also extend NI LabVIEW with application specific processing for sound and vib
40. ch input Right click on the input on the top of the Sound Input Read VI and select Create Constant e Type 25000 in the constant by double clicking on the value 7 Place a Sound Input Clear VI on the block diagram following the steps outlined in step 5 but select Sound Input Clear vi instead of Sound Input Read vi r B auc Ex file t ew Piget Open cok Window Help P JARE ISpt Appacation Font 320 aur Se x 5 9 Wave Esi Tab Control 8 Place a Spectral Measurements function on the block diagram a Create a Spectral Measurements function by navigating to Express Signal Analysis Spectral in the Functions palette Place the function on the block diagram b Inthe Configure Spectral Measurements window change the Selected Measurement to Magnitude Peak Leave all other default settings unchanged Click OK National Instruments Corporation 37 LabVIEW Hands On Campus Workshop 9 Connect the functions and test the VI a Wire the task ID and error out terminals of the Sound Input Configure to the task ID and error in input of the Sound Input Read respectively b Wire the task ID and error out terminals of the Sound Input Read to the task ID and error in input of the Sound Input Clear respectively c Wire the data output of the Sound Input Read to the Signals input of the Spectral Measurements d Wire the FFT Peak output of the Spectral Measurements to the input
41. chematic capture and simulation tool Visit ni com Multisim_for more info Tere oe eee To Audo Oui TESES di Track B Using Your Soundcard A soundcard microphone and speakers Suggested Hardware ty Description supper 3 5 mm male to male audio cable AND Set of speakers or headphones Connect the microphone to the audio input jack on your computer OR Connect the audio cable from an mp3 player to the audio input jack Connect the set of speakers to the audio output jack of your computer National Instruments Corporation 7 LabVIEW Hands On Campus Workshop Demonstration What is MAX x Stands for Measurement amp Automation Explorer APER REENA amp Automation e Organizes all your National Instruments hardware and software e Configure your hardware in MAX oe Analog nout Analog Output Digtal VO Counter LO e Tests your device in MAX Ee Oe Mode Min Input Limit Samgies To Read Frite 2 a 000 2 Input Configuration Devices and Interfaces Measurement amp Automation Explorer File Edit View Tools Help 4 9 My System K Create New E Data Neighborhood a g Devices and Interfaces n NIPCI 6251 Devi Devices and Interfaces Ni myDAQ myDAQ Devices and Interfaces lists installed and detected A Network Devices CAN DAQ FieldPoint Serial Controllers GPIB MI PX PXI System Unidentified Motion Serial VISA Vision and VXI hardware Jy Serial amp Parallel Ampltud
42. classroom curriculum and hands on exercises to colleges and universities After completion of the LabVIEW Academy program students have the knowledge and tools to attempt the Certified LabVIEW Associate Developer certification exam with confidence LabVIEW Hands On Campus Workshop 108 ni com Your Next Step LabVIEW Skills Evaluation Quiz httos lumen ni com nicif us infolvcoursefinder content xhtml CLAD Exam Practice https lumen ni com nicif us ekitcladexmprp content xhtml CLAD Exam Prep Webcast http Zone ni com wv app doc p id wv 566 ENESENN ta LabVIEW Your first step to LabVIEW certification 7 NATIONAL ni com y INSTRUMENTS National Instruments Corporation 109 LabVIEW Hands On Campus Workshop Solutions Section 4 Audio Equalizer End of Ex2 vi File Edit View Project Operate Tools A Help XeFrcise smem Power dB O 1205 0 0 500 1000 1500 2000 2500 3000 3500 4000 4500 5000 Frequency Hz Plot Frequency Spectrum Only Audio Filtering NI myDAQ AUDIO IN lt W gt Server localhost lt Track A Signals Waveform Graph Code Tab Control i prak Spectral Measurements Tab Control Zon Stop 7 i LabVIEW Hands On Campus Workshop 110 ni com Solutions Section D Audio Equalizer End of Ex3 vi N k bbe eS File Edit View Project Operate Tools Window Help Ti Exercise szem of F 0 wal a 6
43. csssssssssseeeeccecceeeceeeeeaaasssesseeseececeeeeeeeeeeesauassssssssseeeeeeeeess 43 Exercise 5 Outputtine Sound Track A stars sctets tei a a ae eras tera en 53 Exercise 3 Outputting Sound Track B scsi dsesisioaersazsnnnncsineatwariddensnainaenasbaneeussedteetvarncdoseaaianenwstoanedes 56 Section III Analyzing and Presenting Your Results cccccccccccccecccccccecaeseeeeeseeeeeeeeeeeeeeeeeeeeaaaaaeeeeeees 61 Demons Tanon ATA Sisicur stents cat pete ia tarer neice ca gt una eeste ae taal anne naa etads 62 Demonstration ase Struc tire reoeo a tidlouiaiadedeolantoses 69 Exercise 4 Creating an Audio Equalizer Track A cccseeeesssseeeeeeccccececeeeeaaaeeesssssseeeeeeceeeseeenaaas 72 Exercise 4 Creating an Audio Equalizer Track B o ccc eeecssseeeeeeececeeeeececaaeeeessesseeeeeeceeeseeeseaaas 76 Section NV imine and File W O eaa a E AE 81 Demonstration A tine a LOO p sab sakat esata case ea chic EAE 82 Exercise 5 Creating Karaoke Setting Track A cccccccccssssssssssseeeeeeecccceccecenaceeessssseeeeeeeeeceeeeeeeeeaas 86 Exercise 5 Creating Karaoke Setting Track B eseeenssssssssssssssseccreeeesssssesssssssseecceeererssssssssssssses 91 Section V Advanced Data Flow Topics Optional ccccceeeececeeceececeeaneeseseeseeeececceeeeeeeseeaaaaeeeessees 96 Addi nona RESOUN O a licen ea eh a a nadie Cad th net adit 107 SONO SCC IO a ls sete ees Mentos ha acetates te
44. ctions Programming Structures Case Structure Select Returns the value wired to the T input or F input depending on the value of S If S is TRUE this function returns the value wired to T If S is FALSE this function returns the value wired to F The connector pane displays the default data types for this polymorphic function It is found at Functions Programming Comparison Select e Example A Boolean input Simple if then case If the Boolean input is TRUE the true case executes otherwise the FALSE case executes e Example B Numeric input The input value determines which box to execute If out of range of the cases LabVIEW chooses the default case e Example C When the Boolean passes a TRUE value to the Select VI the value 5 is passed to the indicator When the Boolean passes a FALSE value to the Select VI O is passed to the indicator LabVIEW Hands On Campus Workshop 70 ni com Tab Control e Keep your front panel g N myDAQ organized Z Add anew Tabs for new eas AUDIO gt operations an Plot Frequency Spectrum Only Audio Filtering e Use the Tab control to faa Fea gt select operations and Fit requencySpecium BE Tab Control perform different analyses NATIONAL INSTRUMENTS You can use tab controls to overlap front panel controls and indicators in a smaller area Place front panel objects on the pages of the tab control and use the tab as the selector to display each page
45. diagram of another VI is called a subVI You can reuse a subVI in other VIs To create a subVI you need to build a connector pane and create an icon A subVI node corresponds to a subroutine call in text based programming languages A block diagram that contains several identical subVI nodes calls the same subVI several times The subVI controls and indicators receive data from and return data to the block diagram of the calling VI Click the Select a VI icon or text on the Functions palette navigate to and double click a VI and place the VI on a block diagram to create a subVI call to that VI You can easily customize subVI input and output terminals as well as the icon Follow the instructions below to quickly create a subVI Creating SubVIs from Sections of a VI Convert a section of a VI into a subVI by using the Positioning tool to select the section of the block diagram you want to reuse and selecting Edit Create SubVI An icon for the new subVI replaces the selected section of the block diagram LabVIEW creates controls and indicators for the new subVI automatically configures the connector pane based on the number of control and indicator terminals you selected and wires the subVI to the existing wires National Instruments Corporation 49 LabVIEW Hands On Campus Workshop icon Editor and Connector Pane Icon Editor Connector Pane Why is having a good icon e Where do you find the important connector pane How can
46. dio Filtering 2 FFR m Weis x vies 1000 1500 2000 2500 3000 3500 4000 4500 5000 Frequenc y Hz stor 3 Change the title of the new tab to Audio Effects You can change the title by double clicking the title 4 This new tab contains duplicates of the four slides we already created Leave Volume 2 as is but delete the new Bass 2 Midtone 2 and Treble 2 slides 5 In place of the slides we removed place a push button This can be found at Modern Boolean Push Button Name the push button Effect Your finished front panel should look like the one shown on the next page LabVIEW Hands On Campus Workshop 86 ni com a Td Audio Equalizer End of Ex5 vi Front Panel ate Eile Edit Yiew Project Qperate Took Window Help gt a0 spt Application Font J fo Power dB 120 0 0 500 1000 1500 2000 2500 3000 3500 4000 4500 5000 Frequency Hz aiio Effects __stop Volume 2 NI myDAQ ee Al IDIO 6 Add a new case to the case structure a On the block diagram right click the border of the case structure b Select Add Case for Every Value from the right click menu This is shown below fi ji 3 Audio Equalizer vi Block Diagram ea File Edit View Project Operate Toots Window Help ea gt olnll 5 eal P oF 15pt Application Font ovi da q BI TA g i a ccc Structures Palette J Auto Grow Exclude from Diagram Cleanup
47. display output values from the program These may include data program states and other information Every front panel control or indicator has a corresponding terminal on the block diagram When you run a VI values from controls flow through the block diagram where they are used in the functions on the diagram and the results are passed into other functions or indicators through wires LabVIEW Hands On Campus Workshop 18 ni com Palettes Where can you find the following Palettes Functions Controls gt Progremming Yv gt Measurement I O gt Instrument O gt Mathematics a a S aia a a os 7 ial i a a s gt Signal Processing D SiB Bonus How many of the tools can gt User Libraries cae gt User Controls YOu n ame Select a Control NATIONAL ni com INSTRUMENTS Use the Controls palette to place controls and indicators on the front panel The Controls palette 1s available only on the front panel To view the palette select View Controls Palette You also can display the Controls palette by right clicking an open area on the front panel Tack down the Controls palette by clicking the pushpin on the top left corner of the palette Use the Functions palette to build the block diagram The Functions palette is available only on the block diagram To view the palette select View Functions Palette You also can display the Functions palette by right c
48. e Local Variables C Large Application Development e Navigator Window e LabVIEW Projects c7 NATIONAL INSTRUMENTS LabVIEW Hands On Campus Workshop 96 ni com Introduction to Clusters Data structure that groups data together Data may be of different types Analogous to struct in ANSI C Elements must be either all controls or all indicators Thought of as wires bundled into a cable Order is important NATIONAL INSTRUMENTS Clusters group like or unlike components together They are equivalent to a record in Pascal or a struct in ANSI C Cluster components may be of different data types Examples e Error information Grouping a Boolean error flag a numeric error code and an error source string to specify the exact error e User information Grouping a string indicating a user s name and an ID number specifying the user s security code All elements of a cluster must be either controls or indicators You cannot have a string control and a Boolean indicator Think of clusters as grouping individual wires data objects together into a cable cluster National Instruments Corporation 97 LabVIEW Hands On Campus Workshop Creating a Cluster 1 Select a Cluster shell 2 Place objects inside the shell Controls Modern Array Matrix amp Cluster INSTRUMENTS ni com Oinstrume Create a cluster front panel object by choosing Cluster from the Controls Modern Array Matrix amp Cluster pale
49. e a A ean 8 eet ae ttt See kcal 110 Hands On with LabVIEW Frequency Spectrum 0 I GRAPHICAL PROGRAMMING 32595001000 1500 2000 2500 3000 3500 4000 4500 5000 FOR ENGINEERS AND SCIENTISTS E LabVIEW INSTRUMENTS e NATIONAL h National Instruments Corporation 1 LabVIEW Hands On Campus Workshop Course Goals Become comfortable with the LabVIEW environment and data flow execution e Ability to use LabVIEW to solve problems LabVIEW Concepts Acquiring saving and loading data Find and use math and complex analysis functions Work with data types such as arrays and clusters Displaying and printing results NATIONAL ni com INSTRUMENTS This is a list of the objectives of the course This course prepares you to do the following e Use LabVIEW to create applications e Understand front panels block diagrams icons and connector panes e Use built in LabVIEW functions e Create and save programs in LabVIEW so you can use them as subroutines e Create applications that use plug in DAQ devices This course does not describe any of the following e Programming theory e Every built in LabVIEW function or object e Analog to digital A D theory NI does provide free reference materials on the above topics on ni com For additional questions refer to the LabVIEW Help You can access it by using the LabVIEW toolbar Help LabVIEW Hands On Campus Workshop 2 ni com a LabVIEW
50. e input x terminal of the Not function and the output not x into the selector s terminal of the Select function E 4 Audio Equalizer End of Ex5 vi Block Diagram gt File Edit View Project Operate Tools Window Help S fta P es vo y 15pt Application Font vit ctr Measurements aveform Graph Segnals Wave FFT Peak n FO e 7 Place a Merge Signals function on the block diagram from Express Signal Manipulation Wire the Select function s output terminal into both Merge Signals inputs Signal 1 and Signal 2 and the combined signal output terminal into the signal out data tunnel Your VI should look like the one on the next page National Instruments Corporation 89 LabVIEW Hands On Campus Workshop r 4 Audio Equalizer End of Ex5 vi Block Diagram File Edit View Project Operate Tools Window Help 8 Return to the front panel and run the VI Try using one of the supplied audio files Great Wide Open or Don t Worry Be Happy to see how turning the Effect button on and off changes the output signal Did the VI behave how you expected it to What is the Not function accomplishing If you wanted to eliminate the Not function how could you change the VI What is the purpose of the Merge Signals function Would the VI run normally without it End of Exercise 5 Track A LabVIEW Hands On Campus Workshop 90 ni com Exercise 5 Creat
51. e vs Samples Chart If you do not see your devices ee have not refreshed the configuration tree Ov Piug and Pla amp Remote Systems 7 Help NATIONAL ni com INSTRUMENTS The next level of software is called Measurement amp Automation Explorer MAX MAX is a software interface that gives you access to all of your National Instruments DAQ GPIB IMAQ IVI Motion VISA and VXI devices The shortcut to MAX appears on your desktop after installation A picture of the icon is shown above MAX is mainly used to configure and test your National Instruments hardware but it does offer other functionality such as checking to see if you have the latest version of NI DAQm x installed When you run an application using NI DAQm x the software reads the MAX configuration to determine the devices you have configured Therefore you must configure DAQ devices first with MAX The functionality of MAX falls into six categories e Data Neighborhood e Devices and Interfaces e IVI Instruments e Scales e Historical Data e Software This course will focus on Data Neighborhood Devices and Interfaces Software and learning about the functionality each one offers LabVIEW Hands On Campus Workshop 8 ni com Exercise 1 Configuring the myDAQ in MAX Track A Goal Familiarize yourself with Measurement amp Automation Explorer and ensure that myDAQ 1s installed and functioning properly Description Bef
52. eparate filters for the Midtone and Treble frequency ranges we can control the three ranges independently This functionality is comparable to what a sound system does when you change its settings Procedure 1 On the front panel create two more slide controls next to Bass Name the new slides Midtone and Treble Your front panel should look like the one shown below Power dB a O 0 0 500 1000 1500 2000 2500 3000 3500 4000 4500 5000 Frequency Hz 2 Add two band filters to the block diagram a On the block diagram create two more Filter functions You can quickly do this by holding down lt Ctrl gt and dragging the existing Filter down You may find it useful to rename the Filters Bass Midtone and Treble b You can change Filter settings by double clicking in the light blue area which opens the Configure Filter window For the Midtone filter change the Filtering Type to Bandpass and set the Low and High cutoff frequency Hz to 450 and 2500 respectively c The Treble filter is also a bandpass with a cutoff range from 3000 to 10000 Hz LabVIEW Hands On Campus Workshop 76 ni com 3 Separate and filter the input signal a The Sound Input Read s data terminal should be wired to the Signal inputs of all three Filters b As we did with the Bass control use Multiply functions to integrate the Midtone and Treble controls with their filters fl an I Audio Equalizer End of Ex
53. equencies our microphone is picking up and display them on our graph As the frequency changes its range the peak will shift accordingly on the frequency access LabVIEW Hands On Campus Workshop 30 ni com Exercise 2 Capturing Sound with myDAQ Track A Goal Acquire data in LabVIEW with myDAQ and present it on the user interface Part 1 Description We have a microphone connected to the audio input of the myDAQ In this exercise we re going to write a LabVIEW VI that reads the audio signal from the myDAQ and displays the Frequency Band of that signal Procedure 1 Launch LabVIEW 2 In the Getting Started window select Open Existing and navigate to Audio Equalizer Starting Point vi 3 Labview ae es File Operate Tools Help E LabVIEW D Create Project w Find Drivers and Add ons w Community and Support w Welcome to LabVIEW Connec evice expand the articipate in the discussion forums or eam to use LabVIEW ar Connect to devices and expand the Participate in Leam to use LabVIEW and upgrade functionality of LabVIEW request technica yrevious versions LabVIEW News 3 You will see that the major elements of the front panel have already been created for you There is a Waveform Graph a Stop button and a Tab Control we will add more items to the front panel in the next exercise 4 Open the block diagram by selecting Window Show Block Diagram or by pressing lt Ctrl E gt You can see the terminals that
54. erminal receives a specific Boolean value The Iteration Terminali is an output terminal that contains the number of completed iterations The iteration count for the While Loop always starts at Zero Note The While Loop always executes at least once Tunnels feed data into and out of structures The tunnel appears as a solid block on the border of the While Loop The block is the color of the data type wired to the tunnel Data passes out of a loop after the loop terminates When a tunnel passes data into a loop the loop executes only after data arrives at the tunnel In the image below the Iteration Terminal is connected to a tunnel The value in the tunnel does not get passed to the Iterations indicator until the While Loop finishes executing Only the last value of the Iteration Terminal displays in the Iterations indicator Iterations LabVIEW Hands On Campus Workshop ni com For Loop e What does the iteration terminal start counting from e How many times will a For Loop execute e7 NATIONAL ni com y INSTRUMENTS For Loops A For Loop shown above executes a subdiagram a set number of times The value in the count terminal N an input terminal indicates how many times to repeat the subdiagram The For Loop also has an Iteration Terminal It is also an output terminal that contains the number of completed iterations The iteration count for the For Loop always starts at zero National Instruments
55. h a collection of similar data and when you perform repetitive computations Arrays are ideal for storing data you collect from waveforms or data generated in loops where each iteration of a loop produces one element of the array Note Array indexes in LabVIEW are zero based The index of the first element in the array regardless of its dimension is zero Array elements are ordered An array uses an index so you can readily access any particular element The index is zero based which means it is in the range 0 to n 1 where n is the number of elements in the array National Instruments Corporation 63 LabVIEW Hands On Campus Workshop Creating an Array From the Controls Modern Array Matrix and Cluster subpalette select the Array icon 1 Place an array shell on the front panel 2 Drag a data object or element into the array shell Array Empty array shell as seen on the block diagram i 5 Nw wwunt seeessesesssssssd NATIONAL ni com INSTRUMENTS To create an array control or indicator as shown select an array on the Controls Modern Array Matrix and Cluster palette place it on the front panel and drag a control or indicator into the array shell If you attempt to drag an invalid control or indicator such as an XY graph into the array shell you are unable to drop the control or indicator in the array shell You must insert an object in the array shell before you use the array on the block diagr
56. iable filter to isolate part of the signal In this case we ll extract the bass low frequency elements and play them back Procedure 1 Add volume slides to the Audio Filtering tab of the Front Panel a On the Front Panel select the Audio Filtering tab b Right click on the Front Panel to open the Controls Palette c Navigate to Modern Numeric Vertical Pointer Slide a Place the slide in the small box in the Audio Filtering tab and name it Volume e The default scale is O to 10 but we want ours to be 0 1 Double click the 10 at the top of the slide and type a 1 The rest of the scale will update accordingly f Create a copy of the slide by pressing lt Ctrl gt and dragging the slide to the right Name the copy Bass Your front panel should resemble the one shown below TS Audio Equalizer vi Front Panel ile Edit View Project Operate Jools Window felp ol 88 15pt Application Font 207 a7 as o 60 Power dB 120 i i i i 0 0 500 1000 1500 2000 2500 3000 3500 4000 4500 5000 Frequency Hz we 1 os 0s 0A 7 stop National Instruments Corporation 53 LabVIEW Hands On Campus Workshop 2 Place a filter on the block diagram a Return to the block diagram and add a filter from Express Signal Analysis Filter b Leave the Filtering Type as the default Lowpass but change Cutoff Frequency Hz to 400 Filtering Type Lowpass Filte
57. iltering tab is selected the equalizing functions will work as we just observed If the Plot Frequency Spectrum Only tab is selected those functions will be disabled Procedure 1 Place a Case Structure on the block diagram a Select a Case Structure by navigating to Programming Structures Case Structure b We want the Case Structure to contain the filters signal addition and Volume control As with the While Loop click in the upper left corner and drag to create the Structure c The small green question mark on the left side of the Case Structure is called the case selector Wire the Tab Control terminal into the case selector The case selector should turn blue 2 The case label should change to Audio Filtering The colored boxes on either side of the Case Structure are called data tunnels The two tunnels on the right edge of case structure have white centers because they aren t wired in the other case The VI will only execute if the output value of a tunnel is defined in every case 4 Change to the Plot Frequency Spectrum Only case using the arrows at the top of the Case Structure 5 Pass the Sound Input Read data wire directly through this case to the output tunnel LabVIEW Hands On Campus Workshop 78 ni com 6 To resolve the empty orange tunnel right click on the terminal and select Create Constant Leave it as the default 0 7 3 Audio Equalizer End of Exd Track B vi Bl
58. indow select Help Show Context Help press the lt Ctrl H gt keys or press the Show Context Help Window button in the toolbar For any item on the Front Panel or Block Diagram you can display the LabVIEW help by right clicking and selecting Help The connections for the VI are displayed in Context Help There are different indicators that represent what inputs needs to be wired for the VI to work You cannot set the connection property of the outputs of a VI Required bold VI will be broken if you do not wire the required inputs Recommended normal VI can execute if you do not wire the recommended or optional terminals Optional dimmed If these inputs are not wired the VI does not generate any warnings LabVIEW Example Finder LabVIEW features hundreds of example VIs you can use and incorporate into VIs that you create In addition to the example VIs that are shipped with LabVIEW you can access hundreds of example VIs on the NI Developer Zone zone ni com You can modify an example VI to fit an application or you can copy and paste from one or more examples into a VI that you create National Instruments Corporation 27 LabVIEW Hands On Campus Workshop Commenting Your Code Double click anywhere on your front panel or block diagram to insert a comment gt Simulate Signal Sine with Uniform Noise This is the Block Diagram of my VI This is the Front Panel of my VI NATIONAL INSTRUMENTS Even within graphic
59. ing a Karaoke Setting Track B Goal Use advanced signal manipulation to remove vocal track from song Part 1 Description Now that we have a working audio equalizer what else can we do Instead of isolating a particular frequency band we can try to remove the vocal track from a song to create a karaoke setting in our program Before we can do this we ll need to modify the front panel and case structure to accommodate this new functionality Procedure 1 On the front panel select the Audio Filtering tab 2 Right click on the tab heading and select Duplicate Page This will create a new tab called Audio Filtering 2 t Tool Window Help aa ph vfont i 2o7l ca iS A el Jao Fl om V a ie amp iil Wz x3 8 o jazi EI Q Q Power dB 1000 1500 2000 2500 3000 3500 4000 4500 5000 Frequency Hz stor 3 Change the title of the new tab to Audio Effects You can change the title by double clicking on the title 4 This new tab contains duplicates of the four slides we already created Leave Volume 2 as is but delete the new Bass 2 Midtone 2 and Treble 2 slides 5 In place of the slides we removed place a push button This can be found at Modern Boolean Push Button Name the push button Effect Your finished front panel should look like the one on the next page National Instruments Corporation 91 LabVIEW Hands On Campus Workshop Power dB wi
60. ir default values 10 and 10 You should see an error does this error message make sense End of Exercise 1 Track A LabVIEW Hands On Campus Workshop 10 ni com a Exercise 1 Setting Up Your Device Track B In this exercise use the Control Panel to test your soundcard to see 1f it works Set up your computer Connect your microphone to the Audio Input on your computer If you have an audio cable and an mp3 player connect the cable from the mp3 player to the Audio Input on your computer Last connect your speakers or headphones to the Audio Output on your computer Test your Sound Card Option 1 If you have music stored on your computer play back a file Option 2 Check the default sounds on your computer to see if they playback For Windows 7 Operating System do the following 1 Navigate to the Control Panel 2 Click on the Hardware and Sound category and the Sound icon and open it 3 On the third tab Sounds select a Program Event sound and click Test Sound Playback Recording Sounds Communications A sound theme is a set of sounds applied to events in Windows and programs You can select an existing scheme or save one you have modified Sound Scheme Windows Default v Save As Delet To change sounds click a program event in the following list and then select a sound to apply You can save the changes as a new sound scheme Program Events m Windows A
61. ith schematic Wiring report for NI ELVIS 3 Multisim Simulation 13 000 part library 22 NI ELVIS virtual instruments Changes on the fly Microcontroller simulation Animated parts LEDs and 7 segment displays LabVIEW Hands On Campus Workshop 106 2 Virtual Breadboard 3 Simulate WwW NATIONAL INSTRUMENTS 4 Ultiboard PCB Layout Integrated with Multisim Flexible interface 3D view Design rule check Built in autorouting 5 NI ELVIS Test Instrumentation Data acquisition Prototyping 6 LabVIEW Compare Automatically import Multisim virtual data NIELVIS measured data Compare ideal and real data ni com Additional Resources NI LabVIEW 101 Video Instruction for Students NI Academic Web and Student Corner ni com students ni com lv101 eee ni com textbooks mee riai Get your own copy of the armele LabVIEW Student Edition 1 LabVIEW Basic Concepts Il LabVIEW Basic Tasks II Quizzes IV Additional Resources To begin you need to understand how to work within the LabVIEW environment Watch these seven video mockses to lean the core components that can help you program in NI KnowledgeBase LabVIEW Envi Date Types and Structures Leam how to navigate LabVIEW and use the block Explore the ditferert data types and methods to organize Gag en trot panel and Functions and Controis palettes and group data corfrots and incicators in Lab
62. licking an open area on the block diagram Tack down the Functions palette by clicking the pushpin on the top left corner of the palette You can view the Tools palette on both the front panel and block diagram To view the palette select View Tools Palette You also can display the Tools palette by holding shift right clicking an open area on the front panel or block diagram National Instruments Corporation 19 LabVIEW Hands On Campus Workshop f Pa If you enable the automatic selection tool and you move the cursor Over objects on the front panel or block diagram LabVIEW automatically selects the corresponding tool from the Tools palette Toggle automatic selection tool by clicking the Automatic Selection Tool button in the Tools palette Use the Operating Tool to change the values of a control or select the text within a control Use the Positioning Tool to select move or resize objects The Positioning Tool changes shape when it moves over a corner of a resizable object Use the Labeling Tool to edit text and create free labels The Labeling Tool changes to a cursor when you create free labels Use the Wiring Tool to wire objects together on the block diagram Use the Object Shortcut Menu tool to access an object shortcut menu with the left mouse button Use the Scrolling tool to scroll through windows without using scrollbars Use the Breakpoint tool to set breakpoints on VIs functions nodes wires and struc
63. me Delay Wait Until Next ms Multiple NATIONAL INSTRUMENTS Time Delay The Time Delay Express VI delays execution by a specified number of seconds Following the rules of dataflow programming the While Loop does not iterate until all tasks inside of it are complete thus delaying each iteration of the loop Wait The Wait VI waits until the specified number of milliseconds before allowing the While Loop to iterate Wait Until Next ms Multiple This function waits until the value of the millisecond timer becomes a multiple of the specified millisecond multiple to help you synchronize activities You can call this function in a loop to control the loop execution rate However it is possible that the first loop period might be short This function makes asynchronous system calls but the nodes themselves function synchronously Therefore it does not complete execution until the specified time has elapsed This function can be found at Functions Programming Timing Wait Until Next ms Multiple National Instruments Corporation 83 LabVIEW Hands On Campus Workshop File I O File I O passing data to and from files Files can be binary text or spreadsheet Write Read LabVIEW Measurements file lvm Writing to lvm file Reading from lvm file fa Write To Read From b Measurement Measurement Simulate Signal File File NATIONAL INSTRUMENTS Use LabVIEW measurement data files to save data that the Write Measureme
64. n Campus Workshop LabVIEW Functions and SubVls Operate Like Functions in Other Languages Function Pseudo Code Calling Program Pseudo Code function average inl in2 out main out inl in2 2 0 average inl in2 pointavg SubVI Block Diagram Calling VI Block Diagram NATIONAL INSTRUMENTS Modularity defines the degree to which a program is composed of discrete modules such that a change to one module has minimum impact on other modules Modules in LabVIEW are called subVIs The modular approach makes applications easier to debug and maintain A subVI node corresponds to a subroutine call in text based programming languages The node is not the subVI itself just as a subroutine call statement in a program is not the subroutine itself A block diagram that contains several identical subVI nodes calls the same subVI several times The functionality of the subVI does not matter for this example The important point is the passing of two numeric inputs and one numeric output As you create VIs you might find that you perform a certain operation frequently Consider using subVIs or loops to perform that operation repetitively LabVIEW Hands On Campus Workshop 48 ni com Create SubVI What are some ways that you can create subVIs Slope Rise Run i i ee ee ee ee NATIONAL ni com INSTRUMENTS Creating SubVIs After you build a VI you can use it in another VI A VI called from the block
65. n LabVIEW we can use a While Loop This will repeat the code contained inside until a user defined stop condition is achieved In this case we will use the Stop button on the front panel Procedure 1 Place a While Loop on the block diagram a Navigate to Programming Structures While Loop on the Functions palette b Click in the upper left corner of the block diagram and drag your mouse to the lower right corner to place the While Loop The loop should surround all the objects on the diagram c The stop sign icon in the lower right corner of the loop is the conditional terminal which is used to stop the loop Wire the Stop button terminal into the conditional terminal Your VI should look like the image on the next page LabVIEW Hands On Campus Workshop 34 ni com F T Audio Equalizer End of Ex2 vi Block Diagram File Edit View Project Operate Tools Window e gt lee 2 Return to the front panel Move your Stop button created with the While Loop to a location that makes it easy to use To do this simply click and drag the Stop button An example is shown below it gt ie 18 15pt Application Font Fox To ty G07 Power dB a c 120 i l 0 0 500 1000 1500 2000 2500 3000 3500 4000 4500 5000 Frequency Hz stoe Plot Frequency Spectrum Only Audio Filtering t NI myDAQ AUDIO IN NI myDAQ AUDIO gt OUT 4 Run the VI Did the VI perform how you expected it t
66. n the right side of the case structure 2 Separate the input signal into left and right tracks a Place a Split Signals VI on the block diagram This can be found on the Functions palette on the Express Signal Manipulation b Wire the data output from the case structure to the input of the split signal 3 Place a Subtract a Select and a Not function on the block diagram These are under Programming in Numeric Subtract Comparison Select and Boolean Not aF 4 Wire the two split signal outputs into the Subtract function s inputs x and y and the Subtract output x y into the false f terminal of the Select function 5 In addition wire the top split signal to the true t terminal of the Select function 6 Wire the Effect control terminal into the input x terminal of the Not function and the output not x into the selector s terminal of the Select function 7 Place a Merge Signals function on the block diagram from Express Signal Manipulation Wire the Select function s output terminal into both Merge Signals inputs Signal 1 and Signal 2 National Instruments Corporation 93 LabVIEW Hands On Campus Workshop 8 Convert the Dynamic Data type to a Waveform a Place down a Convert From Dynamic Data function This can be found on the Functions palette by navigating to Express Signal Manipulation b A dialog box will display Under Resulting Da
67. nal Instruments Corporation 65 LabVIEW Hands On Campus Workshop Waveform Charts Waveform chart special numeric indicator that can display a history of values Charts add 1 data point at a time with history e Chart updates with each individual point it receives e Controls Express Graph Indicators Chart Waveform Chart aveform Chart A Ni A Time Delay NATIONAL INSTRUMENTS The waveform chart is a special numeric indicator that displays one or more plots It is located on the Controls Modern Graph palette Waveform charts can display single or multiple plots Waveform Charts have the ability to update its display with every iteration of a loop This allows you to see you data as you acquire it You can change the minimum and maximum values of either the x axis or y axis axis by double clicking on the value with the labeling tool and typing the new value Similarly you can change the label of the axis You can also right click the plot legend and change the style shape and color of the trace that is displayed on the chart LabVIEW Hands On Campus Workshop 66 ni com Waveform Graphs Waveform graph special numeric indicator that displays an array of data A graph displays many data points at once Graph updates after all points have been collected May be used in a loop if VI collects buffers of data Controls Express Graph Indicators Graph i My t i Mi ii i l NATIONAL INSTRUMENT
68. nal Instruments and have no agency partnership or joint venture relationship with National Instruments Patents For patents covering National Instruments products technology refer to the appropriate location Help Patents in your software the patents txt file on your media or the National Instruments Patent Notice at ni com patents Worldwide Technical Support and Product Information ni com Worldwide Offices Visit ni com global to access the branch office Web sites which provide up to date contact information support phone numbers email addresses and current events National Instruments Corporate Headquarters 11500 North Mopac Expressway Austin Texas 78759 3504 USA Tel 512 683 0100 Contents Slides with Presenter Notes ection La VIE W Environments a a a a E 4 Setting up Your Hardware for Y our Selected Track esisiini EAN 7 Exercise 1 Configuring the myDAQ in MAX Track A ou cccccccccccccccceeeeceaaaeeeesesseeeeceeeeeseeeeeaaas 9 Exercise 1 Setting Up Your Device Track Basra scien ater ieuadleetes 11 Demonstration Creaune onr FESE Y Tones E E ln ose Cuass 17 Exercise 2 Capturing Sound with myDAQ Track A ssessssssssssssssseeerrrrssssssssssssssssecereeeesessssssssssse 31 Exercise 2 Capturing Sound with Your Sound Card Track Bo cccccsssssssseesseeeeeeeeseeeeeeeeaas 36 Section dL Flemients 0r Typical Procrai ns senene A id cesta latsadl 42 Demonstration While Loops and SubVIsS ccc
69. nment T Slide Example vi Sco File Edit View Project Operate Tools gt en TB Slide Example vi Block Diagram So File Edit View Project Operate Tools Window Numeric Slide posi lt W gt Server localhost lt mt lt W gt Server localhost lt What is the front panel What is the block diagram used for used for What are the inputs and How does data travel on the outputs called block diagram NATIONAL ni com INSTRUMENTS LabVIEW programs are called virtual instruments VIs Controls are inputs and indicators are outputs Each VI contains three main parts e Front panel How the user interacts with the VI e Block diagram The code that controls the program e Icon connector The means of connecting a VI to other VIs In LabVIEW you build a user interface by using a set of tools and objects The user interface is known as the front panel You then add code using graphical representations of functions to control the front panel objects The block diagram contains this code In some ways the block diagram resembles a flowchart You interact with the front panel when the program is running You can control the program change inputs and see data updated in real time Controls are used for inputs such as adjusting a slide control to set an alarm value turning a switch on or off or stopping a program Indicators are used as outputs Thermometers lights and other indicators
70. nt File Express VI generates The LabVIEW data file is a tab delimited text file you can open with a spreadsheet application or a text editing application In addition to the data an Express VI generates the lvm file includes information about the data such as the date and time the data was generated File I O operations pass data from memory to and from files In LabVIEW you can use File I O functions to Open and close data files Read data from and write data to files Read from and write to spreadsheet formatted files Move and rename files and directories Change file characteristics Create modify and read a configuration file Write to or read from LabVIEW measurement files In the next example examine how to write to or read from LabVIEW measurement files lvm files LabVIEW Hands On Campus Workshop 84 ni com Karaoke Stereo sound has two channels left and right Sound is recorded using two strategically placed microphones Voice is present in both channels Subtract left channel from right channel to eliminate voice NATIONAL ni com Oinstrumenrs Karaoke Entertainment where the background music of popular songs 1s played and a performer sings live usually by following the words on a video screen Who can forget the precious memories that occur when groups go out to a Karaoke bar You can learn so much about your friends such as if they have a hidden talent for singing or if they are completely and u
71. o What methods could we use to adjust the rate at which data is acquired How could we change how often the Waveform Graph is updated If we wanted to read in data from a different channel what would we do Notes e You can place the DAQ Assistant on your block diagram from the Functions palette Right click the block diagram to open the Functions palette and go to Express Input to find it When you bring up the Functions palette press the small pushpin in the upper left hand corner of the palette This tacks down the palette so that 1t doesn t disappear This step 1s omitted in the following exercises but you should repeat it End of Exercise 2 Track A National Instruments Corporation 35 LabVIEW Hands On Campus Workshop Exercise 2 Capturing Sound with your Sound Card Track B Goal Acquire sound in LabVIEW and present it on the user interface Part 1 Description We have a microphone connected to the audio input of the computer In this exercise we re going to write a LabVIEW VI that reads the audio signal from the computer and displays the Frequency Band Procedure 1 Launch LabVIEW 2 In the Getting Started window select File Open and navigate to Audio Equalizer Starting Point vi File Operate Tools Help E LabVIEW gt Create Project Find Drivers and Add ons Community and Support Welcome to LabVIEW Connect to devices and expand the Participate in the discussion forums or Leam to
72. ock Diagram 2 TAA oa Eile Edt Yiew Project Operate Tools Window Help lela aue ekol l5pt Apphcation Fort 7 Return to the front panel and run the VI How has the behavior of the VI changed Does switching tabs change the data on the graph Why doesn t any audio come out when the Plot Frequency Spectrum Only signal tab is selected End of Exercise 4 Track B National Instruments Corporation 79 LabVIEW Hands On Campus Workshop Video Mind Controlled Wheelchair YouTube Link Don t forget to submit your project to ni com studentdesign for a chance to win prizes and a trip to Austin TX NATIONAL INSTRUMENTS LabVIEW Hands On Campus Workshop 80 ni com Section IV Timing and File I O A Demonstration Timing a While Loop B Timing Loops C File I O D Hands On Exercise Adding a Karaoke Machine 7 NATIONAL ni com z W iNsTRUMENTS National Instruments Corporation 81 LabVIEW Hands On Campus Workshop Demonstration Timing a Loop Waveform Chart Waveform Chart 7 NATIONAL ni com INSTRUMENTS LabVIEW Hands On Campus Workshop 82 ni com How Do Time a Loop 1 Configure the Time Delay Express VI for seconds to wait each iteration of the loop works on For and While Loops Configure the Wait and Wait Next ms Multiple for milliseconds to wait for each iteration of the loop Numeric Slide Numeric Slide a al stop stop rs 100 Fay A Lad in E Ti
73. om 3 Types of Functions Express VIs interactive Vis with configurable dialog page blue border Comtyeet Tae Mrearmeert Tone age Tarm Mews ements Y Archnste on Signals Amplitude gt Frequenc ees geet standard Vis modularized Vis customized by wiring customizable Extract Single Tone Information vi cGy Functions fundamental operating elements of LabVIEW no front panel or block diagram yellow Multiply NATIONAL ni com INSTRUMENTS LabVIEW includes configuration based Express VIs for measurement analysis and signal processing With Express VIs you can interactively explore the various analysis algorithms while immediately seeing the results on the configuration dialog LabVIEW then generates a subVI based on these settings The complexity associated with adding analysis and signal processing algorithms into your measurement and automation applications is significantly reduced by using Express VIs SubVIs are VIs consisting of a front panel and a block diagram that are used within another VI When you double click a subVI on the block diagram its front panel window appears Functions are the fundamental operating elements of LabVIEW Functions do not have front panel windows or block diagrams windows but do have connector panes Double clicking a function only selects the function A function has a pale yellow background on its icon National Instruments Corporation 47 LabVIEW Hands O
74. ore we can use the myDAQ in a LabVIEW program we need to verify that it has been installed correctly and is working normally This is done using the Measurement amp Automation Explorer MAX In MAX we will verify that the myDAQ appears with the correct Device Name and open a Test Panel to ensure that signals can be read successfully Procedure 1 Setup your myDAQ a Connect your headphones speakers to the Audio Out terminal Connect your microphone to Audio In terminal OR c If you have an mp3 player connect the audio cable from your mp3 or phone to the Audio In terminal 2 Launch Measurement amp Automation Explorer MAX from Start All Programs National Instruments Measurement amp Automation 3 Under My System expand the entry for Devices and Interfaces 4 If the myDAQ has been installed you should see an entry for NI myDAQ on the list as shown below in the left image X NI myDAQ Dev2 Measurement amp Automation Explorer X NI myDAQ myDAQ Measurement amp Automation Explorer File Edit View Tools Help a amp My System E Data Neighborhood 4 gA Devices and Interfaces i MIPCI 6251 Dev1 i NI myDAG myDAQ a Network Devices gt PXI PXI System Unidentified IF Serial amp Parallel Historical Data File Edit View Tools Help F gy My System E Data Neighborhood ae Devices and Interfaces gA NIPCT 6251 Dewl gA N myDAQ Dev a Network Devices gt PXI P
75. p Filter Passes all frequencies except those specified by a specified range as seen in the 3 figure to the right Frequency Gaini In our project we are building an audio equalizer In order to isolate the frequencies to manipulate the way our input sounds we will need to build a filter for each of the three frequency ranges we have defined National Instruments Corporation 51 LabVIEW Hands On Campus Workshop Outputting signal to DAQ Send a signal from the computer to your data acquisition device or sound card In our case we are modifying the audio input and sending the signal to our speakers NATIONAL ni com INSTRUMENTS Analog output allows us to send a continuous signal that varies within a specified range from our data acquisition card to a sensor or another application if applicable In our case we are sending our modified audio signal to the speakers or headphones so we can hear the changes that our filter 1s implementing LabVIEW Hands On Campus Workshop 52 ni com Exercise 3 Outputting Sound Track A Goal Apply a variable filter to alter the incoming data and output the modified signal from myDAQ Description We can do more than just acquire and analyze a signal in LabVIEW In this exercise we will use the audio output of the myDAQ to play the signal on speakers or headphones There s no fun in outputting the exact same signal that we read in so we ll apply a var
76. r Specifications utoff Frequency Hz a A Seal R Lee Fees eel Peet i mm View Mode Signals Show as spectrum Transfer function 3 Configure Filter Fitter 3 Create a second DAQ Assistant to output the filtered signal a Create a DAQ Assistant from Express Output DAQ Assistant and place it above the Spectral Measurements b Navigate to Generate Signals Analog Output Voltage and select the audioOutputLeft and audioOutputRight physical channels under the myDAQ listing c Change the Signal Output Range Max and Min to 2 and 2 Volts for both channels Make sure to do this for both channels d Under Timing Settings change the Generation Mode to Continuous Samples and set the Samples to Write to 200 The configuration window should match the one below Channel Settings e Gs eE Voltage Output Setup Settings Details gt gt VoltageOut_O VoltageOQut_i Signal Output Range Max Min 2 Scaled Units Volts v Terminal Configuration lt Let NI DAQ Choose gt Cok the Add Channels button CH to add more Haannes to Re task Custom Scaling lt No Scale gt Timing Settings Generation Mode eS Samples to Write Rate Hz Continuous Samples l fw DAQ Assistant xs mo aj o gt Run Add Channels Remowe Channels Hide Help Back r Sine Wave Test Signal Type BS 2 Gene
77. rating Current Er 1 or Voltage F o You can generate p s main kinds of signals for 1 channels H i H L 4 i e Single samples o 0 02 0 04 0 06 0 08 0 1 0 12 0 14 0 16 0 18 0 2 ncluding DC signals Time When generat single samples you can use so 7 ardv re timin i Configuration Triggering Advanced Timing available to control when your device generates a signal e Multiple samples steps 1 Your application 2 All the samples aS This graph displays the analog signals acquired or generated by the device LabVIEW Hands On Campus Workshop 54 4 Place two Multiply functions on the block diagram These can be found on the Functions palette at Programming Numeric Multiply le LO cremen Jecreme Compo n r x 3 tc gt bP bP gt BP Fz Synchronizat Absolute Val Round iToN Round Towa Round Towa Scale By Pow Complex b gt gt gt gt gt Desktop Exec Square Root Square Negate Reciprocal gn Scaling Measuremen EJ amp Ga LY Instrument LO Express Numeric Co Enum Const Ring Constant Random Nu Expression N Fixed Point r Addons o nr DBL Numer Int Inf Machine Eps Math Consta wanes 5 Re wire the block diagram to include the new functions a Wire the data terminal of the first DAQ Assistant analog input to the Signal input of the filter b Wire the Filtered Signal output and the Bass control into a Multiply function c The
78. ration machine vision RF communications and more Present After you acquire and perform analysis on your data you likely need to present your data Data presentation encompasses data visualization report generation data storage Web publishing database connectivity data management and more The LabVIEW graphical development environment includes hundreds of built in functions and tools for data presentation LabVIEW Hands On Campus Workshop 14 ni com Types of Signals to Acquire Digital e Signal that varies continuously Electrical signals that transfer Most commonly a voltage or digital data current Usually represented by on off In our case sound going into the high low 0 1 microphone is converted to a voltage icom POMONA rs An analog signal can be at any voltage level with respect to time You can measure the level shape and frequency of an analog signal 4 71 Volts Level Frequency Level Measuring the level of an analog signal can be at any voltage state Shape Because analog signals can be at any state with respect to time the shape of the signal is often important For instance a sine wave has a different shape than a sawtooth wave Measuring the shape of a signal opens the door to further analysis on the signal itself such as peak values slope integration etc Frequency You cannot directly measure the frequency of an analog signal Software analysis of the signal is required to ex
79. rray can have one or more dimensions and as many as 2 1 elements per dimension memory permitting e Cluster Clusters group data elements of mixed types such as a bundle of wires in a telephone cable where each wire in the cable represents a different element of the cluster The LabVIEW User Manual on ni com provides additional references for data types found in LabVIEW National Instruments Corporation 21 LabVIEW Hands On Campus Workshop Toolbar What do the following buttons do Bie NATIONAL ni com INSTRUMENTS Run While the VI runs the Run button appears with a black arrow if the VI is a top level VI meaning it has no callers and therefore is not a subVI Y Continuous Run Run the VI until you abort or pause it You ele also can click the button again to disable continuous running While the VI runs the Abort Execution button appears Click this button to stop the VI immediately Note Avoid using the Abort Execution button to stop a VI The Abort Execution button stops the VI immediately before the VI finishes the current iteration Aborting a VI that uses external resources such as external hardware might leave the resources in an unknown state by not resetting or releasing them properly Design VIs with a stop button to avoid this problem Click the Pause button to pause a running VI When you click the Pause button LabVIEW highlights on the block diagram the T location where you
80. rs are looking for LabVIEW expertise when they evaluate job candidates The LabVIEW Certification Program is built on a series of professional exams LabVIEW certifications are used to validate LabVIEW expertise and skills for employment opportunities and for project bids The Certified LabVIEW Associate Developer is the first step for LabVIEW certification and it demonstrates a strong foundation in using LabVIEW and the LabVIEW environment As a student your Certified LabVIEW Associate Developer certification differentiates your LabVIEW skills for employment opportunities and helps potential employers recognize your LabVIEW expertise The CLAD is a one hour multiple choice exam conducted at Pearson VUE testing centers around the country The exam covers multiple topics on the LabVIEW environment including dataflow concepts programming structures advanced file I O techniques modular programming practices VI object properties and control references Thinking about getting your CLAD certification Take the free online LabVIEW Fundamentals Exam as a sample test The Certified LabVIEW Developer and Architect professional certifications validate advanced LabVIEW knowledge and application development experience Additionally the Architect certification also demonstrates skills in leading project teams and large application development experience These four hour practical exams are conducted by National Instruments The NI LabVIEW Academy provides
81. sterisl Close Program Critical Battery Alarm Critical Stop Default Beep T J n v Play Windows Startup sound iNone P Test cancel 4 You should be able to hear a sound End of Exercise 1 Track B National Instruments Corporation 11 LabVIEW Hands On Campus Workshop What is an Audio Equalizer It s acar stereo e Audio Equalizers adjust the volume of a certain frequency within a signal We are going to build a 3 band Audio Equalizer using filters that affects these frequency ranges Bass Midtones Treble NATIONAL ni com INSTRUMENTS When was the last time you were in your car listening to the radio and then all of a sudden you started hearing a thumping sound because someone had the bass of their music maxed out Music is composed of different pitches or frequencies and by increasing or decreasing the strength of certain pitches you are manipulating the volume of the pitches This is what we call an audio equalizer In our application we will be building an audio equalizer that boosts or cuts bass midtone and treble frequencies LabVIEW Hands On Campus Workshop 12 ni com Let s Explore the Final Project Open up the myDAQ Audio Demo vi and play around with it Be sure you have your microphone or MP3 player plugged in along with the speakers F DAD Anode Dorme e bee je Poe u Dpenate ja Wied th l DH e Frequency Spectrum 0 60
82. t Shift Tab gt to turn the Automatic Selection Tool back on In the Tools Options dialog there are many configurable options for customizing your front panel block diagram colors printing and so on Similar to the LabVIEW options you can configure VI specific properties by going to File VI Properties There you can document the VI change the appearance of the window and customize it in several other ways In the block diagram right click on terminals and select Create Control Constant Indicator to make a control constant or indicator for the block diagram National Instruments Corporation 29 LabVIEW Hands On Campus Workshop Peak Detection e Convert Time domain signals to Frequency domain signals Analyze all frequency components to find the dominant frequency In this exercise We acquire a sound signal Perform spectral analysis to detect peak frequency Display on graph Frequency NATIONAL INSTRUMENTS A time domain graph shows how a signal changes over time The data we acquire from our myDAQ 1s plotted versus time However since sound is a series of frequencies between the range of 20 to 20 000 Hz displaying the data on an axis relating to frequencies will help us to visualize and analyze the information In our exercise we will use a Spectral Measurements Express VI to convert the Time domain signal to the Frequency Domain To measure the peak the VI will analyze all of the fr
83. t a Case Structure to allow the user to turn equalizer on or off Part 1 Description We can add to the existing code in our program to make an audio equalizer that functions like your car stereo In order to do this we ll need to isolate more than just the Bass If we create separate filters for the Midtone and Treble frequency ranges we can control the three ranges independently This functionality is comparable to what a sound system does when you change its settings Procedure 1 On the front panel create two more slide controls next to Bass Name the new slides Midtone and Treble Your front panel should look like the one shown below Power dB a O 0 0 500 1000 1500 2000 2500 3000 3500 4000 4500 5000 Frequency Hz 2 Add two band filters to the block diagram a On the block diagram create two more Filter functions You can quickly do this by holding down lt Ctrl gt and dragging the existing Filter down You may find it useful to rename the Filters Bass Midtone and Treble b You can change Filter settings by double clicking in the light blue area which opens the Configure Filter window For the Midtone filter change the Filtering Type to Bandpass and set the Low and High cutoff frequency Hz to 450 and 2500 respectively c The Treble filter is also a Bandpass with a cutoff range from 3000 to 10000 Hz LabVIEW Hands On Campus Workshop 72 ni com 3 Separate and fil
84. ta Type select 1D Array of Waveform and then click Okay 3 Configure Convert from Dynamic Data Convert from Dynamic Data ome Input Signal c Wire the output of the Merge Signals VI to the input of the Convert From Dynamic Data Type 9 Wire the output terminal into the signal out data tunnel of the case Structure 5 B Audio Equalizer End of Ex5 Track 8 vi Block Diagram r Ple Edit View Project Operate Tools Window Help gt a n ojeg bol 1Spt Application Font om 10 Return to the front panel and run the VI Try using one of the supplied audio files Great Wide Open or Don t Worry Be Happy to see how turning the Effect button on and off changes the output signal Did the VI behave how you expected it to What is the Not function accomplishing If you wanted to eliminate the Not function how could you change the VI What is the purpose of the Merge Signals function Would the VI run normally without it End of Exercise 5 Track B LabVIEW Hands On Campus Workshop 94 ni com Video myDAQ Optical Theramin YouTube Link Don t forget to submit your project to ni com studentdesign for a chance to win prizes and a trip to Austin TX NATIONAL INSTRUMENTS National Instruments Corporation 95 LabVIEW Hands On Campus Workshop Section V Advanced Data Flow Topics Optional A Additional Data Types e Cluster B Data flow Constructs Shift Register
85. tem Design Achievement Awards dinner 1 500 in cash prizes awarded to first second and third place winners of the popular vote You can submit your projects at NILCOM STUDENTDESIGN LabVIEW Hands On Campus Workshop 40 ni com Video Blind Driver Challenge YouTube Link Part 1 YouTube Link Part 2 Don t forget to submit your project to ni com studentdesign for a chance to win prizes and a trip to Austin TX NATIONAL ni com INSTRUMENTS National Instruments Corporation 41 LabVIEW Hands On Campus Workshop Section Il Elements of Typical Programs A Demonstration While Loops and SubVI B Loops e While Loop e For Loop B Functions and SubVIs e Types of Functions e Creating Custom Functions subVI C Hands On Exercise Filtering and Outputting Sound c7 NATIONAL INSTRUMENTS LabVIEW Hands On Campus Workshop 42 ni com Demonstration While Loop and SubVls Dataflow and Loops subVIs Area of a Triangle Area of a Triangle 7 NATIONAL ni com INSTRUMENTS National Instruments Corporation 43 LabVIEW Hands On Campus Workshop While Loop e What do the following terminals do i e How many times must a While Loop run NATIONAL ni com INSTRUMENTS While Loops Similar to a do loop or a repeat until loop in text based programming languages a While Loop executes a subdiagram until a condition is met The While Loop executes the subdiagram until the Conditional Terminal an input t
86. ter the input signal a The DAQ Assistant s data terminal should be wired to the Signal inputs of all three Filters b As we did with the Bass control use Multiply functions to integrate the Midtone and Treble controls with their Filters F 3 Audio Equalizer End of Ex4 vi Block Diagram ols File Edit View Project Operate Tools Window Help Spectral Measurements Segnals 4 Recombine the three filtered signals a Place two Add functions on the block diagram from Programming Numeric Add b Use one Add function to combine the multiplied Midtone and Treble outputs and use the second Add to combine that sum with the Bass output c This new sum should be wired to the Spectral Measurements and the second DAQ Assistant multiplier E 3 Audio Equalizer End of Ex4 vi Block Diagram orps m Filter Midtone 5 Return to the front panel and run the VI National Instruments Corporation 73 LabVIEW Hands On Campus Workshop Try listening to yourself or music through the audio equalizer Do the results match what you expected If you turn all three equalizer slides up does the output signal match the original input signal Part 2 Description We now have a working audio equalizer but a key question has been overlooked What if the user wants to turn off the equalizing functions and analyze the original input signal We need to modify
87. that a node executes only when data are available at all of its input terminals and it supplies data to its output terminals only when it finishes execution In the second piece of code the Simulate Signal Express VI receives input from the controls and passes its result to the graph You may consider the add multiply and the simulate signal code to coexist on the same block diagram in parallel This means that they begin executing at the same time and run independently of one another If the computer running this code had multiple processors these two pieces of code could run independently of one another each on its own processor without any additional coding National Instruments Corporation 25 LabVIEW Hands On Campus Workshop Debugging Techniques How do you use the following debugging tools e Broken Run Arrow e Execution Highlighting Error List g Error list Are there other debugging tools you can think of NATIONAL INSTRUMENTS When your VI is not executable a broken arrow is displayed in the Run button in the palette Use our debugging tools to find your problem and correct it e Finding Errors To list errors click on the broken arrow To locate the source of the error click on the error message e Execution Highlighting Animates the diagram and traces the flow of the data allowing you to view intermediate values Click on the light bulb on the toolbar e Probe The Probe Watch Window shows
88. the Sound Input Configure and Sound Input Clear VIs are in the dotted outline c The stop sign icon in the lower right corner of the loop 1s the conditional terminal which is used to stop the loop Wire the Stop button terminal into the conditional terminal r T Audio Equalizer End of Ex2 Track 8 vi Block Diagram cee SIGH File Edit View Project Operate Tools Help gt a u ts ka a Spt Application Font 2 Return to the front panel and run the VI Did the VI perform how you expected it to What methods could we use to adjust the rate at which data is acquired How could we change how often the Waveform Graph is updated If we wanted to read in data from a different channel what would we do End of Exercise 2 Track B National Instruments Corporation 39 LabVIEW Hands On Campus Workshop STUDENT DESIGN eee COMPETITION INSTRUMENTS ni com y NATIONAL Show us how you re incorporating LabVIEW software into your design project for a chance to win cash prizes and trips to NIWeek in Austin Texas From inexpensive medical devices to complex underwater autonomous vehicles we want to see how students like you are engineering a better world using the LabVIEW graphical development environment Two members from each of the top four selected projects will be flown to Austin Texas to attend NIWeek One of those projects will win 2 000 USD and be recognized at the Graphical Sys
89. to assign inputs and outputs To assign a terminal to a front panel control or indicator click a terminal of the connector pane then click the front panel control or indicator you want to assign to that terminal The terminal changes to the data type color of the control to indicate that you connected the terminal You can also select the control or indicator first and then select the terminal LabVIEW Hands On Campus Workshop 50 ni com Analysis Filters Allows some frequencies of a signal to pass more easily than others e We will be using three types of filters in our project Lowpass Bass Filter Bandpass Midtone Filter Highpass Treble Filter NATIONAL ni com INSTRUMENTS A filter removes an unwanted component or feature Often times you will use a filter to remove certain frequencies such as 60 Hz noise while not altering the original frequencies There are many different filters available for us to use Lowpass Filter Passes all frequencies below a specified value while attenuating higher frequency values The top image in the slide shows a lowpass filter Highpass Filter Passes all frequencies above a specified value while attenuating lower frequency values The middle image in the slide shows a highpass filter Bandpass Filter Passes frequencies within a specified range and rejects frequencies outside of that range The last image in the slide shows a bandpass filter Band stop Bandsto
90. tract the frequency information The analysis is usually done by an algorithm called a Fourier Transform National Instruments Corporation 15 LabVIEW Hands On Campus Workshop A digital signal has only two possible states ON high logic or OFF low logic An example of a digital signal is a TTL Transistor to Transistor Logic signal The specifications for a TTL signal state that a voltage level between 0 0 8 Volts it is considered low logic and a voltage level between 2 5 Volts is considered high logic Most digital devices in industry accept a TTL compatible signal Since a digital signal only has two states we can only measure two quan of a disital sional state TY an int UU FFER EGF EPERE 0 2 bs s Rate State A digital signal only has two possible states ON or OFF Thus one of the quantities of a digital signal we can measure is whether the state is ON or OFF Rate A digital signal also changes state with respect to time Therefore the other quantity of a digital signal we can measure is the rate or in other words how the digital signal changes states with respect to time LabVIEW Hands On Campus Workshop 16 ni com Demonstration Creating our First VI Front Panel Window Bb Demo My First VLvi Front Panel S File Edit View Project Operate Tools Window ASOITA Graph Wavefoen Chat voltage 0 BM Indicator 0 04 Block Diagram
91. ts text box or click the 2D Cartesian Coordinate Shift vi NI_AALPro Ivlib 1 3D ANOVAS NILAAL Fro belik block diagram O front panel to attach 3D Cartesian Coordinate Rotation Direction vi LAAL Pro belik 7 the object to the cursor Then click the location on the block diagram or front panel where you want to add the object LabVIEW Hands On Campus Workshop 24 ni com Dataflow Which VI s will execute first Which VI will execute last _ Signals Average Value Arithmetic Mean p mmmn DE berror in no error f 4 javeform Grap i NATIONAL ni com INSTRUMENTS LabVIEW follows a dataflow model for running VIs A block diagram node executes when all its inputs are available When a node completes execution it supplies data to its output terminals and passes the output data to the next node in the dataflow path Visual Basic C JAVA and most other text based programming languages follow a control flow model of program execution In control flow the sequential order of program elements determines the execution order of a program Consider the first block diagram above It adds two numbers and then multiplies by 2 from the result of the addition In this case the block diagram executes from left to right not because the objects are placed in that order but because one of the inputs of the Multiply function is not valid until the Add function has finished executing and passed the data to the Multiply function Remember
92. tte e This option gives you a shell similar to the array shell when creating arrays e You can size the cluster shell when you drop it e Right click inside the shell and add objects of any type Note You can even have a cluster inside of a cluster The cluster becomes a control or an indicator cluster based on the first object you place inside the cluster You can also create a cluster constant on the block diagram by choosing Cluster Constant from the Cluster palette e This gives you an empty cluster shell e You can size the cluster when you drop it e Put other constants inside the shell Note You cannot place terminals for front panel objects in a cluster constant on the block diagram nor can you place special constants like the Tab or Empty String constant within a block diagram cluster shell LabVIEW Hands On Campus Workshop 98 ni com Cluster Functions In the Cluster amp Variant subpalette of the Programming palette e Can also be accessed by right clicking the cluster terminal component 0a uster component 1 y Terminal labels reflect data type Bundle Deen NUL cluster new component owned label ala output cluster new component B owned label B T p Bundle By Name NATIONAL ni com INSTRUMENTS The terms bundle and cluster are closely related in LabVIEW Example You use a bundle function to create a cluster You use an unbundle function to extract the parts of a cluster
93. tterly tone deaf Stereo sound is composed of two or more audio channels so that it appears as if the sound is coming in from multiple directions To create this effect an audio engineer may position microphones in different locations in the recording studio to put an emphasis on different sounds When the audio is played back you hear sounds from each channel This is often the case for capturing a singer s voice and the accompanying instrumentation To create a Karaoke effect in our project we will use our myDAQ s AudioInputLeft and AudioInputRight and subtract the Left Input from the Right Input to simulate a Karaoke effect This process will reduce or remove some of the audio and mimic the functionality of a Karaoke machine National Instruments Corporation 85 LabVIEW Hands On Campus Workshop Exercise 5 Creating a Karaoke Setting Track A Goal Use advanced signal manipulation to remove vocal track from song Part 1 Description Now that we have a working audio equalizer what else can we do Instead of isolating a particular frequency band we can try to remove the vocal track from a song to create a karaoke setting in our program Before we can do this we ll need to modify the front panel and case structure to accommodate this new functionality Procedure 1 On the front panel select the Audio Filtering tab 2 Right click on the tab heading and select Duplicate Page This will create a new tab called Au
94. tures to pause execution at that location Use the Probe tool to create probes on wires on the block diagram Use the Probe tool to check intermediate values in a VI that produces questionable or unexpected results Use the Color Copy tool to copy colors for pasting with the Coloring tool Use the Coloring tool to color an object The Coloring tool also displays the current foreground and background color settings LabVIEW Hands On Campus Workshop 20 ni com Data Types What are the following data types NATIONAL ni com INSTRUMENTS Controls and indicators are front panel items that you can use to interact with your program to provide input and display results You can access controls and indicators by right clicking the front panel LabVIEW uses many common data types such as Boolean numeric integers strings clusters arrays and so on The color and symbol of each terminal indicate the data type of the control or indicator Control terminals have a thicker border than indicator terminals Also arrows appear on front panel terminals to indicate whether the terminal is a control or an indicator An arrow appears on the right if the terminal is a control and on the left if the terminal is an indicator Definitions e Array Arrays group data elements of the same type An array consists of elements and dimensions Elements are the data that make up the array A dimension is the length height or depth of an array An a
95. ulation Low cost student editions available ni com multisim NATIONAL ni com INSTRUMENTS Multisim software integrates powerful SPICE simulation and schematic capture entry into a highly intuitive electronics lab on the PC As the only company to design products specifically for the education market National Instruments provides software that has become a teaching and learning tool of choice for thousands of educators Multisim Simulation and Capture Multisim is an intuitive drag and drop schematic capture and simulation program that educators and students can use to quickly create complete circuits containing both analog and digital components Multisim also adds microcontroller unit cosimulation capabilities so you can include an MCU programmed in assembly code within your SPICE modeled circuit Ultiboard PCB Layout With Ultiboard students can gain exposure to the physical implementation and manufacturing of circuits on PCBs Students can import the Multisim schematic into Ultiboard with a single mouse click National Instruments Corporation 105 LabVIEW Hands On Campus Workshop Multisim Integrated with LabVIEW 1 Multisim Schematics 2 Multisim Virtual Breadboard 1 Create Schematic step 5 ls e se e ou G b paa o anman ni com Easy to use schematics Simple click and drag 3D animated parts Wire drag without breaking connections Breadboarding techniques Synchronized w
96. wer Supply 5 V 15 V ti sluice 3 5 mm stereo audio jacks f Audio IN OUT ELVISmx Software Instruments E E E F aee Integrated DMM NATIONAL ni com INSTRUMENTS NI myDAQ is a low cost portable data acquisition DAQ device that uses NI LabVIEW based software instruments allowing students to measure and analyze real world signals NI myDAQ 1s ideal for exploring electronics and taking sensor measurements Combined with NI LabVIEW on the PC students can analyze and process acquired signals and control simple processes anytime anywhere NI myDAQ provides analog input AI analog output AO digital input and output DIO audio power supplies and digital multimeter DMM functions in a compact USB device Specifications include e Two differential analog input and analog output channels 200 ks s 16 bit 10 V e Eight digital input and digital output lines 3 3 V TTL compatible e 5 15 and 15 V power supply outputs up to 500 mW of power e 60 Volt digital multimeter DMM for measuring voltage current and resistance LabVIEW Hands On Campus Workshop 6 ni com Setting Up Your Hardware for Your Selected Track Track A NI Data Acquisition with Microphone NI myDAQ Microphone and speakers Suggested Hardware aty Description JSuppier NI myDAQ National Instruments Set of speakers or headphones a MP3 Player optional The following schematic was drawn with NI Multisim a widely used SPICE s
97. wired into it An input of 0 would result in an output of 5 for the first iteration 10 for the second iteration and 15 for the third iteration Said another way you use shift registers to retain values from one iteration to the next They are valuable for many applications that have memory or feedback between states The feedback node pictured below is another representation of the same concept Both programs pictured behave the same Feedback Node National Instruments Corporation 101 LabVIEW Hands On Campus Workshop Local Variables Local variables allow data to be passed between parallel loops You can read or write a single control or indicator from more than one location in the program Local variables break the dataflow paradigm and should be used sparingly i ar Find Control Hide Control Change to Indicator Change to Constant View As Icon l Properties INSTRUMENTS y NATIONAL Sometimes you may need to access a front panel object from more than one place on the block diagram or to pass data between structures that you cannot connect by a wire To accomplish these tasks you would use a local variable Local variables are located on the Functions palette under Programming Structures You use a local variable by first selecting the object you want to access You can either click on the local variable with the Operating tool and select the object you want to access or right click on the local
98. you can use to change the look or behavior of the objects Right click an object and select Properties from the shortcut menu to access the property dialog box With properties you can set or read such characteristics as foreground and background color data formatting and precision visibility descriptive text size and location on the front panel and so on You can select multiple objects on the front panel or the block diagram and edit any properties the objects share To select multiple objects use the Positioning tool to drag a selection rectangle around all of the objects you want to edit or hold down the lt Shift gt key while clicking each object LabVIEW Hands On Campus Workshop 68 ni com Demonstration Case Structures Random Number 7 NATIONAL ni com y INSTRUMENTS National Instruments Corporation 69 LabVIEW Hands On Campus Workshop How Do Make Decisions in LabVIEW 1 Case Structures iFalse vp Boolean Control E 2 Select NATIONAL ni com INSTRUMENTS Case Structure The case structure has one or more subdiagrams or cases one of which executes when the structure executes The value wired to the selector terminal determines which case to execute and can be Boolean string integer or enumerated type Right click the structure border to add or delete cases Use the Labeling tool to enter value s in the case selector label and configure the value s handled by each case It is found at Fun
99. you edit the icon of How do you add inputs or your subVI outputs to the connector pane NATIONAL INSTRUMENTS After you build a VI front panel and block diagram modify the icon and the connector pane so you can use the VI as a subVI Every VI displays an icon in the upper right corner of the front panel and block diagram windows A Vl icon is a graphical representation of a VI that can contain text images or a combination of both If you use a VI as a subVI the icon identifies the subVI on the block diagram of the VI You can double click the icon in the front panel window or block diagram window to customize or edit it You can also right click on the icon and select Edit Icon to launch the Icon Editor dialog box To use a VI as a subVI you also need to build a connector pane The connector pane defines the inputs and outputs you can wire to the VI so you can use it as a subVI Define connections by assigning a front panel control or indicator to each of the connector pane terminals To define a connector pane right click the icon in the upper right corner of the front panel and select Show Connector from the shortcut menu to display the connector pane When you view the connector pane for the first time you see a connector pattern You can select a different pattern by right clicking the connector pane and selecting Patterns from the shortcut menu Each rectangle on the connector pane represents a terminal Use the rectangles

Download Pdf Manuals

image

Related Search

Related Contents

Un nouveau questionnaire, compatible avec la DSM  MANUEL D`INSTALLATION  HP L6010 10.4-inch Retail Monitor (head only)  Mise en page 1 - GS1 Belgium & Luxembourg  8540 DC Load User Manual  SW205 INSTRUCTIVO - Telecomunicaciones Capaga  Les poux - brochure  ¡Disfrutemos con DUO!  Power Acoustik OV2- User's Manual  Tristel DUO pour Sondes Ultrasons  

Copyright © All rights reserved.
Failed to retrieve file