DOC PREVIEW
PSU EE 200 - Lab_6_EE200_f13

This preview shows page 1-2-3-4-5-38-39-40-41-42-43-76-77-78-79-80 out of 80 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 80 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 80 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 80 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 80 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 80 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 80 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 80 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 80 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 80 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 80 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 80 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 80 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 80 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 80 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 80 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 80 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 80 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

ColorGrayscaleEE 200 Fall 2013Lab 6.EE 200Design ToolsLaboratory 6Professor Jeffrey SchianoDepartment of Electrical Engineering1EE 200 Fall 2013Lab 6.Laboratory 6 Topics• LabVIEW Programming– While Loop - Tunnels – For Loop– Coercion Dots and Numeric Conversion– Debugging Techniques• Multisim2EE 200 Fall 2013Lab 6.While Loops – Tunnels• Tunnels transfer data into and out of structures• The tunnel adopts the color of the data type wired to the tunnel• When a tunnel passes data into a loop, the loop executes only after data arrive at the tunnel• When a tunnel passes data out of a loop, the data is available after the loop completes execution3EE 200 Fall 2013Lab 6.Exercise 1• Construct the following VI• Execute using the Run button• When does the iterations indicator update?4EE 200 Fall 2013Lab 6.LabVIEW For Loop5codeLabVIEW For Loopint i;for (i = 0; i < 100; i++){ code }C CodeFlowchartYesNoi<N?i = 0codeendi = i + 1EE 200 Fall 2013Lab 6.For Loops• Create a For Loop the same way you create a While Loop• If you need to replace an existing While Loop with a For Loop, right-click the border of the While Loop, and select Replace with For Loop from the shortcut menu• The value in the count terminal (an input terminal) indicates how many times to repeat the subdiagram• The iteration terminal provides the current loop iteration count, which ranges from 0 to N - 16EE 200 Fall 2013Lab 6.For Loops – Conditional Terminal• You can add a conditional terminal to configure a For Loop to stop when a Boolean condition or an error occurs7EE 200 Fall 2013Lab 6.For Loops – Conditional Terminal• For Loops configured for a conditional exit have– Red glyph next to the count terminal – Conditional terminal in the lower right corner8EE 200 Fall 2013Lab 6.For Loop/While Loop Comparison9CodeLabVIEW While LoopCodeLabVIEW For Loop• Executes a set number of times unless a conditional terminal is added• Can execute zero times• Stops executing only if the value at the conditional terminal meets the condition• Must execute at least onceEE 200 Fall 2013Lab 6.For Loops – Numeric Conversion• The number of iterations a For Loop executes must be specified in nonnegative integers• If the number of iterations is a negative integer or zero, the For Loop does not execute• If you wire a double-precision, floating-point numeric value to the count terminal, LabVIEW converts the larger numeric value to a 32-bit signed integer10EE 200 Fall 2013Lab 6.Coercion Dots• Typically, when you wire different representation types to the inputs of a function, the function returns an output in the larger or wider format• LabVIEW chooses the representation that uses more bits• However, the For Loop count terminal always coerces to a 32-bit signed integer11EE 200 Fall 2013Lab 6.Numeric Conversion• Avoid coercion for better performance– Choose matching data type– Programmatically convert to the matching data type12EE 200 Fall 2013Lab 6.LabVIEW Loops: Tunnel Mode• The For Loop and While Loop can automatically index and accumulate arrays at their boundaries –one new element for each iteration• Auto indexing is enabled by default on For Loops, but disabled on While Loops• Lab 7 covers LabVIEW arrays and auto-indexing13auto-indextunneltunnelEE 200 Fall 2013Lab 6.Altering Tunnel Mode• Change the tunnel mode by right-clicking on the tunnel14scalarEE 200 Fall 2013Lab 6.Exercise 2• Construct the following VI• What is the expected indicator behavior?• Select Highlight Execution (what happens if you do not ?)• Execute using the Run button15EE 200 Fall 2013Lab 6.LabVIEW: Debugging Techniques• Suppose that a VI generates unexpected data or behavior– Any unwired or hidden subVIs?– Incorrect default data being used?– Undefined data being passed?– Numeric representation correct?– Node execution order correct?16EE 200 Fall 2013Lab 6.Debugging Techniques –Execution Highlighting• Use execution highlighting to watch the data flow through the block diagram• If the VI runs more slowly than expected, confirm that you turned off execution highlighting in subVIs17EE 200 Fall 2013Lab 6.Debugging Techniques – Probes• Use the Probe tool to observe intermediate data values and to check the error output of VIs • Retain the values in the wires so that you can probe wires for data after execution18EE 200 Fall 2013Lab 6.Debugging Techniques –Single Stepping• Single-step through the VI to view each action of the VI on the block diagram• Start single-stepping by– Click one of the single-step buttons– Pause a VI using a breakpoint– Click the Pause Button19EE 200 Fall 2013Lab 6.Debugging Techniques –Block Diagram Toolbar• Pause Button– Toggles the program between pause and execution• Step Into Button– Execute 1ststep of the subVI or structure, then pauses • Step Over Button– Execute the subVI or structure, then pauses• Step Out Button– Finish executing current subVI or structure, then pauses20EE 200 Fall 2013Lab 6.Debugging Techniques –Suspending Operation• Suspend the execution of a subVI to edit values of controls and indicators, to control the number of times it runs, or to go back to the beginning of the execution of the subVI– Open the subVI and select Operate » Suspend When Calledfrom the shortcut menu– A VI can be suspended and paused at the same time21EE 200 Fall 2013Lab 6.Debugging Techniques –Breakpoints• When you reach a breakpoint during execution, the VI pauses and the Pause button appears red• You can take the following actions at a breakpoint:– Single-step through execution using the single-stepping buttons– Probe wires to check intermediate values– Change values of front panel controls – Click the Pause button to continue running to the next breakpoint or until the VI finishes running22EE 200 Fall 2013Lab 6.Undefined or Unexpected Data• ∞ (Inf)– Divided a number by zero?• NaN (not a number)– Produced by invalid operations, such as taking the square root of a negative number• Check for unexpected Inf values or NaN values in your mathematical operations23EE 200 Fall 2013Lab 6.Exercise 2• Investigate debugging techniques using the Exercise 2 VI– execution highlighting– probes– retaining wire values after execution– single stepping24EE 200 Fall 2013Lab 6.Exercise 3• Investigate debugging subVIs– Use the Lab 1 VIs provided along with the Lab 6 notes:•


View Full Document

PSU EE 200 - Lab_6_EE200_f13

Download Lab_6_EE200_f13
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lab_6_EE200_f13 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lab_6_EE200_f13 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?