1 / 33

LabView Academy

LabView Academy. 5. óra. Témakörök. SubVI Modularitás Icon Connector Pane. SubVI. function average (in1, in2, out) { out = (in1 + in2)/2.0; } Block Diagram. main { average (point1, point2, pointavg) } SubVI hívás. Icon/Connector. terminals. Icon.

ownah
Download Presentation

LabView Academy

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. LabViewAcademy 5. óra

  2. Témakörök • SubVI • Modularitás • Icon • Connector Pane

  3. SubVI function average (in1, in2, out) { out = (in1 + in2)/2.0; } Block Diagram main { average (point1, point2, pointavg) } SubVI hívás

  4. Icon/Connector terminals Icon An icon represents a VI in other block diagrams A connector passes data to and receives data from a subVI through terminals Connector terminals

  5. SubVI Example – Calculating Slope • A VI within another VI is called a subVI • To use a VI as a subVI, create an icon and a connector pane after building the front panel and block diagram

  6. Understanding Modularity • LabVIEW uses subVIs to create modularity.

  7. Understanding Modularity – SubVIs • SubVIs correspond to subroutines in text-based programming languages. • The upper-right corner of the front panel and block diagram displays the icon for the VI. • This icon identifies the VI when you place the VI on a block diagram.

  8. Understanding Modularity – SubVIs Repeated code can become subVIs.

  9. Understanding Modularity – SubVIs

  10. Understanding Modularity – SubVIs

  11. Icon Characteristics of a Good Icon Using the Icon Editor

  12. Icon • An icon is a graphical representation of a VI. • If you use a VI as a subVI, the icon identifies the subVI on the block diagram of the VI.

  13. Characteristics of a Good Icon Good icons convey the functionality of the VI using: • Relevant graphics • Descriptive text, if necessary

  14. Creating Icons - Icon Editor Open the Icon Editor using one of these methods: • Right-click the icon in the upper-right corner of the front panel or block diagram and select Edit Icon. • Double-click the icon.

  15. Icon Editor Use the editing tools to modify an icon manually.

  16. Icon Editor Use the Glyphs tab to display glyphs you can include in the icon.

  17. Icon Editor Use the Icon Text tab to specify the text to display in the icon.

  18. Icon Editor • Use the Templates tab to display icon templates you can use as a background for the icon.

  19. C. Connector Pane Patterns Standards

  20. Connector Pane • The connector pane is displayed next to the icon in the upper right corner of the front panel. • Each rectangle on the connector pane represents a terminal. • Use the terminals to assign inputs and outputs. • Select a different pattern by right-clicking the connector pane and selecting Patterns from the shortcut menu.

  21. Connector Pane – Standards • Use this connector pane layout as a standard. • Top terminals are usually reserved for references, such as a file reference. • Bottom terminals are usually reserved for error clusters.

  22. D. Using SubVIs Using on Block Diagram Terminal Settings Handling Errors Creating from a Section of Block Diagram

  23. Using SubVIs • Options to place a subVI on the block diagram: • Drag the VI from the Project Explorer to the block diagram. • Click Select a VI on the Functions palette and then navigate to the VI. • Drag the icon from an open VI to the block diagram of another VI.

  24. Terminal Settings • Bold • Required terminal • Plain • Recommended terminal • Dimmed • Optional terminal

  25. Handling Errors Use a Case structure to handle errors passed into the subVI.

  26. Handling Errors • Avoid using LabVIEW error handler VIs inside subVIs.

  27. Convert a Section of a VI to SubVI To convert a section of a VI into a subVI: • Use the Positioning tool to select the section of the block diagram you want to reuse. • Select Edit»Create SubVI.

  28. Exercise 4-1Temperature Warnings VI Create the icon and connector pane for a VI so you can use the VI as a subVI. Call the subVI from a test VI.

  29. Exercise 4-1Temperature Warnings VI • Do the terminal names in the calling VI need to match the subVI terminal names? • Do the data types in the calling VI need to match the subVI terminal data types?

  30. Summary—Quiz • On a subVI, which terminal setting causes a broken VI if the terminal is not wired? • Required • Recommended • Optional

  31. Summary—Quiz Answer • On a subVI, which terminal setting causes a broken VI if the terminal is not wired? • Required • Recommended • Optional

  32. Summary—Quiz • You must create a custom icon to use a VI as a subVI. • True • False

  33. Summary—Quiz Answer • You must create a custom icon to use a VI as a subVI. • True • FalseYou do not need to create a custom icon to use a VI as a subVI, but it is highly recommended to increase the readability of your code.

More Related