Вы находитесь на странице: 1из 365

LabVIEW

I
: LabVIEW 8.2
: 2007


.., .., .., ..
- " "
-
. ..
: http://labview.ilc.edu.ru


1993, 2001 National Instruments Corporation. .

: , , ,
-
,

National Instruments.

LabVIEW, National Instruments, NI ni.com - National
Instruments.


ni.com
- National Instruments 11500 North Mopac Expressway Austin, Texas
78759-3504 USA Tel: 512 683 0100
National Instruments: 495 7836851


:
A.
B.
C.
D.
E.



.
, ...
..

VII
IX
X
XI
XII

1.
LabVIEW
A. LabVIEW...
B. ()..
C. ...
D. LabVIEW...
E. LabVIEW...
F. LabVIEW .

1-2
1-3
1-7
1-8
1-19
1-23

2.

A. ..
B. ...
C. ..
D.
E. .

2-2
2-6
2-8
2-14
2-25

3.

A. .
B. ...
C. ..
D. - ...
E. - .

3-2
3-3
3-11
3-13
3-21

4.

A. While ( )... 4-2
B. For ( ).. 4-10
C. .... 4-16
5.

A. ...
B. .................................
C. ...
D. ..

5-2
5-4
5-6
5-11

6.

A. 6-2
B. ... 6-5
C. ... 6-13
National Instruments Corporation

ii

LabVIEW I

7.

A. ..
B.

C. ()....
D. ()..

7-2
7-14
7-29
7-32

8.

A. Select ...
B. Case ....
C. ..
D. ..

8-2
8-3
8-13
8-16

9.
/
A. ..
B. ...
C. /. ..
E. .
F. / ...

9-2
9-4
9-11
9-19
9-25

10.

A. ..
B. LabVIEW....
C. ....
D. ...
E. .
F. ...
G. - .

10-2
10-12
10-13
10-19
10-24
10-29
10-32

11.

A.
B. GPIB- ..
C. Instrument I/O Assistant
D. (VISA) ....
E. ....
F. .
G. .
H. (). ...

11-2
11-3
11-9
11-14
11-19
11-20
11-26
11-36

12.

A. ..
B.
C. . ..
D. ...
E. ().
F. .
National Instruments Corporation

iii

12-2
12-5
12-10
12-14
12-17
12-18

LabVIEW I


LabVIEW I.

.
, ,
LabVIEW I.

National Instruments Corporation

iv

LabVIEW I

.
, LabVIEW
, ,
, ,
. ,
,
- Windows, MacOS UNIX,

- -.
,
. :

, , ;

, .


National Instruments.
(DAQ)
,
- GPIB
(NI Instrument Simulator).
,

. , ,
, .
,
. , GPIB
(NI
Instrument Simulator) DAQ ,
, .

- .
- . .

National Instruments Corporation

LabVIEW I

National Instruments Corporation

vi

LabVIEW I

B.
:

(Windows) Windows 98 ,
; (MacOS) Power Macintosh MacOS 7.6.1
; (UNIX) Sun workstation
Solaris 2.5
XWindows PC Linux 2.0.x
Intel x86;.

(Windows)

DAQ
,
Measurement & Automation Explorer
1 (device 1); (MacOS)
DAQ
, 1 (Slot 1);

DAQ ,
;

(Windows and UNIX) GPIB ; (MacOS) GPIB


2 (Slot 2);

(NI Instrument Simulator)


;

LabVIEW Full Professional Development System 8.2


;

- ;

GPIB ;

() , (Windows) Notepad,
WordPad; (MacOS) SimpleText; (UNIX) Text Editor, vi, vuepad;

- LabVIEW I,
:

Exercises

,
;
,

nidevsim.zip

Zip , LabVIEW-
(NI Instrument
Simulator)

bas1soln.exe

.
(Thermometer VI) (Demo) Thermometer VI
.
National Instruments Corporation

vii

LabVIEW I

C.


LabVIEW I.

Windows
1.

nidevsim labview\instr.lib.
LabVIEW NI Devsim
FunctionsInstrument I/OInstrument
Drivers.

2.

Exercises c:.

3.

Solutions c:.

National Instruments Corporation

viii

LabVIEW I

D. ,

:
-

LabVIEW ;

, -,
;

,
;

,
GPIB-;

, DAQ ;

:
-

GPIB-;

COM ;

- ;

National Instruments Corporation

ix

LabVIEW I

E.
:

" "
. ,
FilePage SetupOptions ,
File, Page Setup Options
.
.
.
,
.
,
: GPIB- DAQ .



, ,
, , ,
.

,
, .
,
.

(MacOS)

, ,
.
(Windows)

, (MacOS) <Command>

<Enter>
<Ctrl>

(Macos) <Return>
(Macos) <Command>, (Sun) <Meta>,(Linux)
<Alt>.

National Instruments Corporation

LabVIEW I

1.
LabVIEW
LabVIEW.
LabVIEW,
, , LabVIEW,
Web-

LabVIEW Quick Reference Card.


PDF ,
LabVIEW (HelpSearch the LabVIEW
Bookshelf). <Page Down> LabVIEW Quick
Reference Card.

:
A.

LabVIEW.

B.

().

C.

D.

LabVIEW (, , ).

E.

LabVIEW.

F.

LabVIEW .

National Instruments Corporation

1-1

LabVIEW I

A. LabVIEW
, LabVIEW,
(). , ,
. LabVIEW
, , .
LabVIEW
(, .)
(, .). -

.
LabVIEW DAQ-,
, ,
GPIB, VXI, PXI, RS-232 RS-485. LabVIEW
,
LabVIEW Web Server TCP/IP Active X.
LabVIEW , , ,
. LabVIEW 32-
, (.EXE),
(.DLL).

National Instruments Corporation

1-2

LabVIEW I

B. ()
, , .
.
.

(Controls).

,
. , ,
. , ,
.. , ,
-, .

.

, . -
, , , ,
, ,
-.

National Instruments Corporation

1-3

LabVIEW I

-
:


, ,
( / ).
.

-.
. / .
, -
.

( / ),
. ,
/ .
/
. /
.
-
.
.
LabVIEW .

National Instruments Corporation

1-4

LabVIEW I

- .
.
-.
,
.
. 4

. , -
.

, ,
.
.
Temperature VI
-.

National Instruments Corporation

1-5

LabVIEW I

LabVIEW

(.vi), (.vit), (.ctl), (.ctt). LabVIEW
(.lvproj), (.lvlib), XControls (.xctl), (.lvclass).
LabVIEW ,
,
LabVIEW Select Files to Recover. ,
, Recover.
, , ,
Discard. Cancel
LVAutoSave\archives.
LabVIEW,
ToolsOptions,
Category, Environment.
,
,
.

National Instruments Corporation

1-6

LabVIEW I

C.
Visual Basic, C++, Java

.
LabVIEW .
- ,
/.

.. ,
.
-,
50.0.
- ,
, ,
Subtract () , Add
() Subtract ().
, ,
.


Add (), Random Number ( )
Divide (). ,
,
Add () Divide () ,
Random Number ( ) .
-
,
.

National Instruments Corporation

1-7

LabVIEW I

D. LabVIEW
LabVIEW ,
, ,
,
LabVIEW Help.
-.

, , FileExit

Files, .
New Open. New,
, .
Open, .

Resources
Internet ,
.

National Instruments Corporation

1-8

LabVIEW I

.
Blank VI New,
- .
, New
VI from Template
New. Create New (
), Description . OK.

-
Blank VI .
LabVIEW, .
-.
- .

Properties. , Pane Properties
Background. LabVIEW BMP,
JPEG PNG.
-:

National Instruments Corporation

1-9

LabVIEW I

3
10
2

11

12
4

13

14
6

15

16
17

1.
2.
3.

4.
5.

National Instruments Corporation

6.

7.
8.
9.
10.
11.

1-10

12.

13.
14.

15. (Bundle)
16.
17.

(For)
LabVIEW I


.
.

Run
Run , ,
.
, Run ,
.
Run , ,
.
, .
Error list,
.
Run Continuously
.
Abort Execution.
.
. Abort
Execution .
,
. ,
,
Pause .
Pause LabVIEW -
. .
Text Settings , ,
.
Align Objects (
, ..).
Distribute Objects
(, ..).
Resize Objects
.
National Instruments Corporation

1-11

LabVIEW I

Reorder ,
.
, Reorder
.
Context Help Context Help (
)

-
-
:

Highlight Execution
- ( ).
.
Retain Wire Values
. ,
.
Step Into
, .. ,
.
Step Over
..

Step Out , ..

.
Warning , , . Warning
, ,
, (ToolsOptionsDebugging).


. LabVIEW,
-
.
- .
,
-. .
National Instruments Corporation

1-12

LabVIEW I

(MacOS) <Command>
-.



, Open, Save, Copy, Paste,
LabVIEW.
. (MacOS)
.
.
.

File , ,
.

Edit
.

View ,
,
LabVIEW.

Project c
.

Operate
.

Tools DAQ
, ,
LabVIEW.

National Instruments Corporation

1-13

LabVIEW I

Window LabVIEW
.

Help ,
, , ,
LabVIEW
.

LabVIEW ,
: Tools Palette ( ), Controls Palette
( ) Functions Palette ( ).
.


, Tools Palette
( ).
, -.
.

.
WindowShow Tools Palette.
- .
. <Shift>
, Tools Palette (
).

,
- LabVIEW
Tools
().
Automatic Tool Selection Tools
() <Shift-Tab>.

.
, :
National Instruments Corporation

1-14

LabVIEW I

,
.
:


.
:

,
-.

.

.


, , , ,
.

-.

.

.
.

.
,
Tools () <Tab>.

-

.


(Controls) (Functions)
, .
, , .
National Instruments Corporation

1-15

LabVIEW I


-.
, ,
.
Open VI
.



. .
,
WindowShow Controls Palette,
.
, .


-.
-. ,
WindowShow Functions
Palette, National Instruments Corporation

1-16

LabVIEW I

.
.

.

(Category(Standard), Category (Icons and Text), Icons, Icons and Text,
Text, Tree), View .
Category(Standard)
Category (Icons and Text)
,
Move this Category Up Move this Category Down. ,
, ,
National Instruments Corporation

1-17

LabVIEW I

.
Text Tree
. View
Sort Alphabetically.
Search
- , .

Controls () Functions ()
, Random Number (
), Search Functions ()
Random Number. LabVIEW
, .
,
- .


FileOpen ,
.
c:\exercises\LV
Basics I.
,
.

National Instruments Corporation

1-18

LabVIEW I


. ,
Stop.
LabVIEW ,
, Search Path.
,
(Tools 0ptions Paths). , LabVIEW
, Ignore Sub VI,
, Browse ().

E. LabVIEW.
, ,
LabVIEW, , (nonLabVIEW files) . ,
Target. Target
, .
LabVIEW -
(.lvproj), , ,
, ,
..
.
LabVIEW Real-Time, FPGA, or PDA.

Project Explorer Window


Project Explorer Window.

FileNew Project. ,
ProjectNew Project FileNew Empty
National Instruments Corporation

1-19

LabVIEW I

Project. New,
.

Project root ( ) .
.

My Computer ( )
(target), .

Dependencies () ,
.

Build Specifications ( )

LabVIEW.
,
,
. LabVIEW
Professional Development System Application Builder, ,
Build Specifications,
(EXEs), (DLLs), zip .
(Windows) Build Specifications ,
.

(target) LabVIEW
(Project Explorer)
. (target)
Dependencies Build Specifications.
.
National Instruments Corporation

1-20

LabVIEW I

VIs
VI
subVI.


.
:

, ToolsConvert Build Script ,
.

, .


,
.
.
, .
, ViewToolbars
,
. , ,

.


, ,
LabVIEW: VIs, LLBs, , ,
. ,
.


:
,
( My Computer), ,
My Computer.
Add File , .
Project,
.
ProjectAdd To ProjectAdd File.

NewVI
My Computer, ,

National Instruments Corporation

1-21

LabVIEW I

, FileNew VI ProjectAdd To ProjectNew


VI.
, ,
, ,
,
, My Computer.

,
( My Computer),
Add Folder.
, ,
.
.
ProjectAdd To ProjectAdd Folder.

, LabVIEW
. ,
,
.

,
.
My Computer
NewFolder. ,
(Targets) .

LLBs
LLB .
, LabVIEW
VIs
.
,
( My Computer),
Add Folder. , ,
LLB .
, ,
.llb .

LLB .
, ,
.
National Instruments Corporation

1-22

LabVIEW I


, (
My Computer),
Add File. , ,
.


- :

, ,
Remove.

,
<Delete> .

, Delete
, .

(Dependencies)
(Dependencies) , ,
( .) (Target).
Dependencies.
- Dependencies, LabVIEW
, Dependencies
Refresh. ,
, (subVIs),
LabVIEW Dependencies,
, Refresh. ,
, LabVIEW
Dependencies. , VI subVI,
LabVIEW subVI Dependencies, Refresh.
VIs, DLLs ,
.
, ,
Dependencies. ,
(target), , .
LabVIEW subVIs,
DLLs. , a.vi
b.dll , b.dll
c.dll, LabVIEW
b.dll. c.dll
(Target).
National Instruments Corporation

1-23

LabVIEW I

, LabVIEW
Dependencies.
Dependencies .
-
Dependencies.
- Dependencies
Remove.
- Dependencies,
, Dependencies, Refresh.
LabVIEW Dependencies
. ,
Dependencies, Refresh.

(Targets)
(Target)
Add Targets and Devices.
,
.
Add Targets and Devices

NewTargets and Devices.
,
. ,
NI PCI ,
My Computer.


, ,
, ,
Target (My Computer).


LabVIEW ( LabVIEW)
, .
, ,
. ,
-
,
.
National Instruments Corporation

1-24

LabVIEW I

,
, : Project 1.lvproj/My Computer.
,
.
,
, .
,
.


,
, . ,
, ,
.
, ,
,
. ,
, , LabVIEW
. ,
,

.
, :

Synchronize with Other Application Instances,


.

,
. , , LabVIEW
.

, .

,
.
,
.

- , LabVIEW
.

- .
-
.
OperateConnect to Remote Panel
National Instruments Corporation

1-25

LabVIEW I

VI name. ,
, .
, MyVI.vi
MyProject.lvproj My Computer,
: MyProject.lvproj/My Computer/MyVI.vi.
MyLibrary,
VI name: MyProject.lvproj/My
Computer/MyLibrary:MyVI.vi.
, .

LabVIEW
,
, (shared variables),
. , .
, LabVIEW
(.lvlib), ,
. ,
,
, , -
.

.
LabVIEW :

,
(My Computer) NewLibrary.
LabVIEW ,
.

- .

Convert to Library.

,
.
, LLB ,
. ,
, .

.
,
Rename. :
LabVIEW,
.

National Instruments Corporation

1-26

LabVIEW I

1-1.
:
1.

LabVIEW (StartProgramsNational Instruments


LabVIEW 7.0 LabVIEW). LabVIEW.

2.

HelpFind Examples.
, .

3.

Browse (). Directory


Structure. Apps, Freqresp.llb,
Frequency Response VI.
.

. , Open VI
labview\examples\apps\freqresp.llb\Frequency Response.vi.


4.

Run, ,
.
.
.

National Instruments Corporation

1-27

LabVIEW I

5.


Amplitude. ,
,
,
.
,
Enter, ,
. .
(MacOS and Sun) <Return>.

6.

Run .
, , .

-
7.

-.
WindowShow Diagram <Ctrl-E> .
(MacOS) <Command-E>.
(Sun) <Meta-E>.
(Linux) <Alt-E>.

National Instruments Corporation

1-28

LabVIEW I

- ,
, ,
.
8.


DMM.

Demo Fluke
8840A VI.
.

.
LabVIEW .

LabVIEW,
/
. ,
Demo Fluke,
, .
9.

FileClose Demo Fluke


8840AVI.

10. .
1-2.

1-1
National Instruments Corporation

1-29

LabVIEW I

F. LabVIEW (LabVIEW Help)



Context Help
. LabVIEW
Help ( ).


Context Help ( )
HelpShow Context Help <Ctrl-H> .
(MacOS) <Command-H>. (Sun)
<Meta-H>. (Linux) <Alt-H>.
-
Context Help ( )
, , ,
/ .
Context Help ( )
. , ,
,
, ()
.
Context Help.


Simple/Detailed Context Help,
Context Help.
/ .
. / ,
:

National Instruments Corporation

1-30

LabVIEW I

Context Help ( ),
Lock Context Help. Context
Help ( ) ,
.
. Help.

LabVIEW Help ( ) More Help.

LabVIEW
LabVIEW Help ( )
More Help Context Help ( )
HelpVI, Function, & How-To Help
Context Help ( ) Click here for more
help.
LabVIEW
, , , ,
LabVIEW LabVIEW
Tutorial ( ), PDF LabVIEW
Web- National Instruments.

National Instruments Corporation

1-31

LabVIEW I

1-2.
LabVIEW
: LabVIEW
-

A.
1.

. , ,
1-1.

2.

WindowShow Diagram,
-.

3.

HelpShow Context Help


<Ctrl-H>,
Context Help.
(MacOS) <Command-H>. (Sun)
<Meta-H>. (Linux) <Alt-H>.

4.

Context
Help , .
a.

, ,
Logarithm Base 10, Bode
Plot. Context Help
.

