搜档网
当前位置:搜档网 › LabVIEW入门指南

LabVIEW入门指南

本文由zoomsky1988贡献
pdf文档可能在WAP端浏览体验不佳。建议您优先选择TXT,或下载源文件到本机查看。
w
页码,1/9(W)
LabVIEW入门指南
LabVIEW入门指南手册用于帮助用户熟悉LabVIEW图形化编程环境,掌握LabVIEW创建数据采集和仪器控制应用程序的基本功能。
手册所包含的练习便于用户学习如何在LabVIEW中开发基本的应用程序。这些练习只需花费较短时间,从中可掌握LabVIEW的基本使用。 关于更多帮助文件的文档信息,见LabVIEW文档资源。
(Windows) 如需查看相关主题,单击本窗口上方工具栏左侧的定位按钮。LabVIEW帮助的目录栏中将高亮显示该主题,以便查看相关内
容。
LabVIEW简介
LabVIEW(Laboratory Virtual Instrument Engineering Workbench)是一种用图标代替文本行创建应用程序的图形化编程语言。传统文本编程语言根 据语句和指令的先后顺序决定程序执行顺序,而LabVIEW则采用数据流编程方式,程序框图中节点之间的数据流向决定了VI及函数的执行顺序。VI 指虚拟仪器,是LabVIEW的程序模块。 LabVIEW提供很多外观与传统仪器(如示波器、万用表)类似的控件,可用来方便地创建用户界面。用户界面在LabVIEW中被称为前面板。前面板 创建完毕后,便可使用图形化的函数添加源代码来控制前面板上的对象。在程序框图上添加图形化代码,即G代码或程序框图代码。因此又被称作程
序框图代码。 如需开发特定程序,可购买各类附加软件工具包。所有工具包都可与LabVIEW无缝集成。
(Windows) 如需查看相关主题,单击本窗口上方工具栏左侧的定位按钮。LabVIEW帮助的目录栏中将高亮显示该主题,以便查看相关内
容。
LabVIEW VI模板、VI范例和工具
初学者可借助LabVIEW VI模板、VI范例和工具设计和创建VI。
LabVIEW VI模板
LabVIEW内置VI模板中包括用来创建一般测量应用程序所必需的子VI、函数、结构和前面板对象。VI模板打开为[模板名称] #.vi,其中,模板名称 是模板的名称,#是唯一的十进制数字。请选择文件?新建打开新建对话框,对话框中列出了所有的内置VI模板。或在启动窗口中单击新建,打开新
建对话框。 应用程序设计模式见VI?基于模板?框架下的设计模式目录。程序设计模式是指软件设计中针对某个问题特定解决方案所采用的LabVIEW架构和技 术。 也可创建自定义VI模板。
LabVIEW VI范例
LabVIEW在数百个VI范例中搜索出需用到的VI,并将这些VI整合到您创建的VI中。用户可修改范例使其适合某种应用,或将一个或多个范例复制并 粘贴到创建的VI中。请选择帮助?查找范例查看或搜索VI范例。
关于其它VI范例,

