1 / 43

AHMET OZMEN

AHMET OZMEN. Virtual Instruments (VIs). LabVIEW programs are called virtual instruments, or VIs Appearance and operation imitate physical instruments, such as oscilloscopes and digital multimeters. Parts of a VI. LabVIEW VIs contain three main components: Front Panel

willem
Download Presentation

AHMET OZMEN

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. AHMET OZMEN

  2. Virtual Instruments (VIs) • LabVIEW programs are called virtual instruments, or VIs • Appearance and operation imitate physical instruments, such as oscilloscopes and digital multimeters

  3. Parts of a VI LabVIEW VIs contain three main components: • Front Panel • Block Diagram • Icon/Connector Pane

  4. The LabVIEW Environment “VI” = program or function “Front Panel” = user interface “Block Diagram” = code

  5. Front Panel-Controls & Indicators • Knobs/Dials • Graphs/Charts • Buttons • Digital Displays • Sliders • Thermometers • Customize and create your own

  6. Front Panel – Controls Palette • Contains the controls and indicators you use to create the front panel • Access from the front panel by selecting View»Controls Palette

  7. Front Panel – Front Panel Toolbar

  8. Block Diagram Block diagram objects include the following: • Terminals • SubVIs • Functions • Constants • Structures • Wires

  9. Block Diagram – Functions Palette • Contains the VIs, functions, and constants you use to create the block diagram

  10. Block Diagram – Block Diagram Toolbar

  11. Block Diagram Terminals

  12. Searching for Controls, VIs & Functions • Find controls, function, and VIs using the Search button on the Controls and Functions palette

  13. Dataflow LabVIEW follows a dataflow model for running VIs • A node executes only when data are available at all of its input terminals • A node supplies data to the output terminals only when the node finishes execution

  14. Dataflow Programming Block Diagram 1 2 3 Both Simulate Signal Express VIs execute simultaneously 1 Comparison waits until all inputs are present, then executes 2 Once executed, output from comparison continues through code 3

  15. Building a Simple VI

  16. Building a Simple VI – Acquire Acquire Express VIs: • DAQ Assistant Express VI • Instrument I/O Assistant Express VI • Simulate Signal Express VI • Read from Measurement File Express VI

  17. Building a Simple VI – Analyze Analyze Express VIs: • Amplitude and Level Measurements Express VI • Statistics Express VI • Spectral Measurements Express VI • Tone Measurements Express VI • Filter Express VI

  18. Built-in Programming Assistance Highlight Execution Block Diagram Cleanup Context Help

  19. PC-BasedData Acquisition (DAQ)

  20. DAQ Demo

  21. While Loops Repeat (code); Until Condition met; End; LabVIEW While Loop Flowchart Pseudo Code

  22. While Loops • Iteration terminal: returns number of times loop has executed; zero indexed • Conditional terminal: defines when the loop stops Iteration Terminal Conditional Terminal

  23. While Loops – Tunnels • Tunnels transfer data into and out of structures • The tunnel adopts the color of the data type wired to the tunnel • Data pass out of a loop after the loop terminates • When a tunnel passes data into a loop, the loop executes only after data arrive at the tunnel

  24. While Loops - Error Checking and Error Handling • Use an error cluster in a While Loop to stop the While Loop if an error occurs

  25. For Loops N=100; i=0; Until i=N: Repeat (code;i=i+1); End; LabVIEW For Loop Flowchart Pseudo Code

  26. 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

  27. Timing a VI Why do you need timing in a VI? • Control the frequency at which a loop executes • Provide the processor with time to complete other tasks, such as processing the user interface

  28. Timing a VI – Wait Functions • A wait function inside a loop allows the VI to sleep for a set amount of time • Allows the processor to address other tasks during the wait time • Uses the operating system millisecond clock

  29. Timing Methods • Wait Until Next Multiple VI – Variable time of execution • Execute A, Execute B, sleep until OS timer reaches next multiple of 20 ms • Wait VI – Constant time of execution • Execute A, Execute B, sleep 10 ms

  30. Timing a VI – Elapsed Time Express VI • Determines how much time elapses after some point in your VI • Keep track of time while the VI continues to execute • Does not provide the processor with time to complete other tasks

  31. Iterative Data Transfer – Shift Registers • Right-click the border and select Add Shift Register from the shortcut menu • Right shift register stores data on completion of an iteration • Left shift register provides stored data at beginning of the next iteration

  32. Case Structures • Have two or more subdiagrams or cases • Execute and displays only one case at a time • An input value determines which subdiagram to execute • Similar to case statements or if...then...else statements in text-based programming languages

  33. Case Structures • Case Selector Label: contains the name of the current case and decrement and increment buttons on each side • Selector Terminal: Wire an input value, or selector, to determine which case executes

  34. Case Structures – Default Case • You can specify a default case for the Case structure • If you specified cases for 1, 2, and 3, but you get an input of 4, the Case structure executes the default case • Right-click the Case structure border to add, duplicate, remove, or rearrange cases and to select a default case

  35. State Programming Although Sequence structures or sequentially wired subVIs accomplish the purpose, it is not always the best choice: • What if you need to change the order of the sequence? • What if you need to repeat one item in the sequence more often than the other items? • What if some items in the sequence execute only when certain conditions are met? • What if you need to stop the program immediately, rather than waiting until the end of the sequence?

  36. State Machines • The state machine design pattern implements a state diagram or flow chart • When to use state machines? • Commonly used to create user interfaces, where different user actions send the user interface into different states • Commonly used for process tests, where a state represents each segment of the process

  37. State Machines – Infrastructure • A state machine consists of a set of states and a transition function that maps to the next state • Each state can lead to one or multiple states or end the process flow While Loop Case Structure Shift Register

  38. State Machines – Default Transition

  39. Parallelism • Often, you need to program multiple tasks so that they execute at the same time • In LabVIEW, tasks can run in parallel if they do not have a data dependency between them, and if they do not use the same shared resource • An example of a shared resource is a file, or an instrument

  40. Automatic Multithreading in LabVIEW • LabVIEW automatically divides each application into multiple execution threads (introduced in 1998 with LabVIEW 5.0) • Parallel code paths will execute in unique threads thread thread thread

  41. Multiple Loop Architectures

  42. TriggeredAcquisitionDemo

  43. THANK YOU!

More Related