b.

Context Help More


Help, ,
LabVIEW Help ( ).
Click here for more help
Context Help.
LabVIEW Help ( )
, , , .
.

c.

, ,
/

Logarithm
Base
10.
Context Help
.

d.

.
Context Help
.

B. LabVIEW
5.

HelpVI, Function, & How-To Help,


LabVIEW Help ( LabVIEW).
LabVIEW Help ( LabVIEW)
LabVIEW

National Instruments Corporation

1-32

LabVIEW I

LabVIEW Tutorial ( ), PDF


LabVIEW Web- National
Instruments.
6.

7.

LabVIEW.
a.

Index
LabVIEW.

b.

Frequency Response.
.

c.

. LabVIEW
.

d.

Contents
LabVIEW.

e.

Index.

f.

GPIB,
GPIB.

g.

functions
GPIB LabVIEW.

LabVIEW.
a.

Search.

displaying frequency.
Frequency Information Displayed.
Adobe Acrobat Reader,
Contents PDF
LabVIEW LabVIEW.

b.
8.

9.

a.

Related Documentation Contents.


.

b.

LabVIEW User Manual, PDF


LabVIEW.

c.

Back, Related
Documentation.

,
Web- National Instruments.
a.

Technical Support Resources


Contents ().

b.

Technical Support
Resources. .

c.

Technical Support
ni.com.

d.

Technical Support Resources.

National Instruments Corporation

1-33

LabVIEW I

e.
f.

NI Developer Zone Developer Zone


( ) National Instruments.
Frequency Response
GO.

National Instruments.

C. LabVIEW
10. Acrobat Reader, Help
Search the LabVIEW Bookshelf LabVIEW Bookshelf
( LabVIEW).
11. Search, Adobe Acrobat
Search.
12. Frequency Response
Search.
LabVIEW.
13. .
Frequency Response .
14.
EditSearchResults.

15. Acrobat Reader.


16. FileClose
. .

1-2

National Instruments Corporation

1-34

LabVIEW I

, , .

- ,
, .


. <Shift>
,
.

Controls ()
. Controls ()

.

Functions () . Functions ()
.

LabVIEW,
- .

, -.
(MacOS) <Command>
-.

Help Context Help


( ) LabVIEW Help (
LabVIEW), , , ,
,
LabVIEW.

HelpSearch the LabVIEW Bookshelf


LabVIEW Bookshelf ( LabVIEW)
PDF LabVIEW.

National Instruments Corporation

1-35

LabVIEW I

National Instruments Corporation

1-36

LabVIEW I

2. ,

2.
.

:
A.

B.

C.

D.

E.

National Instruments Corporation

2-1

LabVIEW I

2. ,

A.
, , .
3
.


,
.
,
. ,
.
- .
,
-.

Controls ().
Controls () .
Controls ()
WindowShow Controls Palette
.


,
,
<Enter>. (MacOS and Sun) <Return>.



(TRUE/FALSE

National Instruments Corporation

2-2

LabVIEW I

2. ,

/). ,
.
:


, .
. ,
.

-
- , ,
:

2
4
3
1

. 2-1. -.


-
(
National Instruments Corporation

2-3

LabVIEW I

2. ,

- ). -
,
. , DBL-,
, ,
.
, .

View as Icon ( ) .
.
-.

-;
.
, .

. ,
(a b 2-1),
- . Add ()
Subtract () ,
.
.
-
. Add
() Subtract (), ,
/ .

Visible ItemsTerminals.

-,
/ .
,
. ,
. ,
- .
, Case
(), While ( ) .. Add ()
Subtract (), -, -
.


-
. ,
. ,
- . ,
Function Generator, , National Instruments Corporation

2-4

LabVIEW I

2. ,

.
,
Function Generator VI, ,
-.
, -
.
-

View as Icon.
-
.

, -
. :
1. .
.
2.
.
3. , ,
,
.
4. .
Function Generator
.

. -

, / .

National Instruments Corporation

2-5

LabVIEW I

2. ,

B.
.
-.


New
LabVIEW .
. New
:
Create New ,
LabVIEW.
OK.
VI .

Blank VI .

VI from Template ,
.
- Frameworks , ,

- Instrument I/O , ,
,

- Simulated
, ,

- Tutorial (Getting Started)
-, ,
,
Getting Started.
- User - ,
.

Project LabVIEW.

Other Files ,
, ..
Description -
Create New ,


File Save, Save All Save As,
,
LabVIEW.
*.llb. National Instruments
National Instruments Corporation

2-6

LabVIEW I

2. ,

, ,
.
LabVIEW ,
.
ToolsOptions, Miscellaneous.



, MacOS Windows. LabVIEW
.
,
.
, FTP, Z XModem
.
.
,
,
:

(Windows) MacDisk TransferPro MacOS


PC .

(MacOS) DOS Mounter, MacLink Apple File Exchange


PC MacOS .

(Sun) PC File System (PCFS) PC Sun


.

. ,
DDE ( ) , ActiveX AppleEvents.

HelpSearch the
LabVIEW Bookshelf Porting and Localizing LabVIEW VIs.

National Instruments Corporation

2-7

LabVIEW I

2. ,

.
LabVIEW
. /
, .
,
. ,
.
, , .
, 2 . ,
,
/ /.


:
Numeric ( )
- Floating point ,
. single (32
bit), double (64-bit) extended (128-bit) precision ( ,
).
.
- Integer ,
. : 8, 16 32
. ,
.
Boolean , .
: 0 (FALSE) 1
(TRUE).
String , .
ASCII .
Path , .
, , LabVIEW ,
.
Array
.
luster .
,
,
, .
Waveform ,
,
.
Dynamic , -
. ,
, ,
. - /
.
National Instruments Corporation

2-8

LabVIEW I

2. ,

,
, .


-
.
.
,
. ,
, .
.


(1D) (2D)

),
()


LabVIEW
-. LabVIEW
/ , ,
.
-
, LabVIEW
, .
, LabVIEW
/ ,
.

Tools>>Options>>Block
Diagram.


.

,
.

National Instruments Corporation

2-9

LabVIEW I

2. ,

2-1. C F
:
,

.
, , ,
,
.


1.

FileNewVI,
.

2.

() WindowTile Left and


Right .
.
.

3.

a.


ControlsModernNumeric (
). Controls ()

.

b.

c.



Enter, ,
.
, LabVIEW ,
.
,
, .

National Instruments Corporation

2-10

LabVIEW I

2. ,

4.

.
F.
a.
ControlsModernNumeric ( ).
b. .
c.
F
Enter.

-
LabVIEW

,
.
.
, DBL, ,
.

. , ,

,
.

-
5.

-,
Window Show Diagram.

6.

Multiply ()
FunctionsProgrammingNumeric ( ).
-.
Functions ()
-.

7.

Add ()
FunctionsProgrammingNumeric
(
).
-.

8.


FunctionsProgrammingNumeric
(
).
-.
-
.

1,8 , 32,0.

National Instruments Corporation

2-11

LabVIEW I

2. ,

9.


-, .

-
, :

-

, ,
, .
.

,
.
, .

/

Visible
ItemsTerminals. ,
.

/
, ,
.
/.

<Esc>,

- .

10. ,
WindowShow Panel.
11. , .
a.

FileSave.

b.

c:\exercises\LV Basics I.

. c:\exercises\LV Basics I.

National Instruments Corporation

2-12

LabVIEW I

2. ,

c.

F ().vi

d.

Save.


12.

13.

.
a.


, ,
.

b.

Run, , .

c.

, FileClose.

2-1

National Instruments Corporation

2-13

LabVIEW I

2. ,

D.

-.



(Controls)
,
. Create

Constant , .

Control .

Indicator .


-
.
, .
,
<Shift>.
,
.



.
.
<Shift>.

,
<Shift>.
( )
.


,
, <Delete>
EditClear.

National Instruments Corporation

2-14

LabVIEW I

2. ,


,
, Undo () Redo
() Edit ().
, ,
ToolsOptions.
Block Diagram.
.


,
<Ctrl>.
(MacOS) <Option>. (Sun) <Meta>. (Linux)
<Alt>.
,
, <Ctrl>.
, .
.
,
Edit>>Copy Edit>>Paste.


. LabVIEW
: .
, .
,
.
, , ,
. ,
-.
.
,
.
<Enter>
.
. <Enter>
. , <Shift-Enter>.
<Enter>,
ToolsOptions, ,
Front Panel End text entry with Return key.

-.


FunctionsProgrammingStructuresDecorations.
National Instruments Corporation

2-15

LabVIEW I

2. ,



.
. , ,
.
,
,
, .
.
, :


,
.


,
, .
. ,
:
National Instruments Corporation

2-16

LabVIEW I

2. ,



.
<Delete>
.
EditRemove Broken Wires.
. Remove Broken Wires
. ,
-.

( , )
Text Settings ,
, ,
.
,
, .
.
, ,
Text Settings.

National Instruments Corporation

2-17

LabVIEW I

2. ,


.
,
. ,
. ,
, ,
.
.
, . <Shift>
.
-,
.



Align Objects.

Distribute Objects.

,


, ,
- .

Reorder : Move
Forward ( ), Move Backward (
), Move To Front ( ), Move To Back
( ).


Reorder : Group
(), Ungroup (), Lock (), Unlock
().



Resize Objects ( ).

/
,
.

, , ;
National Instruments Corporation

2-18

LabVIEW I

2. ,

.
, ,
, , LabVIEW ,
, .



EditCopy EditPaste.

-.
, ,
.


, . ,
-
, .

.

.
, Tools>>Options
Colors.
, T Colors.

National Instruments Corporation

2-19

LabVIEW I

2. ,

2-2.
:

,
, .
- .
.
Edit>>Undo


1.

File>>Open,
c:\exercises\LV basics I .vi

, Open
VI LabVIEW.

2.

.
a.

, ,
.
.

b.


, .

c.


. .
.

National Instruments Corporation

2-20

LabVIEW I

2. ,

.
3.

a.
, .
b. .
.
4.

,
,
.
a.
, .
b. ,
Align Objects Vertical
Centers, .
c. ,
Distribute Objects
Horizontal Centers, .
d. ,
Reorder Group.
e. ,
Reorder
Lock.
f. .
,
, .

5.

.
a. .
.
b. .
<Shift>,
, .

6.

.
a. OFF ( FALSE).
, ,
ON. ( TRUE).
b. , ,

.

National Instruments Corporation

2-21

LabVIEW I

2. ,

c. ON .
7.

,
, .
a. , ,

Visible ItemsLabel.
,
.
b. .
c.
Enter, , .

8.

.
a.
.
b. <Delete>
EditClear.

9.

.
a. <Ctrl>,
.
(MacOS) <Option>. (Sun)
<Meta>. (Linux) <Alt>.
b. .

10. .
a.
.
b. , Text Settings
.
c.
.
11. Y.
a. 10,0 Y.
b. Text Settings,
.
12. 0,0
-10.0, Y.

National Instruments Corporation

2-22

LabVIEW I

2. ,

-
13. -,
WindowShow Diagram.
, :

(Multiply)
5.00 ,
.

Uniform White Noise VI


[a:a], a
(amplitude) 10.00,
.

Not ( )
A .

14.
Multiply ()
Create>>Constant.

5.0
Enter .

15. ,
-. :

HelpShow Context Help


Context Help ( ).
Context Help ( )
, .

,
, ()
-.

National Instruments Corporation

2-23

LabVIEW I

2. ,

,
Visible ItemsTerminal.
,
Visible ItemsTerminal,
.

,
.

<Esc>,

.

16. FileSave, .
17. ,
WindowShow Panel.
18.
.
19. Run ,
.
20. FileClose, .

2-2

National Instruments Corporation

2-24

LabVIEW I

2. ,

E.
, , .
Run
, . , .


Run WindowsShow
Error List, ,
.
,
.


-
Highlight Execution, .
.

- .

.
.
. .



-.
Step Over Step Into .
, Step
Over, Step Into Step Out. ,
.
.

, .
,
.

National Instruments Corporation

2-25

LabVIEW I

2. ,


,
,
.


/ , .

-.
,

Custom Probe.
,
. ,
-,
.
,
- Retain Wire Values.
, LabVIEW
. ,
, - .


, ,

-.
.
, LabVIEW

. LabVIEW -
.
,
.
.

National Instruments Corporation

2-26

LabVIEW I

2. ,

2-3.
:

,
.


1.

FileOpen
c:\exercises\LV Basics I, ().vi
, Open VI
LabVIEW.
:

Run, , .
, .

-
2.

WindowShow Diagram,
-.

Random Number (0-1) ( ) 0 1.

Multiply () -
10,0.

National Instruments Corporation

2-27

LabVIEW I

2. ,

3.

() - 100.0
.

.
a. Run. Error list ( )
.
b.
.
c. Show Error,
.
d. Details.

4.

FileSave, .

5.

,
WindowShow Panel.

6.

, Run.

7.

WindowShow Diagram,
-

8.

a.

Highlight Execution, ,
.

b.

Step Into, ,
.
-
.
, .
Step Over, ,
-.
Step Over,
,
.
.
10,0. 100,0
.

c.

d.

9.

-,
Step Out, ,
().vi

.
a.

Step Into,
.

National Instruments Corporation

2-28

LabVIEW I

2. ,

b.

().vi ,
Step Into. -:

c.

- ().vi,
.
(.)vi,
, .

d.

- () .vi

e.

Step Out
. -
().vi .

f.

Step Out
.

10.
.
a.

,
, .
.

Probe
, -.
b.

. Probe
.

11.
.
a.


.
.

b.

Run, .
.

c.

Continue, ,
.

National Instruments Corporation

2-29

LabVIEW I

2. ,

d.


, .

12. Highlight Execution,


.
13. FileClose,
.

2-3

National Instruments Corporation

2-30

LabVIEW I

2. ,


,
.


, .

,

Change to Indicator Change to Control.

- , .

,
.
- .

Search Controls () Functions


() , .

Run
, .
Run Error list ( ),
.

,

-.



<Ctrl>. (MacOS) <Option> <Ctrl>. (Sun) <Meta>.
(Linux) <Alt>.

, ,
FileSave <Ctrl-S> .
:

<Ctrl-R> .
<Ctrl-E> - .
National Instruments Corporation

2-31

LabVIEW I

2. ,

<Ctrl-H> Context Help (


).
<Ctrl-B> .
<Ctrl-F> , , ,
, .

Tools ()
<Tab>.
-,
,



, <Shift>,
.


.
FileVI Properties Execution ,
Allow Debugging.

HelpShow Context Help,


Context Help ( ).
Context Help ( )
/ , .
/ , ,
, ()
.

,
.
:

1
National Instruments Corporation

2-32



LabVIEW I

2. ,


.
<Shift>.

<Esc>,
.


,
.

Visible ItemsTerminals.

,
:
-


CreateConstant, CreateControl
CreateIndicator .

<Ctrl>


,
<Shift>.

,
<Shift>.


, , <Ctrl>,
.

Replace .

- ,
<Ctrl>,
.

National Instruments Corporation

2-33

LabVIEW I

2. ,

. -
BrowseThis VIs SubVIs.

<Shift-Enter>.

ring ( )
Case (), <Shift-Enter>.
<Shift-Enter>
.
Case () 8
.



. ,
, ,
.

,
EditUndo.

-
<Ctrl> , ,

.

:
o <Ctrl-down arrow> - .
o <Ctrl-right arrow> - .
o <Ctrl-up arrow> - .

National Instruments Corporation

2-34

LabVIEW I

2. ,


2-4.

, .
, .

. Greater Or Equal? ( ?),


FunctionsProgrammingComparison
.vi
2-5.

,
0.0 10.0 ,
. ,
.
.vi

2-6.

, X
0 100 Y
. X Y,
.
2.vi

2-7.

, Double
( Integer)
( Double).

. Round To Infinity,
ProgrammingNumeric.
Quotient & Remainder,
ProgrammingNumeric.
.vi

National Instruments Corporation

2-35

LabVIEW I

2. ,

National Instruments Corporation

2-36

LabVIEW I

3.


, (
/ ),
.

:
A.

B.

C.

D.

E.

-
.

National Instruments Corporation

3-1

LabVIEW I

A.
,
,
. ,
, .

.
.
,
,

.
-.
LabVIEW II.


-:

function average (in1,in2,out)

main

out = (in1 + in2) / 2.0;

average(point1,point2,pointavg);

National Instruments Corporation

3-2

LabVIEW I

B.

-

.



- , .
. ,
.
, -
.
,
, LabVIEW.
, , ,

-. Edit Icon (
) . Icon Editor ( )

.
File, VI Properties ( ), Category
() General () Edit
Icon ( ).
,
Icon Editor ( ),
, .
-
,
, .

National Instruments Corporation

3-3

LabVIEW I

, , 16- 256- . ,
, LabVIEW - .
256- .
Edit () ,
.
LabVIEW
.

. LabVIEW
3232 .
- ( )
Copy from,
Icon Editor. OK .
. ,
. -
.

Icon Editor :
.
.
,
<Shift>.

.

.
National Instruments Corporation

3-4

LabVIEW I



.

.


, .

.
,
, ,
.

<Delete>.

.
. (Windows)
Small Fonts.
/
().
.
Icon Editor
:

Show Terminals - /
.

OK -

Cancel - Icon Editor .