请访问NI开发者园地。 在LabVIEW帮助VI和函数主题页面的下方单击打开范例和查找相关范例按钮,也可访问VI范例。单击打开范例可打开与该主题相关的VI范例。单击 查找相关范例可打开NI范例查找器,显示相关VI范例。 也可在程序框图或锁定选板中右键单击VI或函数,在快捷菜单中选择 范例,打开帮助主题,其中包含了该VI或函数的范例链接。
用于DAQ配置的LabVIEW工具(Windows)
使用LabVIEW中的MAX配置测量设备。选择工具?Measurement & Automation Explorer打开MAX,配置NI硬件及软件。 注: 只有安装了MAX,Measurement & Automation Explorer选项才可用。 关于管理其它类型仪器的相关信息见仪器控制。 使用DAQ助手可在图形化界面上完成通道或常见测量任务的配置。只有安装了NI-DAQmx,DAQ助手Express VI才会在函数选板上显示。关于安装 NI-DAQmx的详细信息见DAQ入门指南。可通过下列方式打开DAQ助手:
? ?
在程序框图上放置DAQ助手Express VI。 右键单击一个DAQmx全局通道控件,从快捷菜单中选择新建通道(DAQ助手)。右键单击一个DAQmx任务名控件,从快捷菜单中选择新建任 务(DAQ助手)。右键单击DAQmx标尺名控件,从快捷菜单中选择新建换算(DAQ助手)。 打开MAX,在配置树形目录下选择数据邻居或换算。单击新建按钮。配置NI-DAQmx通道、任务或换算。
虚拟仪器简介
LabVIEW程序又称虚拟仪器,即VI,其外观和操作均模仿现实仪器,如示波器和万用表。每个VI都使用函数从用户界面或其它渠道获取信息输入,
然后将信息显示或传输至其它文件或计算机。
VI由以下三部分构成:
? ?
前面板-即用户界面。 程序框图-包含用于定义VI功能的图形化源代码。 图标和连线板-用以识别VI的接口,以便在创建VI时调用另一个VI。当一个VI应用在其它VI中,则称为子VI。子VI相当于文本编程语言中的子 程序。
(Windows) 如需查看相关主题,单击本窗口上方工具栏左侧的定位按钮。LabVIEW帮助的目录栏中将高亮显示该主题,以便查看相关内
容。
前面板
如下所示的前面板是VI的用户界面。
file://C:\Users\monix\AppData\Local\Temp\~hhB829.htm
2010/3/9
w
页码,2/9(W)
前面板由输入控件和显示控件组成。这些控件是VI的输入输出端口。输入控件是指旋钮、按钮、转盘等输入装置。显示控件是指图表、指示灯等显 示装置。输入控件模拟仪器的输入装置,为VI的程序框图提供数据。显示控件模拟仪器的输出装置,用以显示程序框图获取或生成的数据。
程序框图
前面板创建完毕后,便可使用图形化的函数添加源代码来控制前面板上的对象。程序框图

是图形化源代码的集合,图形化源代码又称G代码或程序框 图代码。前面板上的对象在程序框图中显示为接线端。 下列VI中含有接线端、函数和连线等程序框图对象。
接线端
接线端用以表示输入控件或显示控件的数据类型。在程序框图中可将前面板的输入控件或显示控件显示为图标或数据类型接线端。默认状态下,前 面板对象显示为图标接线端。如:旋钮接线端代表前面板上的一个旋钮,如下所示。
接线端底部DBL代表的是双精度浮点数数据类型。如下所示的DBL接线端代表一个双精度浮点数输入控件。
接线端是在前面板和程序框图之间交换信息的输入输出端口。在前面板输入控件中输入的数据(如上述前面板中的a和b)通过输入控件接线端进入 程序框图。然后,数据进入加和减函数。加减运算结束后,输出新的数据值。数据将传输至显示控件接线端,更新前面板显示控件中的数据(如上 述前面板中的a+b和a-b)。
节点
节点是程序框图上的对象,具有输入输出端,在VI运行时进行运算。节点相当于文本编程语言中的语句、运算符、函数和子程序。上述程序框图中 的加、减函数即是节点。
file://C:\Users\monix\AppData\Local\Temp\~hhB829.htm
2010/3/9
w
页码,3/9(W)
连线
程序框图中对象的数据传输通过连线实现。在上述程序框图中,输入控件和显示控件接线端通过连线实现加减运算。每根连线都只有一个数据源, 但可以与多个读取该数据的VI和函数连接。不同数据类型的连线有不同的颜色、粗细和样式。断开的连线显示为黑色的虚线,中间有个红色的X。出 现断线的原因有很多,如试图连接数据类型不兼容的两个对象时就会产生断线。
结构
结构是节点的一种,是文本编程语言中的循环和条件语句的图形化表示。使用程序框图中的结构可对代码块进行重复操作,有条件执行或按特定顺 序执行代码。
图标和连线板
创建VI的前面板和程序框图后,请创建图标和连线板,以便将该VI作为子VI调用。图标和连线板相当于文本编程语言中的函数原型。每个VI都显示 为一个图标,位于前面板和程序框图窗口的右上角,如下图所示。
图标是VI的图形化表示,可包含文字、图形或图文组合。如果将一个VI当作子VI使用,程序框图上将显示代表该子VI的图标,如将VI添加至选板, VI图标也将出现在函数选板上。双击前面板或程序框图窗口的图标,可进行自定义或编辑。 注: 推荐用户自己定制VI图标,但这个操作不是必须的。使用默认的LabVIEW图标不会影响功能。 如需使用子VI,还需要创建连线板,如下所示。

