Download presentation
Presentation is loading. Please wait.
Published byApril Goodwin Modified over 9 years ago
1
Course contents 1.Labview basics – virtual instruments, data flow, palettes 2.Structures – for, while, case,... – editing techniques 3.Controls&Indicators – arrays, clusters, charts, graphs 4.Additional lecture – State machines, SubVIs, MainCluster 5.Modular programming + recording – SubVIs – File I/O – Analysis – Signal processing – Communication between loops 6.Instrument control – DAQ, Data collection, GPIB, Serial 7.Additional lecture – Data Acquisition, Instrument control
2
SubVIs Modular programming – group related functions and icons into lower level VI – these subVIs can be called by higher level VIs subVI components – connector – icon
3
SubVI connectors Terminals that correspond to the VI controls and indicators – data in from inputs, data passed to the outputs when VI finishes executing Assigning terminals: – click on the connector terminal with the wiring tool – next click on the control/indicator you want to wire – or you can first select the control/indicator with wiring tool and then click the terminal
4
Terminal patterns You can modify the terminal pattern – or rotate and flip it It is advisable to select a pattern which will cover your future needs – you can leave extra unwired terminals
5
SubVI icon SubVI is represented by an icon on the block diagram VIs have a default icon – use the icon editor to edit the icon
6
Create a subVI From scratch – do the necessary wiring on block diagram or copy paste from an existing VI – connect the controls and indicators on the front panel to the connector pane Use existing VI – open a VI – make the necessary connections in the connector pane
7
Creating subVI automatically Enclose area to be converted into a subVI Select Edit»Create SubVI from the Edit Menu
8
Add an existing VI on the block diagram as a subVI Add any VI on the block diagram – From Functions palette: Select a VI...
9
VI Hierarchy View >> VI Hierarchy Hierarchical structure of all VIs in memory – dependencies between top-level VIs and subVIs
10
Strings Sequence of characters Numeric data often passed as strings: – file I/O – instrument control
11
String functions
12
Example: Format Into String
13
Codes Display Display characters like carriage return, tabs, white space
14
File I/O High-level File I/O – They have it All in one VI: create or open file, read/write data, close file
15
Express File I/O Write to Measurement File
16
Express File I/O Read From Measurement File
17
Write To Spreadsheet File.vi Write to text file
18
Read from Spreadsheet File.vi Read data from text file
19
Decimal symbol Write/Read To/From Spreadsheet File.vi uses operating system settings for decimal symbol – on windows7 you can change it from Region and Language settings
20
Disk streaming Keep the file open for multiple read/write operations – no overhead from opening and closing the file If speed and disk space are crucial: use binary files
21
Advanced file functions File writing positions Move, Copy, Delete files
22
Datalog If manipulating complex records or different data types and you will only use LabVIEW, try datalog See Example Finder Fundamentals >> File input/output >> Read/Write Datalog
23
TDMS Technical Data Mangement Solution – saving well-documented measurement data – quickly locating previously stored data http://zone.ni.com/devzone/cda/tut/p/id/3539
24
Keynotes
25
Communication between loops Design Patterns – Producer/Consumer – Master/Slave Local Variable Shared Variable
26
Producer/Consumer
27
Local Variables Local Variables allow data to be passed between parallel loops. A single control or indicator can be read or written to from more than one location in the program – Local Variables break the dataflow paradigm and should be used sparingly
28
Shared Variables Shared Variables are used to send data between VIs. Variable Types: – Single Process: share the data among VIs on the local computer. – Network-published: communicate between VIs, remote computers, and hardware through the Shared Variable Engine. Shared Variable must exist within a project library. Shared Variable must be deployed to be available to other projects and remote computers.
29
Textual Math in LabVIEW Integrate existing scripts with LabVIEW for faster development Interactive, easy-to-use, hands-on learning environment Develop algorithms, explore mathematical concepts, and analyze results using a single environment Freedom to choose the most effective syntax, whether graphical or textual within one VI Supported Math Tools: MathScript script nodeMathSoft software Mathematica softwareMATLAB ® software Maple software Xmath software MATLAB ® is a registered trademark of The MathWorks, Inc.
30
Math with the MathScript Node Implement equations and algorithms textually Input and Output variables created at the border Generally compatible with popular m-file script language Terminate statements with a semicolon to disable immediate output Prototype your equations in the interactive MathScript Window. (Functions»Programming » Structures » MathScript)
31
The Interactive MathScript Window Rapidly develop and test algorithms (LabVIEW»Tools»MathScript Window) Output Window Variable Workspace View/Modify Variable Contents User Commands m-file Script Share Scripts and Variables with the Node View /Modify Variable content in 1D, 2D, and 3D
32
Signal Generation You can generate signals to test your programs
33
Normalized Frequency ranges from 0.0 to 1.0 in units cycles/samples Example: – Sine Wave
34
Waves and Patterns Wave VIs generate continuous signals according to normalized frequency and number of samples Pattern VIs create patterns according to number of cycles Example: Sine Pattern
35
Simulate Signal Express
36
Signal Processing Express VIs Find Examples >> Analyzing and Processing Signal >> Basic Spectral Measurement
37
Signal Processing Fourier transform – frequency-domain representation of the signal Find Examples >> Analyzing and Processing Signal >> FFT and Frequency Analysis >> FFT And Power Spectrum Units.vi
38
Signal Processing
39
Filters Find Examples >> Analyzing and Processing Signals >> Filtering And Conditioning >> Extract The Sine Wave
40
Fitting Find Examples >> Analyzing and Processing Signal >> Curve Fitting and Interpolation >> Parametric Curve Fitting.vi
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.