Icon Editor ,
Undo (), Redo (), Cut (), Copy (), Paste
() Clear ().



, .
/ ,
,
.
.
, .

.

National Instruments Corporation

3-5

LabVIEW I

Show Connector ( / ).
,
.
LabVIEW /
. ,
. ,
LabVIEW .



Patterns ()
. /
.

.
.
,
. /
28.
.
.
/ ,
. 6,

. 16
/ . 16 .

-
: Flip Horizontal ( ), Flip
Vertical () Rotate 90 Degrees ( 90).
National Instruments Corporation

3-6

LabVIEW I

/

.
, ,
, - .
,
,
, ,
.
,
.
,
/ .
. /
,
.

National Instruments Corporation

3-7

LabVIEW I

3-1. F
:


,
F.


1.

FileOpen,
c:\exercises\LV Basics I C F
().vi
, Open VI ( )
LabVIEW.

. Open VI ( )
LabVIEW ,
C F().vi
:


2.


Edit Icon ( ).
Icon Editor.

3.


( ).

4.

<Delete>, .

5.

( ),
.

6.

National Instruments Corporation

3-8

LabVIEW I

a.

,
.

b.

C F.

c.

d.

. ,
<Shift>.
e.

f.

Copy from () B & W () 256 Colors (256- )


- , LabVIEW
.

g.

Copy from () 16 olors 256


Colors.

h.

OK
Icon Editor.
.

7.

,
Show Connector ( /
) . LabVIEW
/
. ,
C F LabVIEW ,
.

8.


.
a.

Help () Show Context

National Instruments Corporation

3-9

LabVIEW I

Help ( ) Context
Help ( ) .

9.

b.


.
,
.

c.

C.
.

d.

.
,
.

e.


F. .

f.

.
.

g.

/ .
Context Help ( ) ,

.

FileSave.
C F.vi, .

10. FileClose. .

3-1

National Instruments Corporation

3-10

LabVIEW I

C.
,
.
-,
Functions () Select a VI ( ).
-.
- ,
.


-

. ,
Browse () This VIs SubVIs (
). - ,
<Ctrl>, .
(MacOS) <Option>. (Sun) <Meta>. (Linux)
<Alt>.
, ,
.

/ : ,
( )
Context Help,
HelpShow Context Help,
, ,
( ) - ,
Detailed. Simple ()
Context Help
.

( )
.

, This Connection
Is ( ), : Required
(),
Recommended
()

Optional
().
,
,
. , ,
, , LabVIEW
National Instruments Corporation

3-11

LabVIEW I

Error List ( ), Error List


( ) Show Warnings (
). LabVIEW
.
LabVIEW
Recommended (). Required ()
, .
File I/O (
), Functions ().

National Instruments Corporation

3-12

LabVIEW I

D. -
-
. ,
.
- Getting Started with LabVIEW.

-.
- Open Front Panel (
) .
-
:
1. c -;
2. - Open
Front Panel ( ) ;
3. Convert ()
, ;
4. ;
5. OperateMake Current Values Default

Make Current Values Default
;
6. , ,
, - -.
-
-.

National Instruments Corporation

3-13

LabVIEW I

3-2.
: -

- DAQmx Assistant,
.
DAQ 10 "
".
,
DAQ.
, .
, 23,
23 .
DAQ .
0 DAQ

-
1. .
2. -, WindowShow Diagram.
- DAQmx Assistant,
FunctionsExpressInput. MAX.
3. Analog InputVoltage
4. Dev1ai0
5. Analog Voltage Task Configuration.
Task Timing Acquire 1 Point.
OK.
6. DAQmx Assistant
Open Front Panel ( ).
7. Convert ()
. .
8. OperateMake Current Values Default

Make Current Values Default
.
9. .vi
c:\exercises\LV Basics I.
10. .
11. - ,
,
. .vi
c:\exercises\LV Basics I. ,
.

National Instruments Corporation

3-14

LabVIEW I

. DAQ ,
() VI,
c:\exercises\LV Basics I.

3-2

National Instruments Corporation

3-15

LabVIEW I

3-3.
: ,

,

DAQ
.


1.
2.

3.

, ,
.
,
:

a.

,
ControlsModern Numeric (
)

b.


Enter .

c.


Visible Items ( ),
Digital Display ( ).

.
a. ,
ControlsModern Boolean ( ).
b.
Enter .
c. ,
, .
d. ,
F, .

National Instruments Corporation

3-16

LabVIEW I

4.

,
Context Help .
a. FileVI Properties.
b. Documentation () Category
() .
c. :
,
DAQ.

5.

,
Context Help
.
a.
Description and Tip (
).
b. :
.
c. Tip .
d. OK.
e.
Description and Tip (
).
f. :
( ),
.
g. Tip - C F.
h. OK.

6.

Context Help,
HelpShow Context Help.

7.


Context Help.

-
8.

-, WindowShow Diagram.

9.

-, :

National Instruments Corporation

3-17

LabVIEW I

. DAQ ,
(Demo) Read Voltage VI,
c:\exercises\LV Basics I.
- Convert from Dynamic Data,
FunctionsExpressSignal Manipulation.
.
Single Scalar Resulting data type.
Multiply (),
FunctionsProgrammingNumeric.
Read Voltage VI 100.0
.
y Multiply
() CreateConstant.
100 <Enter>.
Functions () Select a VI ( )
c:\exercises\LV Basics I C F,
3-1. -.
.
Select (),
FunctionsProgrammingComparison.
F .

, -,
.
.
Visible
ItemsTerminal.


10. .
11. , .
12.
.
13. .


14. , ,

National Instruments Corporation

3-18

LabVIEW I

a.
Edit Icon ( ).
Icon Editor ( ).
b. ( ).
c. <Delete>,
.
d. (
),
.
e. , ,
.
f.

.
. ,
<Shift>.
g.
.
h. Copy from () B & W (-)
256 Colors (256-)
- , LabVIEW
.
i. OK
Icon Editor ( ).
.
15.
,
Show Connector (
/ ).
a. .
National Instruments Corporation

3-19

LabVIEW I

b. .
.
c. .
d. .
.
e. .
16. .vi c:\exercises\LV
Basics I, .
17. , FileClose.

3-3

National Instruments Corporation

3-20

LabVIEW I

E. -

- ,
.
Edit ()
Create SubVI ( ).
. LabVIEW

/ ,
:


.

.
.
28, 28
/ .

National Instruments Corporation

3-21

LabVIEW I

,
, .
-.

,
,
.

/ ,
.

.

, ,
,
.

Icon Editor ( )

.

(
)
.

This Connection Is ( )
.

: FileVI Properties
Documentation () Category
() .
Context Help
,
/ .

:

Description and Tip (
).
Context Help .

.
()
-
Edit () Create
SubVI ( ).

National Instruments Corporation

3-22

LabVIEW I

National Instruments Corporation

3-23

LabVIEW I

4.


Case (),
. -
,
.
LabVIEW : While ( ),
For ( ), Case (),
Sequence (), Event (),
Formula Node ( ), MathScript Node (
) .
While ( ), For
( ), ,
, Shift Register ( )
Feedback Node ( ).

:
A.

While ( ).

B.

For ( ).

C.

National Instruments Corporation

4-1

LabVIEW I

A. While ( )
While ( ) ,
. While Do
Repeat Until, .
(1) While LabVIEW,
(2) - While, (3)
While.

1. LabVIEW While

2. -

3.

While FunctionsPogrammingStructures.
Functions (),
-,
. ,
- .
-
.

. While , , 1 .
- While ,
. ,
, . ,
TRUE.
Stop If True (
).
, ,
.
.
-, ,
While
10,00
Enable. And ( ) TRUE,
TRUE.
National Instruments Corporation

4-2

LabVIEW I

FALSE
.


.
, .

.

Continue If True
( ).
, .
Continue If
True ( ).
FALSE,
-.

While ,
10.

/
While ( )

/
. /
While.
, .
.
National Instruments Corporation

4-3

LabVIEW I

While / ,
.
-
.

While.

National Instruments Corporation

4-4

LabVIEW I

4-1.
: While
, ,
, .
, .


1.

. ,
,
.

a. ,
ControlsModernNumeric.
.
, .
b. ,
ControlsModernNumeric.
.
,
.
c.
. - .
.



,
, Data Range.

0 100000
1 50.
2.

National Instruments Corporation

4-5

LabVIEW I

. Data Range.
, .
3.

Use Defaults (
).

4.

, :

a. Default Value ( ) 50.


b. Minimum Value ( ) 0
Coerce.
c. Maximum Value ( )
10000 Coerce.
d. Increment ( ) 1
Coerce to Nearest.
5.

Format and Precision ( ).


, LabVIEW

(3,14). Format&Precision
( ,
, ).
6.


Format&Precision.

National Instruments Corporation

4-6

LabVIEW I

Format&Precision.
7.

, .

Digits of Precision 0.
8.

6 7
- .

-
9.

-,

- Random Number (
),
FunctionsProgrammingNumeric.

0 1.
National Instruments Corporation

4-7

LabVIEW I

- Multiply (),

FunctionsProgrammingNumeric.
Random Number (
) 10000.
.
Multiply (),
CreateConstant.

10000.
- Round To Nearest
( ),
FunctionsProgrammingNumeric.
0 10000
.
- Not Equal? (),

FunctionsProgrammingComparison.
,
. ,
TRUE.
- While,
FunctionsProgrammingStructures.
,
Continue if True (
).

While. .
.
1.

.

.
- Increment ( 1),

FunctionsProgrammingNumeric. 1
.
, -
, , LabVIEW

- .
B
" For ( )".
10.

.vi

National Instruments Corporation

4-8

LabVIEW I


11.

12.

.
.
,
.
- ,

.

13.

,
,
.
Highlight Execution, .
, -.
,
.

14.


, 1
0 10000.

15.

. LabVIEW

.

16.

4-1

National Instruments Corporation

4-9

LabVIEW I

B. For ( )
For ( )
.
(1) For LabVIEW, (2)
- For, (3)
For.

1. LabVIEW

2. -

3.

For,

FunctionsProgrammingStructures. ,
N , ,
.
, ,
.
0.
For While , ,
N. While
.
For, ,
60 .


Wait Until Next ms Multiple, ,
, ,
, ,
. .
Wait Until Next ms Multiple
National Instruments Corporation

4-10

LabVIEW I

.
Wait Until Next ms Multiple
, ,
.
, ,
.

Wait(ms), ,
, . ,
.

National Instruments Corporation

4-11

LabVIEW I

. Express Time Delay,


FunctionsExpressExecution Control, Wait(ms).
.
6 "".
FunctionsProgrammingTiming.


LabVIEW ,
(integer): byte, word, long, : single, double,
extended precision, : single, double, extended precision.
,

.

LabVIEW


.
, N For
(long integer).
.
,
.

National Instruments Corporation

4-12

LabVIEW I

, ,
, LabVIEW
. LabVIEW
, .
, LabVIEW
.
I32 (signed 32 bit integer / 32-
) DBL (double 64 bit floating-point / 64-
)
. LabVIEW
DBL, I32 .

-

Representation.
LabVIEW
, x,5
. , LabVIEW
2,5 2, 3,5 4.
2, " "
LabVIEW Help.

National Instruments Corporation

4-13

LabVIEW I

4-2.
: .
,

.


1.

,
:

ControlsModernNumeric, -
.
,
ControlsModernNumeric.
.

-
2.

-, :

-.
FunctionsSelect a VI c:\exercises\LV Basics I. ,
DAQ. DAQ
National Instruments Corporation

4-14

LabVIEW I

, 0 DAQ , ,
() .vi
Temp Scale
CreateConstant.
FALSE TRUE
.
- Wait Until Next ms Multiple,
FunctionsProgrammingTiming.

CreateConstant. 1000.
1000 (
).
- Increment (),
FunctionsProgrammingNumeric.
1
.
3.

.vi
c: \exercises\LV\Basics I.

4.

.
,
DAQ.

5.

6.

, While.
.

7.

While.vi :\exercises\LV Basics I.

8.


9.

While ,

While ,
.

10.

c:\exercises\LV Basics I.

While-For.vi

11. .

4-2
National Instruments Corporation

4-15

LabVIEW I

.


. , ,
,
, ,
. : Shift Register
( ) Feedback Node ( ).



.

, .

.
. LabVIEW
.

Add Shift Register.
,
. ,
, .
,
.
, ,
,
, .


, .
,
.
,
, .
,
.

.
National Instruments Corporation

4-16

LabVIEW I

,
,
.
.

.


Add Element.
.
.
,

.


,

. ,
, , .


, ,
While For ,

, .
,
National Instruments Corporation

4-17

LabVIEW I

.

.
While For,
Feedback Node Structures.
,
,
.
, ,

, .
.

National Instruments Corporation

4-18

LabVIEW I

4-3.

:
For.


1.

VI,
c:\exercises\LV Basics I. , ,

-
2.

-, .
- ,
. Tools Functions, .

, For,
. Wait Until Next ms Timer
.

National Instruments Corporation

4-19

LabVIEW I

Highlight Execution (
-).
- ,
.


3.

.
, 1.
Multiply ().

, 1.
. Multiply ()
.

4.

-,
Highlight Execution.
.
.

5.

,
-:

a.

<Delete>,
.

b.


Add Shift Register.

c.

1.

d.

National Instruments Corporation

4-20

LabVIEW I

6.

. ,
.

7.

,
, .

8.

,
For, -:

a. .
b. 1.
c.
CreateIndicator.
.
9.

10. , .

4-3

National Instruments Corporation

4-21

LabVIEW I

-
,

.

While ,
.
, While ,
TRUE.

For .


-, ,
-
.
Wait Until Next ms Multiple
.
Wait .

, LabVIEW
.

.


Add Shift Register.

.

Add Element.

, .

.

National Instruments Corporation

4-22

LabVIEW I


4-4.

, ,
,
(
).
.
.vi

4-5.

,
ax 2 + bx + c = 0

a,b,c .
+/-10.
(
), .

.vi

4-6.

,
,
,

STOP.
.

. One Button Dialog,


ProgrammingDialog&User Interface, .
2.vi
4-7.

,
( 1 100) ,
: >50? .. ,
.

. Two Button Dialog,


ProgrammingDialog&User Interface, .
.vi
4-8.

, n!,
(
).
n!
C nm =
(n m )! m!
.vi

National Instruments Corporation

4-23

LabVIEW I

National Instruments Corporation

4-24

LabVIEW I

:
A.

B.

C.

D.

National Instruments Corporation

5-1

LabVIEW I

A.
.
.
. -
() (),
. , 2311
,
.
, , : ,
.
.

.
, ,
,
.
, .
,
.
6, .
.
, .
0. ,
0 (n-1), n - .
, n=9,
, 0 8.
, 2.


,
,
ControlsModernArray, Matrix & Cluster
.
.
, ,
(XY graph) .

1.

National Instruments Corporation

2.

5-2

LabVIEW I

,
-. ,
, .


(2D) .
,
. , 6
() 4 (). =
24 (64=24).



Add Dimension.
.
.
.


- ,
FunctionsProgrammingArray Array Constant
.
.

National Instruments Corporation

5-3

LabVIEW I

B.
For While
.
.

. , ,

,
.


/
Disable Indexing. , ,
, .
, For ,
LabVIEW .
While . ,
,
/
Enable Indexing.

(2D)

For, . ,
,
.

National Instruments Corporation

5-4

LabVIEW I



,
For, LabVIEW
N .
, N.
For ,
. , Run
, ,
,
.



N, N . ,
10 ,
15,
10 .

National Instruments Corporation

5-5

LabVIEW I

C.
,
FunctionsProgrammingArray.
:

Array Size -
. n-, Array
Size n . ,
Array Size 3.
7

Initialize Array - n- ,

element.
, . ,
Initialize Array
: element 4,
dimension size ( ) - 3,
, .
4

Build Array -
n- .
,
. ,
, Build Array
.
7


, ,

Concatenate Inputs.
7

Array Subset - , ,
index, , length.
,
Array Subset, 2 index 3
length,

National Instruments Corporation

5-6

LabVIEW I

Index Array - , ,
index. ,
, Index Array
2, index
0.
Index Array

.
. Index
Array index. index
, .
index ,
. ,
, .
7

Index Array
, index ()
0.
7

National Instruments Corporation

5-7

LabVIEW I

5-1
:
,
,
.


1.

, .

a.

ControlsModernArray,
.

b.

c.

ControlsModernNumeric.

d.


, 10 .

e.

<Ctrl> ,
, .

f.

National Instruments Corporation

5-8

Matrix

&

Cluster

LabVIEW I

g.


,
.

h.


,
Representation,
I32.

i.

-
2.

-, .

Random Number (0-1),


FunctionsProgrammingNumeric.
0 1.

For,

FunctionsProgrammingStructures.
10 .
10.
Array Subset,
FunctionsProgrammingArray.
, ,
,
.
3.

.vi

4.

,
.

For 10 .
.
10
.
National Instruments Corporation

5-9

LabVIEW I

,
, ,
.
, ,
,
,
.
5.

5-1

National Instruments Corporation

5-10

LabVIEW I

D.

FunctionsProgrammingNumeric, .
,
( , ). ,
Add
.
Add 2,
, ,
1

2 ,
:
3

Add ,

, .
4

Add ,
, , ,
3



.
7

.
6, .

National Instruments Corporation

5-11

LabVIEW I