连线板用于显示VI中所有输入控件和显示控件接线端,类似于文本编程语言中调用函数时使用的参数列表。连线板标明了可与该VI连接的输入和输 出端,以便将该VI作为子VI调用。连线板在其输入端接收数据,然后通过前面板的输入控件传输至程序框图的代码中,并从前面板的显示控件中接 收运算结果传输至其输出端。 注: 一个VI的接线端应尽量控制在16个以内。接线端太多将影响VI的可读性和可用性。
使用和自定义VI和子VI
创建一个VI,设定图标和连线板,该VI即可作为子VI调用。 保存VI为单独的文件,也可将多个VI集合保存在LLB中。 也可自定义VI的外观和运行方式。可为所创建的每个VI创建自定义菜单,也可以设定显示或隐藏菜单栏。
DAQ入门指南
在LabVIEW中进行NI-DAQmx测量介绍如何使用“DAQ助手”在LabVIEW中进行NI-DAQmx测量。教程中的练习帮助您学习如何在LabVIEW中使用 “DAQ助手”创建和编辑一个电压测量任务并根据任务生成代码。 关于传统NI-DAQ (Legacy)和NI-DAQmx的选用,见NI-DAQ 8.x概述。 注: (Windows) LabVIEW支持NI-DAQmx和DAQ助手。(Mac OS) LabVIEW支持NI-DAQmx Base,但不支持DAQ助手。(Linux) LabVIEW支持NI-DAQmx,但不支持DAQ助手。
NI-DAQ 8.x概述
National Instruments的所有测量设备均附带NI-DAQ驱动软件,该软件提供了范围广泛的函数及VI,可从LabVIEW调用,从而对NI测量设备进行编 程。测量设备包括各种DAQ设备,如E系列多功能I/O(MIO)设备、SCXI信号调理模块、开关模块等。驱动软件有一个应用程序编程接口(API),包括 了用于创建某特定设备的相关测量应用所需的VI、函数、类及属性。 NI-DAQ 8.x包含在软件驱动程序的最新版本中,称为NI-DAQmx。NI-DAQmx取代了传统NI-DAQ(Legacy)。NI-DAQmx和传统NI-DAQ(Legacy)均 有各自的API、硬件和软件配置。
注: (Windows) LabVIEW支持NI-DAQmx和DAQ助手。(Mac OS) LabVIEW支持NI-DAQmx Base,但不支持DAQ助手。(Linux) LabVIEW支持NI-DAQmx,但不支持DAQ助手。关于NI-DAQ软件支持的平台的更多信息,见NI-DAQ自述文件。
NI-DAQmx (Windows, Linux)
NI-DAQmx是最新的NI-DAQ驱动,与传统NI-DAQ(Legacy)相比具有下列优点:
(Windows) DAQ助手,可图形化配置设备的虚拟通道和测量任务,然后基于这些虚拟通道和任务生成NI-DAQmx代码。 ?
速度更快,包括更快的单点模拟I/O和多线程。
NI-DAQmx的仿真设备便于应用程序的测试和修改,无需连接实际的硬件。 ? API更为简洁直观,与之前版本NI-DAQ相比,创建DAQ应用所需的函数和VI更少。 ? ?
支持的LabVIEW的功能更多,可使用属性节点和波形数据类型。 支持LabVIEW RT模块,且速度更快。
传统NI-DAQ (Legacy)
传统NI