.
, , :
, .
.

0. ,
0 (n-1), n
.

,
-. .

ControlsModernArray, Matrix & Cluster


.
.

For
While,
.

,
FunctionsProgrammingArray.

LabVIEW

.
For .
While .

,
( , ).

National Instruments Corporation

5-12

LabVIEW I


5-2.

,
, 100 .
, 0
99,
1
98, .

Reverse
1D
Array,

FunctionsProgrammingArray.

.vi
5-3.

,
,
.
.

.vi

5-4.

,
.vi ( 3-3).

.
Initialize Array ,
10.
,
.
,
, .
.vi

5-5.

,
, 3 10 .

.
.
2D .vi

5-6.

National Instruments Corporation

,
1 - 6
.
,
.
(shift register).
5-13

LabVIEW I

.vi
5-7

,
,
0 1 ..,
.
, {1, 23, 10, 5,
7, 11}, {23, 50, 77}.

. Decimate ID Array,
FunctionsProgrammingArray.

.vi
5-8

,
3x3.


.vi
5-9

, N=100

y (m ) =

N m

x(n)x(n + m)

n =0

.

.vi

National Instruments Corporation

5-14

LabVIEW I

National Instruments Corporation

5-15

LabVIEW I

:
A.

B.

C.

National Instruments Corporation

6-1

LabVIEW I

.
,
,
. ,
.

- / ,
.
/ 28.
28 , ,

/ . ,
,
.
, , ,
, .
Unbundle By Name,
.



ControlsModernArray,
Matrix & Cluster .
.
.
, .


,
.
0,
1 .
.
,
Bundle ()
Unbundle () -.
National Instruments Corporation

6-2

LabVIEW I

,
, ,
Reorder Controls In Cluster.
, .

1.

(Confirm button)

2.

(Cancel button)

3.

(Cluster order cursor)

4.

(Current order)

5.

(New order)
(4) ,
(5) .
Click to set to
. .
.
, Confirm .
, Cancel.
,
, .
, 0
, 1 .
0 1
.

.

, ,
.

National Instruments Corporation

6-3

LabVIEW I


- ,
FunctionsProgrammingCluster & Variant Cluster Constant
,
.
,
-, , ,
- ,
,
CreateConstant.

National Instruments Corporation

6-4

LabVIEW I

B.
,
FunctionsProgrammingCluster & Variant.
Bundle Bundle by Name
. Unbundle Unbundle by Name
.
,

Cluster Tools. Bundle Unbundle
/ . Bundle by
Name Unbundle by Name /
.



Bundle.

,

Add Input.
cluster
.
cluster
. , ,
.

,
Bundle Command,
, .

National Instruments Corporation

6-5

LabVIEW I



Bundle by Name. Bundle by Name
Bundle,

(). ,
.
.

.

Select Item.
, Bundle by Name
Command Function.

Bundle by Name
, .

, Bundle by
Name, .


Unbundle
.
Unbundle by Name
.
.

National Instruments Corporation

6-6

LabVIEW I


.

Select Item.
, Unbundle, ,
, ,
.

.
, 0.
Unbundle by Name,
,
.

National Instruments Corporation

6-7

LabVIEW I

6-1
: .
,


1.

2.

, .

a.

b.

ControlsModernArray, Matrix & Cluster


.

c.

, ,
.

d.


Change to Indicator.

e.

d
. , .


.
.
a.


, Reorder
Controls in Cluster.

National Instruments Corporation

6-8

LabVIEW I

b.

,
.

-
3.

-, .

FunctionsProgrammingCluster & Variant


Unbundle. .


.
FunctionsProgrammingCluster & Variant
Bundle.
.

National Instruments Corporation

6-9

LabVIEW I

FunctionsProgrammingCluster & Variant


Unbundle by Name.
.
.
,

Select Item.
FunctionsProgrammingNumeric
Increment. 1 .
FunctionsProgrammingBoolean
Not.
1.
FunctionsProgrammingCluster & Variant
Bundle by Name.

.
.
,

Select Item.
4.

. vi

5.

6.

7.

6-1

National Instruments Corporation

6-10

LabVIEW I

6-2
()
: ,
,
, .
. ,
, ,
.

.


1.

.vi,
C:\Exercises\LV Basics I. .

2.

-
3.

-, . ,
.

4.

5.

National Instruments Corporation

6-11

LabVIEW I

6.

7.

6-2

National Instruments Corporation

6-12

LabVIEW I

.
,
,
. ,
, . ,
.
/
. /
.
,
/, ,
, ,
.

:


LabVIEW .
, ,
. ,
/, ,
.
. LabVIEW
-.
:
, .
, - ,
.
LabVIEW
. ,
.
,
,
.
National Instruments Corporation

6-13

LabVIEW I

LabVIEW , ,
- ,
, .

Simple
Error Handler. Simple Error Handler
FunctionsProgrammingDialog & User Interface.
Error In ( ).


,
ControlsModernArray, Matrix & Cluster.
, ,
.

status ,
TRUE . ,
, ,
.
TRUE.

code 32- ,
. status
FALSE, code , , ,
, .

source ,
.


.
National Instruments Corporation

6-14

LabVIEW I



Explain Error.
Explain Error, .
Explain Warning,
, .
Explain Error Help.

While

While .
,
status TRUE FALSE.
While .

,
Stop if True Continue if True Stop on
Error Continue while Error.

National Instruments Corporation

6-15

LabVIEW I

.

.

28 ,
,
/
.



ControlsModernArray, Matrix & Cluster
.
.

,
FunctionsProgrammingCluster &
Variant.

,
.

status (), code ()


source () .

National Instruments Corporation

6-16

LabVIEW I

National Instruments Corporation

6-17

LabVIEW I

7


(Waveform Chart), (Waveform
Graph), (XY graph)
(Intensity Graph).

:
A.

B.

C.

().

D.

().

National Instruments Corporation

7-1

LabVIEW I

A.
(Waveform Chart)
.
ControlsModernGraph.
:
.

1. (Label)
2. Y (Y-scale)
3. X (X-scale)
4. (Scale legend)
5. (Graph palette)
6. (Plot legend)
:
strip chart, scope chart sweep chart. strip chart.

National Instruments Corporation

7-2

LabVIEW I


AdvancedUpdate Mode
.
strip chart , ,
. scope chart sweep chart

strip chart. scope chart
,
. sweep chart, scope chart,
,
.



.
,
.

.
Bundle,
FunctionsProgrammingCluster & Variant. , , , Bundle

.

National Instruments Corporation

7-3

LabVIEW I


Bundle.
Bundle
.

National Instruments Corporation

7-4

LabVIEW I

7-1
: While
.
,
.


1.

,
.


ControlsModernBoolean
, .
.
(Waveform Chart)
ControlsModernGraph .

.
.
, (chart
legend) Plot 0.
.
,

Y 10 90 F. 10,0
90.
National Instruments Corporation

7-5

LabVIEW I

Y -10 70 F.
Y . F, X ().

-
2.

-,
WindowShow Diagram.

3.

While, .


. Continue if
TRUE.
4.

, .
FunctionsSelect a VI .vi (C:
\exercises\LV Basics I) -.
.
- Wait Until Next ms Multiple,
FunctionsProgrammingTiming.
millisecond multiple
Wait Until Next ms Multiple
CreateConstant. 500.

500 ( ).


,
FunctionsProgrammingBoolean.
TRUE. Y 70 20 32 90.
5.

.vi.

National Instruments Corporation

7-6

LabVIEW I


6.

, Ctrl+E
WindowShow Panel.

7.

8.

.
- While ,
TRUE. ,
(TRUE),

.

9.


. FALSE
.


10.

11.

X Y:
a.


Properties. Chart Properties (
). Format and Precision
Digits of precision (
) 1.

b.

Plots Y.

c.

Scales () (Xaxis) . ,
. Multiplier
0,5 , - Wait
0,5
.

d.

Scales . F (Y-axis)
. ,
.

e.

, OK.


Data OperationsClear Chart
.

National Instruments Corporation

7-7

LabVIEW I

,
Clear Chart, .

12.


,
.
,
.
a.

, .

b.

c.


Data OperationsMake Current
Value Default.
.

d.


Mechanical ActionsLatch When
Pressed.

.
.

While -
.


13.

14.

.
,
,
.

15.

. 7-2.

7-1

National Instruments Corporation

7-8

LabVIEW I

7-2
:




.


1.

, 71.

2.

FileSave As
.vi

-
3.

-.

4.


Add Shift Register
.

5.


Add Element
.

6.

-, .

<Ctrl>,
, .
(Macintosh) <0ption>. (Sun)
<Meta>. (Linux) <Alt>.

National Instruments Corporation

7-9

LabVIEW I


.
- Compound Arithmetic,
FunctionProgrammingNumeric.

.
,
, .
- Divide,
FunctionProgrammingNumeric.
.

Divide CreateConstant .
3.
7.

8.



. ,
.
3.
. ,
.

-
9.

-, .

- Bundle,
FunctionProgrammingCluster & Variant,

National Instruments Corporation

7-10

LabVIEW I

10.

.

.
, .


11.

.
, Y.

12.

.
, .



, .
, ,
, ,
. ,
.

13.

Y.
a.


70,0 Y 75,0

b.


Y, 80,0.
Y.

National Instruments Corporation

7-11

LabVIEW I

, 75,0 77,5,
Y 2,5
77,5 80,0 , Y 5,0 (75,0 ,
80,0 , 85,0 ).
.
.
14.


Visible ItemsScale Legend,
Scale Legend, .

.

1. X
2. Y
3.
15.

16.

4. (Scale Lock)
5. (Autoscale)
6. (Scale Format)

,
plot legend.
a.

, Autoscale ,
Scale Lock . , Y

.

b.

Scale Format , ,
,
.

plot legend ,
.
a.

plot
legend .

b.



.

.

National Instruments Corporation

7-12


Plot 1
,
plot legend,

LabVIEW I

c.

17.

plot legend
, ,
.


Visible ItemsGraph Palette
Graph Palette,
. Graph Palette
.

1
(Cursor Movement).
2
(Zoom).

3
(Panning tool).
4
(Zoom pull-down
menu).


Zoom.
Panning. Cursor Movement
.
18.

.

Scale Legend Graph
Palette.


, ,
, .
19.

20.

7-2
National Instruments Corporation

7-13

LabVIEW I

B.


.
.

1.
(Plot legend)

5.
(Graph palette)

9. X (X-scale)

2. (Cursor)

6.
(Cursor mover)

10. Y (Y-scale)

7.
(Cursor legend)

11.
(Label)

3.
(Grid mark)
4.
(Mini-grid mark)

8.
(Scale legend)

(Waveform Graph)

(X-Y
Graph)

ControlsModernGraph.
, y=f(x), ,
X.
,
.

Plot legend.

National Instruments Corporation

7-14

LabVIEW I

.

.



,
X 1 x=0. ,
x, x y.
Waveform Graph VI
(examples\general\ graphs\gengraph.llb).



,
,
X 1 x=0.


,
Transpose
Array ( ).
(Y) Multi Plot 1,
Waveform Graph VI (examples\general\
graphs\gengraph llb).
,
x, x y.
y x x
x=0. (Xo,
dX, Y) Multi Plot 3, Waveform Graph VI
(examples\general\graphs\gengraph llb).

x, x ,
. ,
Y.
Bundle, . ,
Build Array .
Build Cluster Array,
.
(Xo, dX, Y) Multi Plot 2, Waveform Graph
VI (examples\general\ graphs\gengraph llb).

National Instruments Corporation

7-15

LabVIEW I



, x y.
,
, x y.
XY Graph VI
(examples\general\ graphs\gengraph llb).



,
, x y.

, .
, x y.
XY Graph VI
(examples\general\ graphs\gengraph llb).

National Instruments Corporation

7-16

LabVIEW I

7-3
: , For,

,
,
.


1.

, .

a.

,
ControlsModernArray, Matrix & Cluster.

b.

c.

,
ControlsModernNumeric,
.

d.

,
ControlsModernGraph.

-
2.

-, .

National Instruments Corporation

7-17

LabVIEW I

FunctionsSelect a VI .vi
(c:\exercises\LV Basics I), 3-2.
-.
For .
FunctionsProgrammingStructures For.

.
100.

..
Context Help, ,
Build Array Bundle.
<Ctrl+H>. ,
,
y.
x y.
, -
, Context Help ,
.
Waveform Graph
HelpFind Examples FundamentalsGraphs and Charts.

10, .

National Instruments Corporation

7-18

LabVIEW I

3.

.vi

4.

.
.

5.


. ,
(100),
.

6.


.

, .

-
- x x
, . ,
x x,
, Bundle.
7.

-, .

National Instruments Corporation

7-19

LabVIEW I

FunctionsProgrammingCluster & Variant


Bundle.
. x =20, x=0,5
y.
,
FunctionsProgrammingNumeric, x
x.
x Dx.
D
Text Settings Symbol. D
.
8.

9.


100 20 x=0,5
x. 20 50 .
x x Bundle, .
10.

, .
.


11.


Visible ItemsGraph Palette.
Zoom
.

12.


Visible ItemsScale Legend.

13.

-.
.
,
. -
.

National Instruments Corporation

7-20

LabVIEW I

Sine, Functions
MathematicsElementary & Special Function.
,
.
Build Array,
FunctionsProgrammingArray.
.

FunctionsProgrammingNumericMath Constants.

14.

15.

.
.

16.

-.

17.


, Custom

ProbeGraphWaveform
Graph

18.

.
. ,
,
.

19.

20.

.
a.

Zoom graph palette,


, ,
.

National Instruments Corporation

7-21

LabVIEW I

b.

Zoom by X Rectangle, .

c.

,
.
.

d.

Zoom by Y Rectangle Zoom by


Selected Area.

e.

Undo Zoom

x-axis scale legend, .

21.

, ,
.
x-axis y-axis
.

22.

,
, .

23.

7-3

National Instruments Corporation

7-22

LabVIEW I

7-4
:
,
0,25 10 .

. ,
,
. ,
.


1.

. , ,
.


X Scale>>Formatting,
dX 0,25 , Digits of Precision
( ) 2.


plot legend.


0 , 1 - .

National Instruments Corporation

7-23

LabVIEW I

,
. .

-
2.

-, .

FunctionsSelect a VI
c:\exercises\LV Basics I. .vi,
3-2, -.
.
FunctionsProgrammingTiming Wait
Until Next ms Multiple.
250, For
0,25.
FunctionsProgrammingArray Array
Max & Min.
.
FunctionsMathematicsProbability and Statistics
Mean VI.
.
Array Max
& Min Mean VI
CreateIndicator ., . .
FunctionsMathematicsFitting General
Polynomial Fit.
.
FunctionsProgrammingCluster & Variant
Bundle. <Ctrl>
.
National Instruments Corporation

7-24

LabVIEW I

.
x=0, =0,25
y. x=0,25 ,
0,25
.
FunctionsProgrammingArray Build
Array.
.
3.

.vi

4.



.
5.

6.

7.

a.


Plot legend Common
PlotsScatter Plot ( ).

b.

Plot legend Bar


Plots
.
.

7-4

National Instruments Corporation

7-25

LabVIEW I

7-5
: ,
.
,
Y .


1.

,
.

a.

ControlsGraph XY Graph.

b.

XY .

c.

0 Plot legend
.

d.

Plot legend
Point Style
.

e.

,
.

-
2.

-, .

National Instruments Corporation

7-26

LabVIEW I

FunctionsMathematicsElementaryTrigonometric
Sine & Cosine. ,
.
FunctionsProgrammingCluster & Variant
Bundle.
.

FunctionsProgrammingNumericMath
2.
3.

.vi

4.

5.

Constants

7-5

National Instruments Corporation

7-27

LabVIEW I

C. ()
(Intensity graphs and charts)
. ,
, .
,
,
.
,
.
.
256 .


.

43,
.



, ,
Visible Items.
,
,
.
.

National Instruments Corporation

7-28

LabVIEW I

1. Y (Y scale)
2. X (X scale)
3.
(Scale legend)

4. (Scale legend)
5.
(Graph Palette)
6. Z ( ) (Z scale (color ramp))

, ,
Marker Color
.
,
.

Add Marker .
-


.

National Instruments Corporation

7-29

LabVIEW I

7-6
()
: .
,
.
.


1.

.vi
, .
- ,
Color
Array.

2.


0 10 . .
,
.

National Instruments Corporation

7-30

LabVIEW I

3.

, .

7-6

National Instruments Corporation

7-31

LabVIEW I

D. ()

- .
, , , , ,
.
3D ,
FunctionsProgrammingGraphics & Sound3D Picture
Controls. :

Object VIs:
Create Object VI 3D .
Find Object VI 3D 3D
3D .
.
SceneObject properties SceneObject methods ,
3D .

File Loading VIs () - ,


, 3D
.

Geometries VIs
3D :
Create Cone VI .
Create Cylinder VI .
Create Box VI .
Create Sphere VI .
Create Height Field VI 3-
.
Create Mesh VI 3- .
.
SceneGeometry properties SceneGeometry methods
, 3D .
National Instruments Corporation

7-32

LabVIEW I