-DAQ(Legacy)是对更早版本NI-DAQ的升级。与NI-DAQ 6.9.x版相比,传统NI-DAQ(Legacy)包含相同的VI和函数,功能也相同,不同之处在 于传统NI-DAQ(Legacy)可与NI-DAQmx运行在同一台计算机上,对某些硬件不再支持。(Windows Vista) Windows Vista不支持传统NI-DAQ (Legacy)。
NI-DAQmx的使用条件
如符合下列任一条件,请安装和使用NI-DAQmx:
file://C:\Users\monix\AppData\Local\Temp\~hhB829.htm
2010/3/9
w
页码,4/9(W)
? ?
从未使用过NI-DAQ。 目前使用的设备受NI-DAQmx支持。关于支持NI-DAQmx支持的设备,见NI-DAQ自述文件中的列表。 目前使用Windows Vista/XP/2000或Linux。 注: (Mac OS)LabVIEW支持在Mac OS平台上使用NI-DAQmx Base。如需下载NI-DAQmx Base驱动,请访问National Instruments网 站。(Linux)关于NI-DAQmx支持的Linux版本,请访问NI网站。
传统NI-DAQ (Legacy)的使用条件
请尽可能使用NI-DAQmx。如符合下列任一条件,请安装和使用传统NI-DAQ (Legacy):
? ?
使用的设备NI-DAQmx不支持,如AT E系列多功能DAQ设备。 使用的LabVIEW版本早于7.0。 正从NI-DAQ 6.9.x进行升级且不希望现有应用程序被导入NI-DAQmx。 注: 传统NI-DAQ(Legacy)所能支持的最早NI应用程序版本为6.0。LabVIEW 6.x和7.x版可使用NI-DAQ 8.x版中随附的传统NI-DAQ (Legacy)。
Taking an NI-DAQ?mx Measurement in LabVIEW?
August 2009, 370689L-01 This tutorial teaches you how to take an NI-DAQmx measurement in NI LabVIEW 2009 or later using the DAQ Assistant. The DAQ Assistant is a graphical interface for configuring measurement tasks, channels, and scales. You also can use the DAQ Assistant to generate NI-DAQmx code from the task. In this tutorial, you create a voltage measurement task using the DAQ Assistant. You then learn how to edit the task and generate code from the task in LabVIEW. Note This tutorial assumes you are familiar with LabVIEW. If you are a new user of LabVIEW or are unfamiliar with the LabVIEW Express VIs, refer to the Getting Started with LabVIEW manual. This document describes NI-DAQmx. For information on Traditional NI-DAQ (Legacy), refer to the Measurement and Automation Explorer Help for Traditional NI-DAQ (Legacy). To navigate this help file, use the Contents, Index, and Search tabs to the left of this window. To comment on National Instruments documentation, refer to the National Instruments Web site. ? 2003–2009 National Instruments Corporation. All rights reserved.
Conventions
This help file uses the following conventions: ? The ? symbol leads you through nested menu items and dialog box options to a final action. The sequence File?Page Setup?Options directs you to pull down the File menu, select the Page Setup item, and select Options from the last dialog box. This icon denotes a tip, which alerts you to advisory information. This icon denotes a note, which alerts you to i