Transformations VIs 3D ,
, .
Helpers VIs .
, ,
(Setup Window VI), ,
(Create Clip Plane VI), (New Light VI),
3D (Texture VI) RGBA
(Color Change VI).
3D
:
- SceneWindow properties ,
.
- SceneClipPlane properties .
- SceneLight properties .
- SceneTexture properties SceneTexture methods 3D .
3D picture control LabVIEW Help.
FundamentalsGraphics and Sound VIs. ,
, ,
. labview\examples\picture\3D Picture
Control.

National Instruments Corporation

7-33

LabVIEW I

(Waveform Chart)
,
.

:
-

strip chart ,
.

scope chart,
, .

sweep chart, scope chart,


,
.

(Waveform Graph)
(XY graph) .


Build Array,
FunctionsProgrammingArray.
Bundle,
FunctionsProgrammingCluster & Variant.


.
.

,
.


Context Help.

National Instruments Corporation

7-34

LabVIEW I


7-7

, :

sweep chart. :
For (N=200) While.

.
Random Number (01), FunctionsProgrammingNumeric.

Bundle,
FunctionsProgrammingCluster &
Variant.
.vi

7-8

.
scope chart 1
. ,
,
.

.

.
.vi

7-9

, 7-8 ,

.

Max & Min,


FunctionsProgrammingComparison.
(Max-Min).vi
7-10

2
2
2
z ( x , y ) = sin c x + y .
,
.

.vi
7-11

2
2
( y = ax + b , y = ax + bx + c , y = a exp(bx ) ) XY graph

National Instruments Corporation

7-35

LabVIEW I

.
Property node.
.vi

National Instruments Corporation

7-36

LabVIEW I

National Instruments Corporation

7-37

LabVIEW I

8

,
,
. ,
Select, Case,
(Formula Node) (MathScript Node).
Formula Express VI.

:
A.

Select .

B.

Case.

C.

D.

National Instruments Corporation

8-1

LabVIEW I

A. Select
,
. , ,
. , A,
B, C D.
, ,
if else, case, switch ..
LabVIEW .
- Select.

Select
Select, FunctionsProgramming
Comparison,
. TRUE,
, t,
FALSE, f.
Select 3-3, ,
. -
.


Case.

National Instruments Corporation

8-2

LabVIEW I

B. Case.
Case, ,
.

.
,
. Case case
(if...then...else)
.
Case,
, ,
.
.
, ,
, , , ,
. , ,
, ,
.
Case.
,
TRUE FALSE.
: ,
, 231-1
.
Case
.
,

.
Case
,
,

(), .

National Instruments Corporation

8-3

LabVIEW I

Case
Select - .
Case TRUE.


Case,
.

- , ,
-.

,
, .
, , ,
, .
,

.
, LabVIEW
.
,
.
National Instruments Corporation

8-4

LabVIEW I


Case
.
,
.

.
,
, .

(). ,
.


: CreateConstant CreateControl.

,
Case
.

Case
Case.
.

,
,
TRUE, ; FALSE,
.

National Instruments Corporation

8-5

LabVIEW I

Case
Case.

Integer ring control


( ),
ControlsModernRing & Enum.
ring control 0 (), ; 1
(), .
0 () 1 (),
, .. .

Case
Case.

add,
, subtract.

National Instruments Corporation

8-6

LabVIEW I

Case
Case .

Case
Case .

Case
error out. :
,
. Case ,
.
Case status
.

National Instruments Corporation

8-7

LabVIEW I

8-1
: Case.
,
,
, .


1.

,
.

-
2.

-, :

- Case,
FunctionsProgrammingStructures.

FALSE.

- Greater or Equal to 0?,


FunctionsProgrammingComparison.
TRUE, 0.

Format & Precision.
Digits of Precision 1, Floating
Point Notation OK.
- One Button Dialog,
FunctionsProgrammingDialog & User Interface.

.
National Instruments Corporation

8-8

LabVIEW I

/ message
One Button Dialog
CreateConstant. .
9,
/.
3.

TRUE.
Square Root -,
. FunctionsProgramming
Numeric. .

4.


.vi

5.


,

.
,
TRUE
.
,
FALSE, 99999,0
.
6.

8-1

National Instruments Corporation

8-9

LabVIEW I

8-2
: Case.
,
,
.


1.

.vi,
7-2.

2.

, .

Horizontal Smooth Box,


ControlsModernDecorations.

.
.

Mechanical ActionSwitch When Pressed.
,
ControlsModernNumeric,
.
Round LED,
ControlsModernBoolean,
!
National Instruments Corporation

8-10

LabVIEW I


, ControlsModernNumeric,
.

. , Visible ItemsDigital
Display .
3.

.vi

-
4.

-, .
While ,
.

- Greater?,
FunctionsProgrammingComparison.
TRUE,
.
FALSE.
5.

FALSE, .
,
,
-99999.

National Instruments Corporation

8-11

LabVIEW I

6.

,
.

7.

, 80
.

, ,
-99999.

.
,
, !
8.

8-2

National Instruments Corporation

8-12

LabVIEW I

.
(Formula Node)
-.
,
, .

.

.
Add Input Add
Output, .
.
(;).
.
-
if then .


. ,
LabVIEW
Help.

Formula Express,
FunctionsExpressArith/Compare, , ,
LabVIEW .
, ,
. Formula Express
LabVIEW Help.

National Instruments Corporation

8-13

LabVIEW I

8-3
: .
,

.


1.

,
.

-
2.

-, :

- (Formula Node),
FunctionsProgrammingStructures.
3.

,
Add Input
. x .

4.

,
Add

National Instruments Corporation

8-14

LabVIEW I

Output .
, a.

,
.
, .
5.

(** -
).
LabVIEW Help.
a = tanh(x) + cos(x);
y = a**3 + a;

6.

.vi

7.

.
, y = f(x)3 + f(x),
f(x) = tanh(x) + cos(x).


15,0. ,
.
.
8.

8-3

National Instruments Corporation

8-15

LabVIEW I

D. (MathScript Node)

-.
,
. , ,
. ,
LabVIEW , LabVIEW
MathScript, MATLAB Xmath.
LabVIEW:

MathScript Node ,
, MATLAB, , MATLAB
. , ,
MathScript , MATLAB.
Xmath MATLAB
6.5 , ,
Xmath MATLAB.

MATLAB Xmath ,
LabVIEW

. ,
, , Xmath Script Node
MATLAB script node.
Choose Script
ServerXmath Script Node Choose Script ServerMATLAB Script
Node. MathScript Node .
National Instruments Corporation

8-16

LabVIEW I

MATLAB Script Node Xmath Script Node


FunctionsMathematicsScripts & FormulasScript Nodes.
MathScript Node FunctionsMathematicsScripts
& Formulas, FunctionsProgrammingStructures.
MathScript Node, MATLAB script node Xmath Script
Node Windows.

MathScript LabVIEW
Professional Development System.

LabVIEW MathScript
LabVIEW
LabVIEW MathScript Window.
LabVIEW MathScript Window
ToolsMathScript Window. LabVIEW MathScript Window
, ,
, ,
.
, LabVIEW MathScript
Window, MathScript Node. ,
MathScript Node,
LabVIEW MathScript Window.
LabVIEW MathScript LabVIEW
Help. FundumentalsFormulas and
Equations.

National Instruments Corporation

8-17

LabVIEW I

Select
.

Case
(). ,
.

,
: TRUE FALSE.
: , ,
231-1.




Case.

,
,
.
(;).

National Instruments Corporation

8-18

LabVIEW I


8-4. ,
:
y1 = x3 + x2 + 5
y2 = mx + b
,
(;) .
.vi
8-5. , .


: , , ,
, .

slide control.
.vi
8-6. .vi,
8-1,
.
2.vi.
8-7. ,
,
.
,
.
.vi
,
0 1 .vi

0,5.

.vi
8-8.

, :
. .

, .

National Instruments Corporation

8-19

LabVIEW I

.vi


Spectral Measurements,
FunctionsExpress.

National Instruments Corporation

8-20

LabVIEW I

National Instruments Corporation

8-21

LabVIEW I

9 -

9
/
ASCII
.
/ / ().

:
A.

B.

C.

/.

D.

E.

/ .

National Instruments Corporation

9-1

LabVIEW I

9 -

A.

ASCII .
.
:

.
ASCII,
.

,
.



,
ControlsModernString & Path.

.
.
.

Visible ItemsScrollbar.

.
.

(Normal Display)

ASCII
,
.

.
\

There are four


display types.
\ is a backslash

******************
***********
*****************

ASCII

5468 6572 6520


6172 6520 666F


(\ Codes Display)


(Password Display)

16- ASCII
National Instruments Corporation

9-2

There\sare\sfour\s
display\stypes.\n\
\\sis\sa\sbackslas
h

LabVIEW I

9 -

(Hex Display)

7572
706C
7970
5C20
2062
6C61

2064
6179
6573
6973
6163
7368

6973
2074
2E0A
2061
6B73
2E

ControlsModernList & Table


. .
.
.

1.
2.
3.
4.

5.
6.
7.


,
.
. ,
,

. , ,
.
, .

National Instruments Corporation

9-3

LabVIEW I

9 -

B.
-
,
FunctionsProgrammingString.
:

String Length ,
. , String Length 19
: The quick brown fox

Concatenate Strings
.
. ,
,
jumped

over

the

lazy

dog

Concatenate Strings :
The quick brown fox jumped over the lazy dog

String Subset length,


offset ().
0. ,
, String Subset offset=4
length=5 : quick.

Match Pattern ,
regular expression,
offset, , ,
. ,
match substring ,
offset past match (
) -1. , regular
expression ( ) :,
VOLTS DC: +1.22863E+1.
Match Pattern before substring (
) VOLTS DC, match substring ( ) :
after substring ( ) +1.22863E+1, offset past
match 9.



Build Text Express Format Into String (
). .
-
Format Into String.

National Instruments Corporation

9-4

LabVIEW I

9 -

- Build Text Express VI


-
Build
Text,

FunctionsExpressOutput .
,
-.
- Build Text -
Configure Build Text.
-
4- .
Voltage is (
).

- .
.
, Beginning Text,
.

, ..
.

Format Into String


National Instruments Corporation

9-5

LabVIEW I

9 -

Format Into String ,


, .
.
Format Into String
format
string ( ) %.4f, input string ( ) Voltage is
( ), 1.28.

% , .
, 4
, f
.

Edit Format String.
Edit Format String .

,
LabVIEW
(LabVIEW Help).



Scan From String.

National Instruments Corporation

9-6

LabVIEW I

9 -


Scan From String ,
, 0-9, +, -, e, E .,
. ,
input string ,
initial search location.
, ,
.
.
, format string %f,
initial search location 8, input string VOLTS DC+1.28E+2
128.00, .

% , f
.

Edit Scan String.

National Instruments Corporation

9-7

LabVIEW I

9 -

9-1
: .
,

.
.


1.

,
.
.

a.

2
\ Codes
Display.

b.



I32.

-
2.

-, :

National Instruments Corporation

9-8

LabVIEW I

9 -

Format Into String,


FunctionsProgrammingString.
.
a.

Format Into String


Edit Format String
.

b.

Use specified precision


4
.

c.

OK. LabVIEW %.4f ,


.

d.

,
%.4f <Shift+Enter>. ,

.

e.


\ Codes Display .
\.

Concatenate Strings,
FunctionsProgrammingString.
.
String Length,
FunctionsProgrammingString.

.
Match Pattern,
FunctionsProgrammingString.
2 : ().
f.

regular expression

National Instruments Corporation

9-9

LabVIEW I

9 -

CreateConstant,
<Shift+Enter>.
Scan from String,
FunctionsProgrammingString.
.


3.



.
3, .

4.

.vi.
.

5.


: ,

.
:
2.


.
6.

9-1

National Instruments Corporation

9-10

LabVIEW I

9 -

C. /
/
. /
FunctionsProgrammingFile I/O :

/ ().

/ () .

, .

/
, ,
: (high level File I/O),
(low level File I/O)
(advanced File I/O).

/
/
FunctionsProgrammingFile I/O.
/
. E
/ .
/

/ (). /

.
/
:
. - ,
National Instruments Corporation

9-11

LabVIEW I

9 -

,
.
/ .

/
/

FunctionsProgrammingFile I/O.
(Advanced File I/O)
FunctionsProgrammingFile I/OAdvanced File
Functions
.
/
,
.
,
.
LabVIEW II.

/
/ /
:
1.

.

LabVIEW.
LabVIEW .

.

2.

/ ().

3.

4.

Open/Create/Replace
File

, . file path (
) ,
,
.

Read File ,
refnum, data, count
.
, pos mode
pos offset, .

Write File ,
refnum. ,
pos mode pos offset ,

National Instruments Corporation

9-12

LabVIEW I

9 -

Close File refnum .



.
, Simple Error Handler VI (
), FunctionsProgrammingDialog &
User Interface. error in error out

.
LabVIEW .
LabVIEW , .
LabVIEW ,
, .
, LabVIEW
.


, ( )
/, .
,
ASCII .

LabVIEW II.

.
file path
Open/Create/Replace File VI .
.
.

Windows

, , ,
, . ,
c:\testdata\test1.dat - test1.dat
testdata

UNIX

, ,
. , /home/testdata/test1.dat
test1.dat testdata
home.
.

MacOS

, , ,
, . ,
Hard Disk:testdata:test1.dat -

National Instruments Corporation

9-13

LabVIEW I

9 -

test1.dat testdata Hard Disk

,
.
, , - .

Open/Create/Replace File VI
test1.dat. .

(refnum)
, .

, LabVIEW
.
.

. ,
,
. Open/Create/Replace File VI
Write File,
. Close File
Write
File.
Simple Error Handler VI
.
, ,
Simple Error Handler VI.

National Instruments Corporation

9-14

LabVIEW I

9 -

9-2
: .
,
, .
9-3 ,
.


1.

,
:

a.

ControlsModernString & Path


.
.

b.


Visible
ItemsScrollbar.

-
2.

-:

FunctionsSelect a VI
.vi, 9-1, . .
National Instruments Corporation

9-15

LabVIEW I

9 -

Open/Create/Replace File VI,


FunctionsProgrammingFile I/O.
.
a.

prompt
CreateConstant
.
,
.

b.

function
CreateConstant.
create or replace
.

Write File,
FunctionsProgrammingFile I/O.

Close File,
FunctionsProgrammingFile I/O. .
Simple Error Handler VI,
FunctionsProgrammingDialog & User
Interface.
.
3.

.vi.

4.


. .

5.

.txt
Save OK.

,
.
6.

9-2

National Instruments Corporation

9-16

LabVIEW I

9 -

9-3
: .
,
, 9-2,
.


7.

,

ControlsModernString & Path.

-
8.

-:

FunctionsProgrammingFile
I/O

Open/Create/Replace File VI.


,
.
a.

prompt
CreateConstant
.

b.

function
CreateConstant
.
open.

National Instruments Corporation

9-17

LabVIEW I

9 -

FunctionsProgrammingFile I/O
Read File.
, count.
FunctionsProgrammingFile I/O
Close File. .
FunctionsProgrammingDialog & User Interface
Simple Error Handler VI.
, ,
.
9.

.vi.

10.


Browse ()
.

11.

.txt Open OK.

12.

. , ,
.

13.


. .

14.

,

. .


Match Pattern.

9-3

National Instruments Corporation

9-18

LabVIEW I

9 -

D.
,
,
, .
, end of line
( ) .


end of line constant,
FunctionsProgrammingString. (Windows)
. (MacOS)
. (UNIX)
.
Format Into File ,
, ,
.
Format Into
String Build Text Express VI
Write Characters To File Write File.
Format Into File ,
.

. Format
Into String Write File.
input file
, .
-,
Open/Create/Replace File VI . For
. Format Into String
. Tab
constant () End of Line Constant ( )
.
.

National Instruments Corporation

9-19

LabVIEW I

9 -

, ()
, ()
:
00.798141
10.659364
20.581409
30.526433
40.171062

.

National Instruments Corporation

9-20

LabVIEW I

9 -

9-4
: ,
.

.

-
1.

.vi,
8-2, .vi.
.

2.

-, :

FunctionsProgrammingFile
I/O

Open/Create/Replace File VI.


.
FunctionsProgrammingTiming
Get Date/Time String.
.
want seconds?
( ?)
CreateConstant.
FALSE
TRUE.
.
- - Build Text Express VI,
FunctionsExpressOutput.
- .
National Instruments Corporation

9-21

LabVIEW I

9 -

a.

- Build Text Express VI .


%tab%temp%end%
Text with Variables in Percents.
, ,
.
, Beginning
Text.

b.

temp Configure variables.


Number Format
fractional number. tab end
, .

c.

OK.

d.

-
Build Text Express VI
View as Icon.

FunctionsProgrammingString
Tab constant End of Line constant.
- Write File
FunctionsProgrammingFile I/O.
, refnum.
FunctionsProgrammingFile I/O
Close File. .
FunctionsProgrammingDialog & User Interface
Simple Error Handler VI.

.
3.

, .

4.

.
Enter Filename.

5.

temp.txt
Save OK.

temp.txt.

, Power.
, .
6.

, , (Windows) Notepad
WordPad, (MacOS) SimpleText (UNIX) Text Editor.

7.

temp.txt.
, .

8.

LabVIEW.

National Instruments Corporation

9-22

LabVIEW I

9 -

9.

.
.


,
, While .
,
Power, .
10.

-, .

FunctionsProgrammingCluster & Variant


Unbundle by Name.
status .
FunctionsProgrammingBoolean Not
And. Not And .
Power TRUE, ,
.
11.