mportant information. This icon denotes a caution, which advises you of precautions to take to avoid injury, data loss, or a system crash. bold dark red green italic Bold text denotes items that you must select or click on in the software, such as menu items and dialog box options. Bold text also denotes parameter names, emphasis, or an introduction to a key concept. Text in this color denotes a caution. Underlined text in this color denotes a link to a help topic, help file, or Web address. Italic text denotes variables or cross references. This font also denotes text that is a placeholder for a word or value that you must supply.
monospace Text in this font denotes text or characters that you should enter from the keyboard, sections of code, programming examples, and syntax examples. This font is also used for the proper names of disk drives, paths, directories, programs, subprograms, subroutines, device names, functions, operations, variables, filenames, and extensions.
Introduction to Taking an NI-DAQmx Measurement in LabVIEW
This tutorial teaches you how to take an NI-DAQmx measurement in NI LabVIEW 2009 or later using the DAQ Assistant. The DAQ Assistant is a graphical interface for configuring measurement tasks, channels, and scales. You also can use the DAQ Assistant to generate NI-DAQmx code from the task. In this tutorial, you create a voltage measurement task using the DAQ Assistant. This tutorial teaches you how to:
Launch the DAQ Assistant by using the DAQ Assistant Express VI in LabVIEW ? Configure a voltage task in the DAQ Assistant ? Test the task using test panels ? Edit the task ? Generate the code to run the task
Note This tutorial assumes you are familiar with LabVIEW. If you are a new user of LabVIEW or are unfamiliar with the LabVIEW
file://C:\Users\monix\AppData\Local\Temp\~hhB829.htm
2010/3/9
w
页码,5/9(W)
Express VIs, refer to the Getting Started with LabVIEW manual. Next: Before You Begin
Before You Begin
To use this tutorial, you must have the following software and hardware installed in your system:
NI LabVIEW 2009 or later ? NI-DAQmx from NI-DAQ 8.x or later, including LabVIEW 2009 or later support files ? A data acquisition (DAQ) device, physical or simulated, that is supported by NI-DAQmx and is connected to a voltage signal. Refer to
the Measurement & Automation Explorer Help for NI-DAQmx for instructions on creating an NI-DAQmx simulated device. Refer to the NI-DAQmx Readme file to see if NI-DAQmx supports your device. Refer to the DAQ Getting Started Guide and the device documentation for information about installing and configuring the software and hardware. Previous: Introduction to Taking an NI-DAQmx Measurement in LabVIEW Next: Channels and Tasks in NI-DAQmx
Channels and Tasks in NI-DAQmx
A physical channel is a terminal or pin at which you can measure or generate an analog or digital signal. A virtual channel is a collection

of property settings such as a name, a physical channel, input terminal connections, the type of measurement or generation, and can include scaling information. In NI-DAQmx, virtual channels are integral to every measurement. In Traditional NI-DAQ (Legacy) and earlier versions, configuring virtual channels is an optional way to record which channels are being used for different measurements. In NI-DAQmx, you can configure virtual channels with the DAQ Assistant, which you can open from MAX or your application software. You also can configure virtual channels with the NI-DAQmx API in your application program. In Traditional NI-DAQ (Legacy), you configure virtual channels using MAX. A task, an important concept for NI-DAQmx, is a collection of one or more virtual channels with timing, triggering, and other properties. Conceptually, a task represents a measurement or generation you want to perform. You can set up and save all of the configuration information in a task and use the task in an application. In NI-DAQmx, you can configure virtual channels as part of a task or separate from a task. Virtual channels created inside a task are local virtual channels. Virtual channels defined outside a task are global virtual channels. You can create global virtual channels in MAX or in your application software and then save them in MAX. You can use global virtual channels in any application or add them to a number of different tasks. If you modify a global virtual channel, the change affects all tasks in which you reference that global virtual channel. Previous: Before You Begin Next: 1. Launch the Assistant
1. Launch the DAQ Assistant Express VI
You can launch the DAQ Assistant in several ways. Complete the following steps to launch the DAQ Assistant by placing the DAQ Assistant Express VI on the block diagram in LabVIEW. 1. 2. Open a blank VI in LabVIEW. Place the DAQ Assistant Express VI on the block diagram.
The DAQ Assistant launches, starting with the Create New dialog box. Previous: Channels and Tasks in NI-DAQmx Next: 2. Create the Task
2. Create the Task
In the Create New Express Task dialog box of the DAQ Assistant, complete the following steps to create a task to measure voltage from the DAQ device. 1. 2. 3. 4. 5. Select Acquire Signals. Select Analog Input for the I/O type. Select Voltage for the measurement to perform. In Supported Physical Channels, select the physical channel on the DAQ device to which you connected the voltage signal. Click Finish.
The DAQ Assistant task configuration screen launches. Previous: 1. Launch the DAQ Assistant Next: 3. Configure the Task
3. Configure the Task
After you create a task, you can configure channel-specific settings such as custom scaling, input range, and terminal configuration. You also can configure task-specific settings such as timing and triggering. To configure the voltage measurement task, complete the following steps. 1. 2. Specify the input range. You c

an use the default values. Select the terminal configuration you used to connect the signal.
file://C:\Users\monix\AppData\Local\Temp\~hhB829.htm
2010/3/9
w
页码,6/9(W)
3.
Under Timing Settings, select N Samples as the Acquisition Mode. Enter 100.00 for Samples To Read, and enter 1000.00 for Rate (Hz), as shown in the following figure.
Note This example does not use custom scaling or triggering. To learn about scaling and triggering, refer to the NI-DAQmx Help. Previous: 2. Create the Task Next: 4. Test the Task
4. Test the Task
You can view data acquired in the DAQ Assistant to test the task and signal connection. Click Run to test the task. Data acquired appears in the graph. Verify that you are acquiring expected data and that you connected the signal properly. If necessary, modify any settings and run your task again.
file://C:\Users\monix\AppData\Local\Temp\~hhB829.htm
2010/3/9
w
页码,7/9(W)
Click OK when you finish testing your task. Previous: 3. Configure the Task Next: 5. Edit the Task
5. Edit the Task
If you want to make changes to your task later, you can open the task using the DAQ Assistant Express VI in LabVIEW. Complete the following steps to edit the voltage task to acquire data continuously: 1. 2. Double-click the DAQ Assistant Express VI on the block diagram in LabVIEW. When the DAQ Assistant launches, select Continuous Samples for the Acquisition Mode.
3. 4.
Click OK. Save the VI as MyVoltageTask.vi. Next: 6. Generate Code
Previous: 4. Test the Task
6. Generate Code
Using the DAQ Assistant, you have three options for generating code in LabVIEW from a task or channel: Example—Generates all the code necessary to run the task or channel, such as VIs needed to read or write samples, VIs to start and stop the task, loops, and graphs. Choose this option if you want to run the task or channel you created to verify that it works or to use your configuration in a simple application. In LabVIEW, this option adds to the VI you are working in. The generated code is a simple NI-DAQmx example that you can then modify for your application. Configuration—Generates the code that replicates the configuration of the tasks and channels. LabVIEW replaces the DAQmx task name control with a subVI that contains VIs and property nodes used for channel creation and configuration, timing configuration, and triggering configuration used in the task or channel. Choose this option if you want to deploy your application to another system. Refer to Deployment in the NI-DAQmx Help located at Start?All Programs?National Instruments?NI-DAQ for more information. When you generate Configuration code, the link between the application and the DAQ Assistant is lost. Any changes you make to the configuration code are not reflected in the DAQ Assistant. You can regenerate Configuration code from the DAQ Assistant, but the regenerated code does not incorpo

rate previous changes that you made to the code. Caution Although generated configuration code includes code to create virtual channels and tasks, it does not include code to create scales. If you generate configuration code for deployment of applications that include scales, you must ensure that the scales are configured in the target computer. Refer to Deployment in the NI-DAQmx Help located at Start?All Programs?National Instruments?NI-DAQ for more information. Configuration and Example—Generates both Configuration code and Example code for the task or channel in one step. Tip If you configure a task using the DAQ Assistant Express VI, you can right-click the VI and select Generate NI-DAQmx Code to generate configuration and example code. The code replaces the DAQ Assistant Express VI.
Complete the following steps to generate code to run the voltage task. 1. 2. Right-click the DAQ Assistant Express VI on the block diagram, and select Generate NI-DAQmx Code from the shortcut menu. The DAQ Assistant generates all the code necessary to run the task, as shown in the following block diagram.
file://C:\Users\monix\AppData\Local\Temp\~hhB829.htm
2010/3/9
w
页码,8/9(W)
3. 4.
Save the VI as MyVoltageTask.vi. Display the front panel. Click the Run button to start the application. Note Any changes you make to the generated code apply only to the VI and are not saved into the task configuration stored in MAX.
Previous: 5. Edit the Task
Next: What's Next
What's Next
In this tutorial, you learned how to
Launch the DAQ Assistant by using the DAQ Assistant Express VI in LabVIEW ? Configure the task in the DAQ Assistant ? Test the task using test panels ? Edit the task ? Generate the code to run the task
Related Documentation
The following documents contain information that you might find helpful as you use NI-DAQmx and LabVIEW:
DAQ Assistant Help—This help file contains information about using the DAQ Assistant to interactively configure common measurement
tasks, channels, or scales. In LabVIEW 2009 or later, LabWindows?/CVI? 7.x or later, or Measurement Studio 7.x or later, you also can use the DAQ Assistant to generate NI-DAQmx code from the tasks and channels. to confirm that the device is operating properly.
DAQ Getting Started Guide—This guide describes how to install NI-DAQmx driver software and data acquisition (DAQ) devices and how ? Getting Started with LabVIEW—This manual contains information you use to familiarize yourself with the LabVIEW graphical
programming environment and the basic LabVIEW features you use to build data acquisition and instrument control applications. Select Start?All Programs?National Instruments?LabVIEW?Search the LabVIEW Bookshelf.
LabVIEW Help—This help file contains information about LabVIEW palettes, menus, tools, VIs, and functions. This help file also includes
step-by-step instructions for using LabVIEW fea