12.

,
Write File .
refnum
CreateConstant.

13.

. ,
- .
,
.

14.

.
, .

National Instruments Corporation

9-23

LabVIEW I

9 -

15.

Build Text Express VI Format Into String.

16.

17.

, .

9-4

National Instruments Corporation

9-24

LabVIEW I

9 -

E. /
/
/
FunctionsProgrammingFile I/O.

:

/ .


/ .


16- / .

/ :
Write to Spreadsheet File 2D 1D

.
.
.
,
.
Read From Spreadsheet File
start of read offset 2D
.
.
,
.
Read from Text File
.
.
Write to Text File
.
.
Read from Binary File , .

.
Write to Binary File .

.
New Zip File *.zip.

National Instruments Corporation

9-25

LabVIEW I

9 -

Add File to Zip zip .


Close Zip File *.zip.
(Advanced File I/O)
FunctionsProgrammingFile I/OAdvanced File
Functions.
Get File Position
.
Get File Size .
Set File Position -
.
Set File Size - .
Get Type and Creator
. ,
, ????.
Set Type and Creator -
.
Move .
Copy - .
Delete - .
File/Directory Info ,
, ,
..
Create Folder .
, .
Get Volume Info
.
List Folder
, .

National Instruments Corporation

9-26

LabVIEW I

9 -

Check if File or Folder Exists VI


.
Compare Two Paths VI
,
, .
Generate Temporary File Path VI
.tmp. ,
.
Get File Extension VI , .
MD5Checksum File VI MD5 message-digest. MD5
message-digest 128 ,
.
Recursive File List VI
LLB.

National Instruments Corporation

9-27

LabVIEW I

9 -

9-5
: 2D ,
.
9-4 ,
,
. ,
,
.


1.

.vi C:\Exercises\LV
Basics I. .

2.


2D 128 3 .
,
,
.
.
.
3.

.txt Save
OK. .

-
4.

-:

National Instruments Corporation

9-28

LabVIEW I

9 -

Sine Pattern VI, FunctionsSignal


ProcessingSignal Generation 128
, .
90,0 .

Uniform White Noise VI,


FunctionsSignal ProcessingSignal Generation
128 , .

Build
Array,

FunctionsProgrammingArray, 2D
, .


Transpose 2D Array,
FunctionsProgrammingArray, 2D
, [i,j] [j,i],
:

National Instruments Corporation

9-29

LabVIEW I

9 -

Write To Spreadsheet File VI,


FunctionsProgrammingFile I/O, 2D
.
,
,
.

Number To Fractional String,


FunctionsProgrammingStringString/Number Conversion,
,
.

5.

.

Build Array.



.
6.

, (Windows) Notepad
WordPad, (MacOS) SimpleText, (UNIX) Text Editor.

7.

.txt.
, , .

8.


LabVIEW.

9-5

National Instruments Corporation

9-30

LabVIEW I

9 -

9-6
: , : ,
, , , ,
.
, .
, ,
.vi.

1.

1

.

2.

3.

4.

, ,
, ,
, ,
.
,
, .

National Instruments Corporation

9-31

LabVIEW I

9 -

5.



.
, .

.
, 9-4.
5 ,
7-4.

9-6

National Instruments Corporation

9-32

LabVIEW I

9 -

ASCII .

,
ControlsModernString & Path.


, .

Visible ItemsScrollbar.

-
,
FunctionsProgrammingString.


Format Into String - Build Text Express VI.


Scan From String.


Format Into String
Scan From String Edit
Format String Edit Scan String.

/,

FunctionsProgrammingFile I/O.

/
FunctionsProgrammingFile I/O.

/ .

-
FunctionsProgrammingFile I/O.

FunctionsProgrammingFile I/OAdvanced
File
Functions
.


: , ,
.
: ,
.

National Instruments Corporation

9-33

LabVIEW I

9 -


file path Open/Create/Replace File VI
.

,
,
, .
, ,
Format Into File.

National Instruments Corporation

9-34

LabVIEW I

9 -


9-7.

, 2D ,
100 ,

. .
/ ,

FunctionsProgrammingFile I/O.


Write to Text File VI Write To
Spreadsheet File VI .

.vi.
9-8.

,
, ,
- .
, - end of line.
,
,

-
.

Search and Replace String.

.vi.
9-9

,
9-4, ,
.
temp.dat.
,
.

Format Into File,


Format Into String Write File.
, pos mode
pos offset Write File.
2.vi.
9-10 ,
.

file DD-MM-YY.txt, .

National Instruments Corporation

9-35

LabVIEW I

9 -

Get Date/Time String,


FunctionsProgrammingTiming.
.vi.
9-11 ,
Double
( ).

.vi.
9-12 ,
( ).
ASCII .

ASCII .

ASCII .vi.

National Instruments Corporation

9-36

LabVIEW I

9 -

National Instruments Corporation

9-37

LabVIEW I

10

10.


(DAQ) LabVIEW.
LabVIEW
Measurements Manual.

:
A.

B.

LabVIEW.

C.

D.

E.

F.

G.

-.

National Instruments Corporation

10-1

LabVIEW I

10

A.
LabVIEW ,
, DAQ-.
DAQ- :
-

(A/D),
-
(D/A), / (I/O)
/.
. , DAQ-

.
DAQ- National Instruments Product
Catalog web- ni.com/catalog.

DAQ-
DAQ. DAQ- ,
DAQ- .
DAQ-
, ,
. DAQ-

,
(Ethernet).
DAQ-.

1.
2.
3.
4. DAQ-

5.
6.
7. DAQ-

, DAQ-,
.
,
, ,
. DAQ-
DAQ-,
. ,
DAQ.
National Instruments Corporation

10-2

LabVIEW I

10

DAQ-
. DAQ-
: ,
.
DAQ- NI
NI-DAQ. NI-DAQ
National Instruments, DAQ -
(MIO) , SCXI
. NI-DAQ
, ,
, LabVIEW,
NI.
NI
National Instruments: LabVIEW, LabWindows/CVI
Measurement Studio, ,
(DDL)
ANSI C .
NI ,
:
LabVIEW LabVIEW DAQ
NI.
LabWindows/CVI ANSI C
, NI

LabWindows/CVI Data Acquisition library.


Measurement
Studio

Mirosoft Visual Studio .NET. Measurement
Studio Visual C#, Visual Basic .NET Visual C++
.NET

, MAX NI-DAQ. MAX
, DAQ. NI-DAQ :
NI-DAQ
NI-DAQmx
NI-SWITCH

National Instruments Corporation

10-3

LabVIEW I

10

NI-DAQ
NI-DAQ 6.9.
NI-DAQ. NI-DAQ /
NI-DAQ 6.9.,
NI-DAQ NI-DAQmx
. NI-DAQ

6.9.. , NI-DAQ,
NI-DAQ.

NI-DAQmx
NI-DAQmx NI-DAQ.

. NI-DAQmx
NIDAQ:
DAQ Configuration Assistant - DAQ
, DAQ LabVIEW, LabWindows/CVI Measurement Studio.
,
-,
.
DAQ-
.

NI-DAQmx LabVIEW,

waveform -.

ANSI C, LabWindows/CVI Measurement


Studio, .NET C++.
National Instruments Corporation

10-4

LabVIEW I

10

NI-SWITCH
NI-SWITCH

IVI-

,
NI. NISWITCH ,
.
NI-DAQmx.

DAQ-
DAQ, .

Windows
Windows Configuration Manager
,
National Instruments DAQ. Plug & Play (PnP)
, , MIO , Windows Configuration
Manager .
PnP,
Add New Hardware ( ) Control
Panel ( ).
Windows
Device Manager ( ),
StartSettingsControl PanelSystemDevice Manager
( ).
Data Acquisition Devices DAQ-,
.
. General
() .
Resources () ,
: (IRQ),
(DMA) -
. NI-DAQ Information
DAQ-.
DAQ- Driver ().
LabVIEW Measurement &
Automation Explorer
.
DAQ- .
Windows,
(Device Manager), DAQ. LabVIEW DAQ.


ToolsMeasurement & Automation Explorer
National Instruments Corporation

10-5

LabVIEW I

10

LabVIEW.
. Measurement & Automation Explorer
SCXI.


National Instruments, GPIB .
GPIB 11
.
, . Measurement
& Automation Explorer
Windows.
Windows DAQ-,
PnP, , PCI-6024.


NI-DAQ ,
DAQ,
. NIDAQ NI-DAQ

. NI-DAQmx channels
NI-DAQ.
NI-DAQmx ,
API. -
, ,
. ,
. , ,
. , ,
, .
NI-DAQ
National Instruments Corporation

10-6

LabVIEW I

10

, NI-DAQmx
. NI-DAQ
MAX. NIDAQmx MAX,
, , .

National Instruments Corporation

10-7

LabVIEW I

10

10-1. MAX ( Windows)


: Measurement & Automation
Explorer DAQ-,
.

Measurement & Automation Explorer
DAQ-, ,
,
DAQ.

A. DAQ-
1)
ToolsMeasurement &
Automation Explorer LabVIEW
.
National Instruments
.
2) Devices and Interfaces ( )
National Instruments.
, , PCI6024E PCI-GPIB.

,
, .
.
,
National Instruments Corporation

10-8

LabVIEW I

10

. MAX ,
, .
. DAQ-,
. Show/Hide

DAQ-.
3) Device Routes ( )
,
.
,
.

4) Calibration ()
.

National Instruments Corporation

10-9

LabVIEW I

10

5) NI-DAQmx
Self Calibrate ( )

DAQ-


.
Calibration Self Calibration.

B. DAQ-
6) Self-Test
. ,
.
, .
7) Test Panel ( )
DAQ-,
. Test Panel (
).
a) Analog Input ( )
DAQ. Dev1/ai0
. Start
. ,
. Noise
() On ()
. Stop.
b) Analog Output ( )

DAQ-.
Output Mode ( ) Sine
National Instruments Corporation
I

10-10

LabVIEW

10

Generator ( ) Start
Sine Generator ( ). LabVIEW

0.
c) DAQ-
0
1.
d) Analog Input ( )
Dev1/ai1. Start
1.
, 0.
e) Digital I/O ( /)
DAQ-.
f) 0 3
Logic Level
( ).
.
:

.
g) Close
MAX.
8) Counter I/O ( -)
DAQ-.
/ Counter Mode
( ) Simple Event Counting (
) Start.
. Stop
.
9) MAX, FileExit.

10-1

National Instruments Corporation


I

10-11

LabVIEW

10

B. LabVIEW
Functions
Measurements I/OData Acquisition FunctionsMeasurements
I/ODAQmx - Data Acqusition. Data Acquisition
, DAQmx - Data
Acqusition - NI-DAQmx.
DAQmx - Data Acqusition

- /.
,
.
. ,
,
- DAQmx Assistant. ,
- DAQmx Assistant
.
NI-DAQmx NIDAQmx LabVIEW Data Acquisition and
Signal Conditioning.
- DAQmx Assistant
DAQ-. - DAQmx
Assistant - ,
-
.
.

, -
DAQmx Assistant. -
DAQmx Assistant , .
National Instruments Corporation
I

10-12

LabVIEW

10

C.
.
: ,
, , , .

, ,

.



-: 1 , n
.

.
NI-DAQmx
.
.
,
.
,
, DAQ- ,
National Instruments Corporation
I

10-13

LabVIEW

10

.
n
n - n
.

. ,
.

,
,
.

sample rate
sample mode (finite).
.
NI-DAQmx
. ,
. ,
DAQ-.

,
,
.
sample mode (continuous).


, NI-DAQmx, ,
. -
. NIDAQmx -, .
.
Start Trigger
, .
Reference Trigger
, .
, pretrigger data.
posttrigger data.

National Instruments Corporation


I

10-14

LabVIEW

10

10-2.
: DAQ-
,
DAQ.
. , 0 DAQ.


1.

,
:

a)

Meter (
),
ControlsModernNumeric.
0.0 - 0.4.
10.0
0.4.
, ,
.

b)


vertical
toggle
switch,

ControlsModernBoolean. TRUE
Latch When Pressed
( ).

c)

OFF ON
.

-
2.

-, :

National Instruments Corporation


I

10-15

LabVIEW

10

- - DAQmx Assistant,
FunctionsMeasurements I/ODAQmxData Acquisition.
.
a.

Analog InputVoltage

b.

Dev1ai0

c.

Analog Input
Voltage Task Configuration.
Task Timing Acquire 1 Sample (
).

d.

OK .

- DAQmx Assistant.

- Wait Until Next ms


Multiple FunctionsProgrammingTiming.
100 .
- Unbundle by Name
FunctionsProgrammingCluster & Variant.
status
.
- OR
FunctionsProgrammingBoolean.
, ,

OFF.
3.

.vi
.

4.

.

.
.

5.

DAQ
, 100. ,

100. ,

-
DAQmx
Assistant

. ,
-.
National Instruments Corporation
I

10-16

LabVIEW

10

6. -
DAQmx Assistant Analog
Input Voltage Task Configuration.
7. Create New
Custom Scaling Scale Wizard.
8. Linear
temperature. Finish.
9. Scale Wizard
,
. slope
100, Engineering Units
celsius.

10. .
11. Analog Input Voltage Task Configuration
0 100 OK
-.
12. .
100 .
.
13. . ,
.

10-2
National Instruments Corporation
I

10-17

LabVIEW

10

10-3.
:
.
1.

, 10-2.

.

2.

,
Temp Sensor Noise ( ) DAQ
ON ().
.

-
3.

-.
-
100 .

4.

-
-
Collector,
FunctionsExpressSignal Manipulation.
-
.
, - Collector ,
.
100.

5.

- - Statistics,
FunctionsExpressSignal Analysis.
Arithmetic Mean
.

6.

.
.

7.

.vi .

10-3
National Instruments Corporation
I

10-18

LabVIEW

10

D.
,
DAQ-.
:

LabVIEW.
,
.

,
. LabVIEW
,
,
.

LabVIEW LabVIEW Measurement File - ASCII


,
. LabVIEW Measurement
File LabVIEW, LabVIEW,
.
- Write LabVIEW Measurement File,
FunctionsExpressOutput,
LabVIEW Measurement File. - Write
LabVIEW Measurement File -
, , .
- Read LabVIEW Measurement File,
FunctionsExpressInput,
LabVIEW Measurement File.
, -
.

National Instruments Corporation


I

10-19

LabVIEW

10

10-4.
: , LabVIEW Measurement File
, 10-3,

LabVIEW Measurement File.

-
1.

, .

2.

-
,

- - Write LabVIEW
Measurement File FunctionsExpressOutput
Export Waveforms to Spreadsheet File VI. -
. Configure
LabVIEW Measurement File :
a. Action Ask user to choose file
( ).
b. Segment Headers
One header only
.
.
c. X Value Columns
One column per channel ( )
,
.
d. Delimiter - Tab
.
e. OK .

National Instruments Corporation


I

10-20

LabVIEW

10

- Merge Errors,
FunctionsProgrammingDialog & User Interface.
-: DAQ .
,
-
.
3.

4.

.
.
logger.lvm OK.

5.


6.


, ControlsModernGraph.

National Instruments Corporation


I

10-21

LabVIEW

10

-
7.

- - Read From
Measurement
File,

FunctionsExpressInput. -
, .
Configure LabVIEW Measurement File
:
a. Action Ask user to choose
file ( ).
b.
Segment Size Retrieve segments of original size
( ).
c. Time Stamps
Relative to start of measurement (
).
,
.
d. Generic Text File Read
generic text files ( ),
LabVIEW
Measurement File.
e. OK .

National Instruments Corporation


I

10-22

LabVIEW

10

Data Available ( )
.
LabVIEW
Measurement File.
- Unbundle by Name
FunctionsProgrammingCluster & Variant.
-
FunctionsProgrammingBoolean.

OR

8.

.vi

9.

.
logger.lvm, 4.

10.

LabVIEW Measurement File


.

.
.
11.

10-4

National Instruments Corporation


I

10-23

LabVIEW

10

E.
-
.
.

DAQ-,



-: 1 , n
.

,
, . ,
,
.
.

. ,
,
.
n
n - n
.

. ,
.
National Instruments Corporation
I

10-24

LabVIEW

10


,
,
.

.
,
,
.
TTL
DAQ-.
.
.
.

. DAQ .


sample rate
sample mode (finite).
.
n
, ,
.

n
,
- .
, sample mode
(continuous).


, NI-DAQmx, ,
. -
. NIDAQmx -, .
.
Start Trigger
, .
Reference Trigger
.

National Instruments Corporation


I

10-25

LabVIEW

10

10-5.
: , DAQ
,
0 9,5 0,5 .
1.

Analog Out CH0 Analog In CH1


DAQ-.


2.

.vi ,
.

-
3.

- .

National Instruments Corporation


I

Wait Until Next ms Multiple,

FunctionsProgrammingTiming,

For Loop 500


.

Select,

FunctionsProgrammingComparison,

.
, DAQ-
. -
0
.
10-26

LabVIEW

10

4.

-,

- For - DAQmx
Assistant, FunctionsMeasurements I/O
DAQmx - Data Acquisition. - DAQmx
Assistant :
a. Analog OutputVoltage.
b. Dev1ao0.
c. Analog Output Voltage Task Configuration
Task Timing - Generate 1 Sample
( ).
0 - 10.
d. OK Analog
Output Voltage Task Configuration.
- DAQmx Assistant.
5.