tures. In LabVIEW, select Help.
Measurement & Automation Explorer Help for NI-DAQmx—This help file contains information on configuring and testing DAQ devices,
SCXI devices, SCC devices, and RTSI cables using Measurement & Automation Explorer (MAX) for NI-DAQmx and information about special considerations for operating systems. In MAX, select Help?NI-DAQmx.
To learn more about tasks, channels, and other NI-DAQmx concepts, refer to the NI-DAQmx Help located at Start?All Programs?National Instruments?NI-DAQmx Help. The LabVIEW Help also includes information about creating and using tasks in LabVIEW and reference information for the NI-DAQmx VIs. You also can look atthe examples that ship with NI-DAQmx. Use the NI Example Finder located at Help?Find Examples to search for examples related to NI-DAQmx. Previous: 6. Generate Code
Launching the DAQ Assistant
When you configure a task using the DAQ Assistant Express VI, the task is local to the application and is not saved to MAX for use in other applications. The DAQ Assistant Express VI contains the code you need to run the task, except any loops. You must convert the DAQ Assistant Express VI to an NI-DAQmx Task to save the task to MAX for use in other applications. You can also generate code from the DAQ Assistant Express VI. Right-click the DAQ Assistant Express VI on the block diagram in LabVIEW and select Generate NI-DAQmx Code. To launch the DAQ Assistant from a task name control in LabVIEW, complete the following steps: 1. 2. 3. Open a blank VI in LabVIEW. Place the DAQmx task name control from the DAQmx Name Controls palette on the front panel. Right-click the control and select New NI-DAQmx Task?MAX from the shortcut menu.
You can launch the DAQ Assistant from MAX in the following ways:
Right-click Data Neighborhood and select Create New from the shortcut menu. In the Create New window, select NI-DAQmx
Task.
Right-click your device under Devices and Interfaces in MAX and select Create New.
file://C:\Users\monix\AppData\Local\Temp\~hhB829.htm
2010/3/9
w
页码,9/9(W)
Converting the DAQ Assistant Express VI to an NI-DAQmx Task
When you configure a task using the DAQ Assistant Express VI, the task is local to the application and cannot be used in other applications. You can convert a DAQ Assistant Express VI to an NI-DAQmx task if you want to save the task to MAX for use in other applications or to generate code. Note If you are working within a project in LabVIEW 2009, converting the DAQ Assistant Express VI to a task saves the task to the project. Complete the following steps to convert the DAQ Assistant Express VI to an NI-DAQmx task. 1. 2. 3. 4. Right-click the DAQ Assistant Express VI and select Convert to NI-DAQmx Task from the shortcut menu. The DAQ Assistant launches, and you can modify the task, if necessary. Click the OK button. An NI-DAQmx task replaces the DAQ Assistant Express VI.
file://C:\Users\moni

x\AppData\Local\Temp\~hhB829.htm
2010/3/9

本TXT由“文库宝”下载:https://www.sodocs.net/doc/6814347464.html,/wenkubao

相关主题