6.

- ,
10-2.

7.

0.0
10.0.

8.

-
- DAQmx Assistant
Analog Input Voltage Task Configuration.

9.

Voltage
Channel List Change Physical Channel (
). ai1,
0 1 DAQ.

10.

No Scale
Custom Scaling.

11.

0 10.

12.

OK, .

National Instruments Corporation


I

10-27

LabVIEW

10

13.

14.

,
. 0 9,5
0,5 . For,
.

15.

10-5

National Instruments Corporation


I

10-28

LabVIEW

10

F.
.
,
.
:
, , .

-
. , ,
.

- , ,
.
.
- .
.
,
.
- .

- ,
.
,
/
.
.

- ,
.

,
,
.

. ,
, 24-
:
2( )- 1 = 224 - 1 = 16,777,215
24- 16,777,215, ,
.
0.

National Instruments Corporation


I

10-29

LabVIEW

10

10-6.
:
,
DAQ-.


1.

-
2.

-.

- - DAQmx Assistant,
FunctionsMeasurements I/ODAQmx - Data
Acquisition.
:
a. Counter InputEdge Count.
b. Dev1ctr0.
c. Counter Input Edge Count Task Configuration
.
0 Programmable
Function Input (PFI) 8. DAQ 0
Programmable Function Input (PFI) 8.
d. OK Counter Input
Edge Count Task Configuration.
- DAQmx Assistant.
3.

.vi

4.

DAQ-
SOURCE 0.

National Instruments Corporation


I

10-30

LabVIEW

10

5.

, quadrature encoder knob


DAQ-. ,

,
. .

6.

7.

DAQ-
Up/Down 0.

. -
DAQmx Assistant Externally Controlled
Count Direction. OK
.

8.

. quadrature encoder knob


DAQ-. ,

,
.

9.

10-6

National Instruments Corporation


I

10-31

LabVIEW

10

G.

, .
,
,
.
-
,
.
DAQ-
.
.

.
LabVIEW.
DAQ-
.
.

.
LabVIEW.

National Instruments Corporation


I

10-32

LabVIEW

10

10-7.
: DAQ-
,
0 DAQ-
, .
DAQ-.
0, 1, 2, 3, .
.

.
, ,
, .
.
1.

Digital Example,
C:\Exercises\LV Basics I, -.

- While - DAQmx
Assistant,

FunctionsMeasurements
I/ODAQmx - Data Acquisition.
:
a. Digital I/OPort Output.
b. Dev1port0.
c. Digital Output Port Task Configuration
Invert All Lines In Port (
), .
d. OK Digital Output
Port Task Configuration. DAQmx Assistant.
.
Array Subset .
,
0 .
Boolean Array
to Number - DAQmx Assistant
.
National Instruments Corporation
I

10-33

LabVIEW

10

2.
3.
4.

.
.
,
DAQ-.
.

10-7

National Instruments Corporation


I

10-34

LabVIEW

10

MAX
DAQ-.
- DAQmx Assistant DAQ .
- DAQmx
Assistant.

,
,
- DAQmx Assistant.
DAQmx Assistant
- .

National Instruments Corporation


I

10-35

LabVIEW

10


10-8.
2
. ,
LED
LED 0 DAQ-.
,
.
c LED.vi

National Instruments Corporation


I

10-36

LabVIEW

10

National Instruments Corporation


I

10-37

LabVIEW

11

11

LabVIEW
, GPIB
. /

- Instrument I/O Assistant.

:
A.

B.

GPIB- .

C.

Instrument I/O Assistant.

D.


VISA.

E.

F.

G.

H.

().

National Instruments Corporation

11-1

LabVIEW I

11

.
LabVIEW
,

.
LabVIEW

,
, GPIB, VXI, PXI, Ethernet,
SCSI CAMAC.
: GPIB .

:

-
.

:
,
.

: ASCII-,
.

National Instruments Corporation

11-2

LabVIEW I

11

B. GPIB-
ANSI/IEEE Standard 488.1-1987, General
Purpose Interface Bus (GPIB),
(,
..) .
,
. GPIB 8-

1 / . 3
. GPIB ,
, 14-
. ANSI/IEEE Standard 488.2-1992
IEEE 488.1 ,
.
GPIB

.


.
GPIB 24- , 8-
, 5- (ATN, EOI, IFC, REN,
SRQ), 3- 8- .
GPIB
, ..
,
. 1 ,
ASCII.

GPIB
GPIB- GPIB-
GPIB- 0 30. 0
GPIB-. ,
GPIB-, 1 30. GPIB (talker) ,
(listener) , ,
(controller). , ,
, .
GPIB-
. GPIB
.


GPIB- :
National Instruments Corporation

11-3

LabVIEW I

11

GPIB (EOI)
.
.

end-of-string (EOS)
.

EOI.


, .

,
EOI EOS
( ),
. ,
,
.

, GPIB, ,
.
:


4 ,
2 .

20 .

,
15,
.

,
15 .

,
bus extender,
bus
expander. National
Instruments.

GPIB
Web-: ni.com/support/gpibsupp.htm.
National Instruments Corporation

11-4

LabVIEW I

11


LabVIEW
GPIB-
DAQ. GPIB-
,
LabVIEW CD,
ni.com/support/gpib/versions.htm.
,
GPIB- LabVIEW.
(Windows) MAX (Measurement &
Automation Explorer)
GPIB. MAX
,
Windows.
(DLL)
GPIB-.
Instrument I/O
.

(Windows)
(MacOS UNIX)
GPIB-
GPIB.
MAX
National Instruments.
, ,
,
, .
MAX

LabVIEW ToolsMeasurement & Automation Explorer.
Configuration MAX
My System:

Data Neighborhood
,
, Devices and Interfaces,
10, .

Devices and Interfaces


,
, , ,
.

IVI Instruments
IVI,
IVI.

National Instruments Corporation

11-5

LabVIEW I

11

Scales
,
,
, .

Historical Data
.

Software
National Instruments, .

VI Logger Tasks , ,
VI Logger.

MAX
Scan for Instruments .

Remote Systems Configuration


,
RT Series PXI Controllers. , MAX,

National Instruments Corporation

11-6

LabVIEW I

11

11-1 GPIB MAX


( Windows)
: GPIB- MAX,

.
1.

NI Instrument Simulator
GPIB- ,
.

2.

NI Instrument Simulator ,
Power Ready.

3.

MAX

ToolsMeasurement & Automation Explorer LabVIEW.

4.

Devices and Interfaces,


. GPIB-
, NI-488.2
.

5.

GPIB- Properties

Properties.

6.

, GPIB-
OK.

7.

, Devices and Interfaces


GPIB-, Scan for Instruments
.

8.

GPIB-board.
Instrument0.

9.

Instrument0
MAX.
NI Instrument Simulator GPIB (PAD),
2.

Instrument0
Show/Hide
MAX.
National Instruments Corporation

11-7

LabVIEW I

11

10.

Communicate
with
Instrument
. ,
,
.

11.

*IDN? Send String


Query. String
Received.
,
.

12.

MEAS:DC? Send String


Query. NI Instrument Simulator
.

13.

Query,
.

14.

Exit.

15.

VISA (VISA alias) NI Instrument Simulator.


, ,
.

16.

a.

MAX Instrument0
VISA Properties
Properties.

b.

devsim VISA alias


OK.
.

FileExit
MAX.

11-1

National Instruments Corporation

11-8

LabVIEW I

11

C. Instrument I/O Assistant


Instrument I/O Assistant,
FunctionsExpressInput FunctionsInstrument I/O, LabVIEW. -
,
, .
-
. Instrument I/O Assistant ,
.
Instrument I/O Assistant
-. Instrument I/O
Assistant. ,
Instrument I/O Assistant.

- Instrument I/O Assistant


.
1.

. , MAX
Select an instrument.

2.

Code generation type. VISA


,
GPIB.

3.

Add
Step:

National Instruments Corporation

11-9

LabVIEW I

11

Query and Parse *IDN?


.

Write .

Read and Parse


.

4.


Run Sequence
- .

5.


Instrument I/O Assistant.

LabVIEW / Instrument I/O Assistant


- ,
.
, Instrument I/O Assistant,
Instrument I/O Assistant
Open Front Panel.
.
-.
,
, .

National Instruments Corporation

11-10

LabVIEW I

11

11-2
Instrument I/O Assistant
:

, Instrument
GPIB-.

I/O

Assistant

,
, NI Instrument Simulator.


1.

2.

-
.

-
3.

-, .

- - Instrument I/O
Assistant, FunctionsExpressInput.
-
.
a.

devsim Select an Instrument.


VISA Code Generation
Code Generation Type.

b.

Add Step. Query and


Parse Instrument Simulator.

c.

*IDN? , \n
Termination Character Run this Step.

, .

National Instruments Corporation

11-11

LabVIEW I

11

d.

Auto
Parse.

, Outputs
token. ,
. token,
ID String Token name.
e.

Add Button. Query


and Parse. MEAS:DC?
Run this Step.

f.

Auto
Parse. .
token Voltage Token name.

g.

OK I/O Assistant
-.

ID String
CreateIndicator.
Voltage
CreateIndicator.
Error Out Simple Error Handler VI.
4.

.
.

National Instruments Corporation

11-12

LabVIEW I

11

5.

.vi

6.

I/O Assistant
Show Front Panel. OK ,
.

7.

, I/O Assistant.
*IDN?, Instrument Simulator?
?

8.

FileExit .
.

11-2

National Instruments Corporation

11-13

LabVIEW I

11

D.
(VISA)
Virtual Instrument Software Architecture (VISA)
,
.

1993 National Instruments


GenRad, Racal Instruments, Tektronix Wavetek
VXIplug&play.
VXI
.

/.
VXIplug&play
, .

VXIplug&play :

VISA /
VXIplug&play,
. VISA

. API,
. VISA
VXI, GPIB, ,
. VISA
.
VISA
. VISA,
, ,
VISA .
National Instruments Corporation

11-14

LabVIEW I

11

LabVIEW VISA ,
GPIB, , VXI
, .
/
. ,
. ,
,
FunctionsInstrument I/OGPIB,
. VISA
.
LabVIEW VISA
/.

VISA
, , .
, ,
. VISA
,
:

Resource ,
.

Session VISA-
.
LabVIEW VISA,
.

VISA.

Instrument Descriptor .
(GPIB, VXI, ASRL), (
) VISA- (INSTR Event).

,
, .
,
.
.

ASRL[board][::INSTR]
(Asynchronous serial)
GPIB

GPIB[board]::primary
address[::secondary address][::INSTR]

VXI
MXIbus

VXI[board]::VXI logical
address[::INSTR]

GPIB-VXI

GPIB-VXI[board][::GPIB-VXI primary
address]::VXI logical address[::INSTR]

National Instruments Corporation

11-15

LabVIEW I

11

, MAX,
. (MacOS) visaconf.ini
VISA. (UNIX) visaconf.
, Instrument I/O Assistant
,
.
VISA VISA Write VISA Read.

, .
, VISA Write VISA
Read.

National Instruments Corporation

11-16

LabVIEW I

11

11-3
VISA
: , VISA
NI Instrument Simulator.
,
NI Instrument Simulator VISA.
1.

, Instrument Simulator
GPIB.


2.

. -
.

-
3.

-, .

- VISA Open,
FunctionsInstrument I/OVISAVISA Advanced.
VISA- .
resource name
CreateControl.
- VISA Write,
FunctionsInstrument I/OVISA.
National Instruments Corporation

11-17

LabVIEW I

11

.
write buffer
CreateControl.
- VISA Read,
FunctionsInstrument I/OVISA.
.
byte count
CreateControl. read
buffer CreateControl.
- VISA Close,
FunctionsInstrument I/OVISAVISA Advanced.
VISA-
.
- Simple Error Handler VI,
FunctionsProgrammingDialog & User
Interface.
.
4.

VISA.vi

5.

. devsim resource
name byte count 200
, . *IDN?
write buffer .

6.

Instrument Simulator
,

7.

11-3

National Instruments Corporation

11-18

LabVIEW I

11

E.

,
.
.
LabVIEW

.
LabVIEW
, GPIB, VXI, PXL
.
,
,
.
, ..
/ -
. ,
, ,
.
LabVIEW
LabVIEW CD.
National Instruments www.ni.com/idnet.

\labview\instr.lib. LabVIEW

FunctionsInstrument I/OInstrument Drivers.

Getting Started Example ( )


,
.
Getting Started Example. GPIB- (
VISA) , MAX.

National Instruments Corporation

11-19

LabVIEW I

11

F.


IEEE 488.2, .



. ,
, ,
/, TCP/IP ..

/ 7 /.
.

.

,
.
:

Initialize - .
,

.

Configuration - ,
.

Action/Status . Action VIs

National Instruments Corporation

11-20

LabVIEW I

11


. Status VIs
.
, Action VIs Acquire Single Shot.
Status VIs Query Transfer Pending.

Data /
,
( )
.

Utility , ,
, .

Close
.

National Instruments

: ,
,
,
, ,
.


LabVIEW ,
,
. ,
: ,
.
. ,
,

.

/
,
/ .



(instrument descriptor)
(resource name). ,

:
Interface Type[board index]::Address::INSTR
[ ].
, GPIB::2::INSTR GPIB 2.
VISA resource name control,
ControlsModernI/O, DAQ channel name control,
.
National Instruments Corporation

11-21

LabVIEW I

11

VISA , VISA
.

MAX,
11-1.
VISA (VISA alias). ,
, ,
.
VISA, , devsim
GPIB::2::INSTR.

VISA
Initialize VI
VISA. VISA ,
.
, , ,
VISA session
.
Close VI ,
.


-, ,
devsim.
, :
.
.
, ,
.

National Instruments Corporation

11-22

LabVIEW I

11

11-4
: ,
DevSim
,
NI Instrument Simulator
1 ,
.

.
.


1.

FileNew,

TemplateFrameworksSingle Loop Application


Single Loop Application VI.

2.

, .

VISA resource name,


ControlsModernI/O.
x
0 20.

-
3.

-, :

National Instruments Corporation

11-23

LabVIEW I

11

,
Add
Shift Register .
- NI DEVSIM Initialize VI,
FunctionsInstrument I/OInstrument
DriversNI Device Simulator.
LabVIEW NI Instrument Simulator.
k.

ID Query
CreateConstant.

FALSE.

l.

Reset .

- NI DEVSIM Multimeter
Configuration VI, FunctionsInstrument
I/OInstrument DriversNI Device SimulatorConfiguration.
,
NI Instrument Simulator.
0,0 10,0 .
- NI DEVSIM Measure DC Voltage
VI, FunctionsInstrument I/OInstrument
DriversNI Device SimulatorData.
NI
Instrument Simulator.
- NI DEVSIM Close VI,
FunctionsInstrument I/OInstrument
DriversNI Device Simulator.
LabVIEW NI Instrument Simulator.
- Max & Min,
FunctionsProgrammingComparison.


.
National Instruments Corporation

11-24

LabVIEW I

11

- Simple Error Handler VI,


FunctionsProgrammingDialog & User
Interface.
.
- Unbundle by Name,
FunctionsProgrammingCluster &
Variant. status .
- Or,
FunctionsProgrammingBoolean.
While.
, .
- Time Delay Express VI
1 .
/
.
, : instrument descriptor, VISA session
/ .
4.

.vi

5.

, NI Instrument Simulator .

6.

. Listen () Talk ()
1 ,
LabVIEW .
,
.

7.

11-4

National Instruments Corporation

11-25

LabVIEW I

11

G.

,

.

. ,
.
,

,
- .

1
RS-232

2 RS-232
(- )

(baud rate)

(parity bit)

- (stop bits)

,
(start bit),
(data bits), ( ),
. m.

,
National Instruments Corporation

11-26

LabVIEW I

11

, .
RS-232
, MARK ( )
SPACE ( ).

, , .
MARK , SPACE .
,
. RS-232
:
> +3 V = 0
< -3 V = 1
+12 -12 .
( +3 -3 )
.
.
(MARK)
(SPACE).
. 9600 ,
0,104 .
(11 ) 1,146 .

. (LSB least
significant bit), (MSB most significant bit).

, 1
, 0 - .
1101101 6D
. ASCII m.
,
. : 1 ; 0 - .
.
, .
,
, .

. 5, .. ,
0.
1, 1,5 2 .
.
,
(MARK).
(SPACE)
.
National Instruments Corporation

11-27

LabVIEW I

11

?
,
1
.
.
11.
9600 ,
9600/11 = 872 .
.

.


,
.

RS-232
RS-232 Electronic Industries Association (EIA)

Data Terminal Equipment (DTE)
Data Communications Equipment (DCE). RS-232
( ),
(),
( )
.

RS-232C.
( )
,
. RS-232
IBM- .

RS-449, RS-422, RS-423

RS-449, RS-422 RS-423


EIA .
RS-232. RS-449 1975
RS-232,
. RS-449
, RS-422 RS-423. RS-232
,
, RS-422,
,
( ). RS-232C
,
, 1, RS-422

. RS-422
,
National Instruments Corporation

11-28

LabVIEW I

11

.
Macintosh RS-422, RS-423
RS-422

RS-232.
RS-422 RS-423
RS-422 15 .

RS-232
, ,
: DCE DTE. DCE ,
, .. DTE
.
RS-232
: 25- 9- (D-Type 25-pin
connector D-Type 9-pin connector).
.
9- ,
.

(Function)

(Signal)


(Data)

(Handshake)

(Common)

(Other)

DTE

DCE

TxD
RxD
RTS
CTS
DSR
DCD
DTR
Com

(PIN)
3
2
7
8
6
1
4
5

Output
Input
Output
Input Input
Input
Output
-

Input
Output
Input
Output
Output
Output
Input
-

RI

Input

Output

9- (DB-9)
.
RS-232.
DB-9 3- 2-
. 25- (DB-25), ,
2- 3-.
DTE DCE.
25- (DB-25)
National Instruments Corporation

11-29

LabVIEW I

11

RS-232. ,
.

Function

Signal

PIN

DTE

DCE

Data

TxD
RxD
RTS
CTS
DSR
DCD
DTR
Com

2
3
4
5
6
8
20
7

Output
Input
Output
Input
Input
Input
Output
-

Input
Output
Input
Output
Output
Output
Input
-

Handshake

Common



FunctionsInstrument I/OSerial.
VISA (VISA Write VISA Read),
GPIB-,
, .
,
VISA
Configure Serial Port VI.
VISA Configure Serial Port VI
, VISA resource name,
.

timeout

. baud rate, data bits, parity flow control


.
error in error out ,
.
,
*IDN?
COM2.
VISA Configure Serial Port VI
COM2 : 9600 ,
8 , (odd parity),
XON/XOFF. VISA Write
. VISA Read 200
, Simple Error Handler VI
.

National Instruments Corporation

11-30

LabVIEW I

11

FunctionsInstrument I/OSerial,
. VISA resource name
LPT. ,
MAX LPT1
VISA ASRL10::INSTR.

National Instruments Corporation

11-31

LabVIEW I

11

11-5

: , RS-232
,
NI Instrument Simulator.

NI Instrument Simulator
1.

NI Instrument Simulator
, .

= 9600.

= 8.

= 1.

(hardware handshaking).

(Handshaking)
.
. ,
XON XOFF .

. RTS CTS
RS-232
.
.
2.

NI Instrument
Simulator .
.

3.

NI Instrument Simulator. Power, Ready Listen ,


.

National Instruments Corporation

11-32

LabVIEW I

11

-
4.

-,
.

- - Instrument I/O Express


VI, FunctionsInstrument I/O.
-
Instrument I/O Assistant.
a.

COM1 ( COM2 ,
NI Instrument Simulator)
Select an instrument.

b.

Add Step Query and


Parse. *IDN? , \n
Termination Character.

c.

Run this Step,

National Instruments Corporation

11-33

LabVIEW I

11

Auto Parse.
.
d.

token Token
name.

e.

Add Step Query and


Parse. *IDN? , \n
Termination Character.

f.

Run this Step ,


Auto Parse.
NI Instrument Simulator.

g.

token String Token name.

h.

Run Sequence .

i.

OK -.

String
CreateIndicator .
String Length
CreateIndicator .
error out Simple Error Handler VI.
a.

b.

.vi

c.

11-5

National Instruments Corporation

11-34

LabVIEW I

11

H. ()

ASCII .
,
,
ASCII .
,
ASCII .

ASCII
, 1024 ,
0 255. ASCII
4 (3
1 , ). ,
4096 (4 * 1024) ,
ASCII
.
ASCII .
CURVE

{12,28,63,...1024 }

(6 )

( 4 )

CR

( 2 )

ASCII
Extract Numbers VI,
FunctionsUser LibrariesBasics I Course, .


1024 . :
(1 * 1024) ,
.
1 ,
.. .
1-
.
CURVE %

(7 )

{MSB}{LSB}

(4 )

{A,a...1024 }

{Chk} CR


( 1- )
(3 )


National Instruments Corporation

11-35

LabVIEW I

11

. .
,
FunctionsProgrammingStringString/Array/Path Conversion.


.
.


,
Type Cast,

FunctionsProgrammingNumericData
Manipulation.
LabVIEW II.
, GPIB-
. 1024 ,
2 .
2048 .
, 4- , 2-
linefeed.

{(HB1,LB1),...1024 } CR

(4 )

( 2 )

F

(2 )

LFCRLB1024HB1024...LB2HB2LB1HB1ATAD
GPIB

A
A
LB1
LB2
.
LB1024
LF

D
T
HB1
HB2
.
HB1024
CR

- Type Cast

16- () .

National Instruments Corporation

11-36

LabVIEW I

11


Swap Bytes,
FunctionsProgrammingNumericData Manipulation. GPIB 8-
.
,
Swap Bytes.
, ,
, .
Swap Bytes,
.

National Instruments Corporation

11-37

LabVIEW I

11

11-6
()
: , ,
ASCII
.
ASCII 128 .
ASCII ,
. ASCII :
CURVE {12,28,63,...128 points in total...,}CR LF.
128
. 1- .
:
CURVE % {Bin Count MSB}{Bin Count LSB}{aaAA...128 bytes in
total...} {Checksum} CR LF.
,
, .
NI Instrument Simulator
.

NI Instrument Simulator
1.

NI Instrument Simulator
GPIB-, .

GPIB- 2.
2.

NI Instrument Simulator. - Power


Ready , GPIB .


3.

Waveform Example VI. ,


.

National Instruments Corporation

11-38

LabVIEW I

11


: ASCII .
, :
GPIB NI
Instrument Simulator.

-
4.

-, .

National Instruments Corporation

11-39

LabVIEW I

11

String
Subset,

FunctionsProgrammingString, 128
, 5-
.
.
String to Byte Array,
FunctionsProgrammingStringString/Array/Path
Conversion,

.

String
Length,

FunctionsProgrammingString,
.
Extract Numbers VI, FunctionsUser
LibrariesBasics I Course,
ASCII .
, , .
VISA Write VISA Read,
FunctionsInstrument I/OVISA, NI
Instrument Simulator
ASCII 1- .
Simple Error Handler VI, Functions
ProgrammingDialog & User Interface,
.
5.

.
TRUE Case

. FALSE
ASCII .

6.

ASCII
.
ASCII ,
,
.

7.


, ,
.

.
,
,
.
8.

, .

11-6
National Instruments Corporation

11-40

LabVIEW I

11

LabVIEW
.

MAX
GPIB-,
, .

LabVIEW
.

LabVIEW
LabVIEW CD. Web- www.ni.com
National Instruments.

VISA
, VXI, GPIB, RS-232
.


- Instrument I/O Assistant.
VXI-, GPIB-, RS-232- .



,
.


. ASCII
,
. LabVIEW
,

National Instruments Corporation

11-41

LabVIEW I

11


1-1

NI DEVSIM Getting Started VI,


11-2, NI
Instrument Simulator .

1-2

, 114. - ,
.txt ,
.

.vi

National Instruments Corporation

11-42

LabVIEW I

11

National Instruments Corporation

11-43

LabVIEW I

12

12

,
LabVIEW.

:
A.

B.

C.

D.

E.

().

F.

National Instruments Corporation

12-1

LabVIEW I

12

A.
,
. ,
..
.

FileVIProperties.
VI
Properties . VI Properties
.
LabVIEW
II.
Category
VI Properties.
.

General , ,
, , , ,
.
.

Documentation
.
3-3.

Security
.

Window appearance
.

Window Size .

Execution
.


, ,
Window appearance Category
VI Properties.
, .
, ,
, . ,
.

Same as VI Name Window Title.
National Instruments Corporation

12-2

LabVIEW I

12


, . -
.

Top-level Application Window ,


,

,
, .

Dialog
, ..
LabVIEW, .
,
. (UNIX)
.
, ,
, .
, .
,
. -
<Enter> <Return>, LabVIEW
.

Default , LabVIEW.

Custom ,
Customize.


,
, Window appearance
Category VI Properties.
:

Minimum Panel Size


. Window appearance
,
.

Size the Front Panel to the Width and Height of the Entire Screen
,
.
,
.

Maintain Proportions of Window for Different Monitor Resolutions


,

. ,

National Instruments Corporation

12-3

LabVIEW I

12

1024*768,
800*600 .

Scale All Objects on Front Panel as the Window Resizes



.
, .. .
,
.

National Instruments Corporation

12-4

LabVIEW I

12

B.


.
,
,
,
.
.
,
.

SubVI Node Setup.

VI
Properties.




SubVI Node
Setup. Show Front
Panel when called Close afterwards if originally closed.
:

Open Front Panel when loaded


, .

Show Front Panel when called


.

Close afterwards if originally closed Show Front Panel


when called , ,

.

Suspend
when
called

.
, OperateSuspend when
called.

National Instruments Corporation

12-5

LabVIEW I

12



FileVI Properties.
VI Properties Window appearance
Category, Customize
Show Front Panel when called Close afterwards if originally
closed.

National Instruments Corporation

12-6

LabVIEW I

12

12-1

: .
,
0,5 10 ,

, .


1.

, .

a.


.

Visible
ItemsDigital Display.

b.


I32.

-
2.

-, .

a.

- ,
3-3.
.

National Instruments Corporation

12-7

LabVIEW I

12

b.

- Wait Until Next ms


Multiple,

Functions
ProgrammingTiming. For
500 .

c.

Multiply,

FunctionsProgramming
Numeric. 0,5
x, ..
.

d.

- ,
C:\Exercises\LV Basics I.
.

3.

.vi

4.

,
.

5.

a.

,
.

b.

FileVI Properties.

c.

Window appearance
Category.

d.

Customize. ,
.

e.

OK, .
,
.

. 10
,

National Instruments Corporation

12-8

LabVIEW I

12

.
.

DONE

6.


Pop-up Graph VI Dialog.

7.

8.

.
,
, ,
.

9.

12-1

National Instruments Corporation

12-9

LabVIEW I

12

C.

<Tab>.
,
. ,
.
, LabVIEW ,
. ,
<Enter>.
,
,
.
AdvancedKey Navigation
Key Navigation.
AdvancedKey Navigation
,
.

Key Assignment. ,
Current Assignments,
.
,
<Tab> Skip this control when
tabbing.

National Instruments Corporation


I

12-10

LabVIEW

12

12-2
:


.

,
.


1.

,
C:\Exercises\LV Basics I. .

.
Latch when Pressed.


.
.
While
- .
STOP Latch When Released.

, ,
.

.
.
.
2.


AdvancedKey Navigation
Key Navigation.

3.

Key Assignment
, .

4.

2 3 .

-
5.

-.

National Instruments Corporation


I

12-11

LabVIEW

12

6.


500
strip chart.


500 ,
strip chart .


, .

,
.
a.


SubVI Node Setup.

b.

Show Front
Panel when called Close afterwards if originally closed.

c.

a b .

7.

. .

8.


.
<Enter>.
<Enter>
.

9.

10.


.
a.

FileVI Properties.

b.

Execution Category.

c.

Run When Opened.

National Instruments Corporation


I

12-12

LabVIEW

12

11.

,
.
a.

Window appearance
Category.

b.

Customize.

c.

Show Menu Bar Show Tool


Bar When Running.

d.

OK.

12.

13.

.
.
.

14.

12-2

National Instruments Corporation


I

12-13

LabVIEW

12

D.
,
. , Run When
Opened .
, LabVIEW
, .
.
LabVIEW
Quit LabVIEW, FunctionsProgramming
Application control.
LabVIEW.
. , LabVIEW
TRUE. ,
LabVIEW .
,

. FileSave with Options.

Development Distribution.
vi.lib. .
-
.
Remove diagrams .
, ,
. ,
-, -.
,
, 12-3
.

National Instruments Corporation


I

12-14

LabVIEW

12

12-3
: , .
,
LabVIEW .


1.

,
C:\Exercises\LV Basics I.
.

.
, ,
.
2.

Start. 10
LabVIEW.

3.

LabVIEW .

4.

5 13, ,
, ,
.
, ,
,
- . , ,
- Add
. , .
,
. ,
Run .
.

5.

- .

6.

. .

National Instruments Corporation


I

12-15

LabVIEW

12

-
, .
7.

OperateChange to Edit Mode.


, .

8.

Unlock. .
, FileVI
Properties Category Security.

9.

- Quit LabVIEW.

10.

.
, .

11.

12.

13.

12-3

National Instruments Corporation


I

12-16

LabVIEW

12

E.
()


. ,
, .




Functions Controls user.lib.
LabVIEW FunctionsUser Libraries ControlsUser
Controls ,
(.llb) (.mnu) user.lib,
user.lib. LabVIEW
.
FunctionsInstrument I/O instr.lib.

Functions.

Functions Controls
.



. LabVIEW
: , -.
Options
Functions Controls.
Controls/Functions Palette Options
Palette View.
Format ,
(text-only)
(icon-only).

ToolsAdvancedEdit Palette Views.
Edit Controls and Functions Palette
Palette view.

LabVIEW LabVIEW
Help.

National Instruments Corporation


I

12-17

LabVIEW

12

F.

(Shared
Variables)
LabVIEW 7.x
, ,
(global variables) (local variables) .

.
LabVIEW 8.0 :
(shared variables). ,

.
LabVIEW
( DataSocket),
.
, , .


LabVIEW.
,
, ,
NewVariable.
. .
,
, LabVIEW
.

(Shared Variable Refnum) .
, ,
, (Reference).


.

, ,
.

National Instruments Corporation


I

12-18

LabVIEW

12

, ,
network-published.
(Control) c ,

.
(Control)
. Control
Properties. ,
Data Binding, Control .
, Control,

.


(shared variable node) ,
, .
,
(time stamp) .

-
.
, Shared
Variable FunctionsProgrammingStructures.
-
, ,
Shared Variable
Select Variable .
Select Variable,
.


,
. , networkpublished ,
.
Shared Variable Properties
Single Writer. ,
,
; . ,
,
.
National Instruments Corporation
I

12-19

LabVIEW

12



, LabVIEW
,
. ,
,
, . ,
, .
,
.
Shared Variable Properties Use Buffering.


LabVIEW , ,
.
Variable Manager,
ToolsShared VariableVariable Manager.

National Instruments Corporation


I

12-20

LabVIEW

12

12-4


: , :
.
.

,
.

1.

.
Project Explorer, LabVIEW,
FileNew Project,
.

2.

.
FileNew VI,
, My
Computer.

3.

Generator.vi,
Oscilloscope.vi. ,

save.

4.

.
a. My
Computer NewVariable.
Shared Variable
Properties.
b. Name.

National Instruments Corporation


I

12-21

LabVIEW

12

c. Data Type Double.


d. Variable Type NetworkPublished.
e. Use Buffering, Bind to Source Single Writer
.
f. OK.

Generator.vi

1.

Generator.vi

2.

a. Knob
ControlsModernNumeric ControlsExpress
Numeric Controls.
b. .
National Instruments Corporation
I

12-22

LabVIEW

12

c.
0 20, 0 10.
3.

STOP.
ControlsModernBoolean.

Mechanical ActionLatch When Released.

-
4.

-,
WindowShow Diagram.

5.

-, :

a.

- While Loop,

FunctionsProgramming
Structures. ,
Stop
If True.
STOP.

b. - Formula Node,
FunctionsProgrammingStructures,
,
.
c. Wait Until Next ms Multiple,
FunctionsProgrammingTiming.

CreateConstant. 50.
d. - .
Shared Variable
FunctionsProgrammingStructures.

Select Variable
,
National Instruments Corporation
I

12-23

LabVIEW

12

. OK.

Change
To Write.
e.
-.
6.

Oscilloscope.vi

7.

Oscilloscope.vi

8.


Waveform Chart, ControlsModernGraph.
Y
AutoScale Y.
Y -10 10. X
0 100.

9.

STOP.
ControlsModernBoolean.

Mechanical ActionLatch When Released.

-
10.

-,
WindowShow Diagram.

11.

-, :

National Instruments Corporation


I

12-24

LabVIEW

12

a. - While Loop,
FunctionsProgrammingStructures.
,
Stop If True.
Waveform Chart STOP.

b. Waveform Chart
National Instruments Corporation
I

12-25

LabVIEW

12

.
,
Properties.
Data Binding.
: Data Binding Selection
Shared Variable Engine (NI-PSP), Access
Type Read Only. , Browse
,
. OK.
c.
-.
12.

.
1.

Oscilloscope.vi .

2.

Generator.vi .

,
.
3.


Generator.vi, ,
Oscilloscope.vi.

4.

Generator.vi, STOP
.

5.

Oscilloscope.vi, STOP
.

12-4.

National Instruments Corporation


I

12-26

LabVIEW

12


VI Properties File.

VI Properties.




SubVI Node Setup.
Show Front Panel when called Close afterwards if
originally closed.


File VI Properties.
VI Properties Window
appearance Category,
Customize Show Front Panel when called Close
afterwards if originally closed.

,

AdvancedKey Navigation.

, ,

. FileSave
with Options.

.
,
.

, .


Functions Controls
user.lib.

Options
Functions Controls.
Controls/Functions Palette Options
Palette View.

Format ,
(text-only)
(icon-only).

National Instruments Corporation


I

12-27

LabVIEW

12

(Shared Variable),

.
LabVIEW.
, ,
,
NewVariable.


, -.

National Instruments Corporation


I

12-28

LabVIEW

12

National Instruments Corporation


I

12-29

LabVIEW

Вам также может понравиться