LabWindowsCVI教程(1)PPT课件

合集下载

labwindows-CVI-教程

labwindows-CVI-教程

l a b w i n d o w s-C V I-教程本页仅作为文档封面,使用时可以删除This document is for reference only-rar21year.MarchLabWindows/CVI基础教程序言LabWindows/CVI是National Instruments公司推出的一套面向测控领域的软件开发平台。

它以ANSI C为核心,将功能强大,使用灵活的C语言平台与数据采集,分析和表达的测控专业工具有机地接和起来。

它的集成化开发平台,交互式编程方法,丰富的控件和库函数大大增强了C语言的功能,为熟悉C语言的开发人员建立检测系统,自动测量环境,数据采集系统,过程监控系统等提供了一个理想的软件开发环境。

本教程面向的是那些从未使用过LabWindows/CVI的读者,但是假设读者以有了C语言的基础并且熟悉Windows 2000/9x/NT操作系统。

在每一章节的学习中,作者都是通过一个具体的实例让读者迅速的掌握本章的知识点;而不是长篇大论,述及边枝细叶,反而使读者望而却步,只见树木,不见森林。

想信通过对本教程的学习,读者可迅速掌握LabWindows/CVI编程思想及步骤,为读者日后进一步学习打下基础。

本书约定:“File>>Page Setup>>Options”File 这一种黑色斜体字是指多级菜单名,按扭名,窗口名或者是关键性词汇。

“>>”是指打开一个多级菜单或对话框。

如:File>>Page Setup>>Options是指你首先打开File 菜单,然后选择Page Setup项,最后从弹出的对话框中选择Options 项。

“说明:通过这种方式你可以修改Panel顶端所显示的名字。

”该种字体所写的文字是值得读者注意并记忆的内容。

“该椭圆形框所框住的内容是读者需修改的地方。

第一部分 CVI快速入门本部分通过编制一个简单的LabWindows/CVI程序,使读者对CVI编程环境,思想及步骤有一初步的认识。

LabWindows CVI教程

LabWindows CVI教程

第一章 : LabWindows/CVI1.1 LabWindows/CVI1.1.1 LabWindows/CVI概述LabWindows/CVI是美国NI(National Instruments)公司开发的面向计算机测控领域的虚拟仪器软件开发平台,可以在多种操作系统(WindowsXP/Vista/7、Mac OS和Unix)下运行。

LabWindows/CVI 是为C 语言程序员提供的集成开发环境(IDE),在此开发环境中可以利用C语言及其提供的库函数来实现程序的设计、编辑、编译、链接、调试。

使用LabWindows/CVI 可以完成以下但不限于以下工作:·交互式的程序开发;·具有功能强大的函数库,用来创建数据采集和仪器控制的应用程序;·充分利用完备的软件工具进行数据采集、分析和显示;·利用向导开发IVI 仪器驱动程序和创建ActiveX 服务器;·为其它程序开发C 目标模块、动态连接库(DLL)、C 语言库。

图 1‐1 LabWindows/CVI界面LabWindows/CVI 的功能强大在于它提供了丰富的函数库。

利用这些库函数除可实现常规的程序设计外,还可实现更加复杂的数据采集和仪器控制系统的开发。

数据采集。

IVI库、GPIB/GPIB 488.2库、NI-DAQmx库、传统的NI-DAQ库、RS-232库、VISA库、VXI库以及NI-CAN库。

数据分析。

格式化IO库、分析库以及可选的高级分析库。

GUI库。

使用LabWindows/CVI 的用户界面编辑器可以创建并编辑图形用户界面(GUI),而使用LabWindows/CVI 的用户界面库函数可以在程序中创建并控制GUI。

此外,LabWindows/CVI为GUI 面板的设计,准备了许多专业控件,如:曲线图控件、带状图控件、表头、旋钮和指示灯等,以适应测控系统软件开发的需求,利用这些控件可以设计出专业的测控程序界面。

虚拟仪器labview课件PPT第十一章通信编程

虚拟仪器labview课件PPT第十一章通信编程
下面是一种通用串口通讯程序旳界面。
第十一章 通信编程
11.2 DataSocket通信技术 DataSocket是NI企业提供旳一种网络测控
系统开发工具,以实现不同旳应用程序和数据 源之间旳数据共享。
DataSocket用类似于Web中旳统一资源定位 器(URL)定位数据,URL不同旳前缀表达了不同 旳数据类型:
从DataSocket读数据旳前面板:
第十一章 通信编程
第十一章 通信编程
注意:在上述程序运营前,必须先从 Windows程序菜单中打开DataSocket Sever。
第十一章 通信编程
11.2.6 基于DataSocket旳OPC数据传播
LabVIEW中DataSocket提供了OPC数据传播功 能。
该节点用于设置串标语、波特率、数据位、 停止位、奇偶校验、缓冲区大小及流量控制等 参数。
第十一章 通信编程
② 串口写(Serial Port Write.VI)
对串口进行写操作,端口设置为: VISA resource name:设置串标语; write buffer:写入串口缓冲区旳字符。 Return count:返回写入串口旳字符数。
OPC URL旳基本构造为: opc://主机名//OPC服务器名/数据项目
下面以SLC500 PLC为例,简介LabVIEW与PLC 基于DataSocket旳数据通信措施。
第十一章 通信编程
第十一章 通信编程
第十一章 通信编程
第十一章 通信编程
① RSLinx与其他软件旳通信 RSLinx通讯软件是用于A-B可编程控制器旳服 务器软件,为A-B旳PLC处理器与Rockwell企业及 其他企业(如微软)旳许多软件产品提供了通信 连接,如下图。

labview课件PPT

labview课件PPT
• 1.性能高 • 2.扩展性强、灵活性好 • 3.智能化程度高 • 4.界面友好
1.1.3 虚拟仪器发展过程
• 世界是最早开发和应用虚拟仪器公司是 National Instruments Corporation公司。
• 由于虚拟仪器具有先进的性能和广泛的应 用前景,在NI公司之后还有一些国际知名 厂商也加入到虚拟仪器的研发当中。例如, HP公司、PC仪器公司、Racal公司等先后 研发了一些仪器,但NI公司仍然处于领先 地位。
labVIEW程序设计
推荐参考教材
第1章 认识虚拟仪器
• 虚拟仪器一种对现实中各类仪器的用计算 机进行模拟的仪器。它能完成现实中仪器 所能完成的大部功能。本章先对虚拟仪器 作了入门性介绍,也是对以后所学知识的 总体介绍和总结,然后引出LabVIEW。学 习完本章后,要求对LabVIEW有一个过渡 性的认识。
(显示)
者的结合粗略地讲,虚拟仪器可 以分为智能仪器和虚拟仪器。它 处理器
(数据分析、处理、计算、存 储)
们的区别是,前者把计算机装入 数据 传输
仪器,后者把仪器装入计算机。 虚拟仪器把计算机的处理器、存 D/A、A/D、数据输入
(数据采集)
1.1.2 虚拟仪器的特征
• 虚拟仪器从出现到现在的广泛应用,经历 的短短的几十年,可以说它的发展速度是 相当快的。尤其是近年来在各行各业中大 量应用此技术,它的迅速发展,主要是有 以下几点特征。
• 2.什么是LabVIEW?LabVIEW的主要优势 是什么?
• 3.LabVIEW系统由哪几部分组成?它被应 用在了哪些领域?
• 4.什么是G语言?它和其他文本化编程语 言有哪些异同?
信号分析处理
(波形操作、数据滤 波、数组处理、等)

LabWindows CVI

LabWindows  CVI

QUICK REFERENCELabWindows/CVI™™System Requirements•Personal computer using a Pentium 600or higher microprocessor• Microsoft Windows2000/NT SP6/XP• 800 x 600 resolution (or higher) videoadapter• Minimum of 128 MB of RAM, 256 MBrecommended•150 MB free hard disk space•Microsoft-compatible mouse•Microsoft Internet Explorer 5.0 or laterInstallation1.Insert the CD into the CD drive.If the CD does not run automatically,open Windows Explorer, right-click theCD drive icon, and select AutoPlay.2. Click Install LabWindows/CVIon the National InstrumentsLabWindows/CVI screen.3. Continue to follow the instructionson the screen.LabWindows/CVI is a proven test and measurement ANSI C development environment thatincreases the productivity of engineers and scientists. LabWindows/CVI streamlinesapplication development with hardware configuration assistants, comprehensive debuggingtools, and interactive execution utilities you can use to run functions at design time.Use the built-in measurement libraries to rapidly develop complex applications such asmultithreaded programs and ActiveX server/client programs. The flexibility of LabWindows/CVIoptimizes data acquisition, analysis, and presentation in test and measurement applications.LabWindows/CVILabWindows/CVI meets the changing needs of test engineers with aninteractive development environment designed for virtual instrumentation.With easy-to-use development tools, you can quickly create, configure,and display measurements during program design and verification.LabWindows/CVI automates much of the manual coding and compiling.CVI™, DIAdem™, IVI™, National Instruments™, NI™, ™, NI Developer Zone™, and NI-DAQ™ are trademarks of National Instruments Corporation.Product and company names mentioned herein are trademarks or trade names of their respective companies. For patents covering National Instrumentsproducts, refer to the appropriate location: Help»Patents in your software, the patents.txt file on your CD, or /patents. For a listing of thecopyrights, conditions, and disclaimers regarding components used in USI (Xerces C++, ICU, and HDF5), refer to the USICopyrights.chm.© 2003–2004 National Instruments Corporation. All rights reserved.Printed in Ireland.*323551B-01*323551B-01Sep04Product ResourcesNational Instruments provides extensiveproduct resources for new and experiencedLabWindows/CVI users.Online ResourcesFor complete technical information, developerexchange opportunities, and the latest newsabout LabWindows/CVI, visit /cvi:•Technical support•Online community•Sample programs•Application notes and white papers•Add-on products•Training information•Product tutorialsSample ProgramsUse the National Instruments Example Finderto browse and search installed examples andexamples on NI Developer Zone. To launch theNI Example Finder from LabWindows/CVI,select Help»Find Examples.Documentation Resources•LabWindows/CVI Help—Use theLabWindows Help to accesscomprehensive information aboutLabWindows/CVI windows, functions,tools, and menus. To launch theLabWindows/CVI Help fromLabWindows/CVI, select Help»Contents.•LabWindows/CVI Bookshelf—Use theLabWindows/CVI Bookshelf to search PDFversions of the following LabWindows/CVIdocuments:–LabWindows/CVI Release Notes–Getting Started with LabWindows/CVI–LabWindows/CVI Instrument DriverDevelopers Guide–Application notes–White papersTo launch the LabWindows/CVI Bookshelffrom LabWindows/CVI, selectHelp»LabWindows/CVI Bookshelf.Designing User InterfacesDesign graphical user interfaces (GUIs) in the intuitive User Interface Editor.Select from controls designed specifically for instrumentation.1Customizing ControlsCustomize each GUI control with easy-to-use dialog boxes.2Generating CodeAutomatically generate an ANSI Cprogram based on the GUI withLabWindows/CVI CodeBuilder.CodeBuilder creates code thatresponds automatically to userevents such as mouse clicks,key presses, and menu selections.3Using Function PanelsUse interactive functionpanels to generate librarycalls, test the calls, andinsert them into the program.A function panel is agraphical representation ofa LabWindows/CVI functionand its parameters.4Editing Source CodeComplete your program using the built-in source editor. Use thesource code completion options to view functions, variables,prototypes, and help within the Source window. You also canaccess input selection dialog boxes for parameters and declareparameter variables from within the Source window.5Creating InstallersUse the CreateDistribution Kitcommand to makean installer for yourapplication.7DebuggingUse LabWindows/CVI debugging tools to catch common programming mistakes.The patented User Protection feature automatically checks for invalid programbehavior. Set breakpoints and use tooltips to pause program execution and viewor modify variable values.6Server Functions Client Functions Support FunctionsTCP Support LibraryThe TCP Support Library contains functions that provide support for a platform-independent interface to the reliable, byte-stream oriented, network connection capabilities of TCP/IP .ActiveX LibraryThe ActiveX Library contains functions that create and control ActiveX servers. Use these functions in conjunction with the ActiveX Controller Instrument Drivers, which you can generate using the Create ActiveX Controller Wizard. Also use theActiveX Library functions with ActiveX server code, which you can generate using the Create ActiveX Server Wizard.LabWindows/CVIUse built-in instrumentation libraries to interface test applications to the outside bWindows/CVI includes a large set of run-time libraries for instrument control, data acquisition, analysis, and user interface creation. This chart illustrates classes in each library. To find specific functions, use <Ctrl-Shift-P> in the Source window. You also can use the Library Tree to browse to and search for functions.NI-DAQmx LibraryThe NI-DAQmx Library contains functions that communicate with and control data acquisition devices.PanelsMenu StructuresMenus and Submenus User Interface LibraryThe User Interface Library contains functions that programmatically control the user interface.Pop-up PanelsKeyPress Event Functions Callback FunctionsUser Interface Management PrintingMouse and Cursor Rectangles and PointsBitmaps Clipboard MiscellaneousLW DOS Compatibility Functions MonitorsUtility LibraryThe Utility Library contains functions that perform various operations, including using the system timer, managing disk files, launching another executable, and using multiple threads.VISA LibraryThe VISA Library provides a single interface library for controlling VXI, GPIB, USB, and serial instruments.VXI LibraryThe VXI Library contains functions that communicate with and control VXI devices.GPIB/GPIB 488.2 LibraryThe GPIB/GPIB 488.2 Library contains functions thatcommunicate with GPIB instruments, control GPIB boards, and acquire GPIB status information.IVI LibraryThe IVI Library contains functions that program and control IVI drivers. IVI-compliant drivers have a standard interface, so you can interchange similar instruments without changing your code.Formatting and I/O LibraryThe Formatting and I/O Library contains functions that read from and write to disk files and manipulate the format of data in a program.Open/Close Input/Output XModem Control Status Callbacks ExtensionRS-232 LibraryThe RS-232 Library contains functions that control multiple RS-232 ports using interrupt-driven I/O.Note Refer to the Library Tree for a list of the Traditional NI-DAQ Library classes.Character Handling Date and Time Localization Mathematics Nonlocal Jumping Signal Handling Input/Output General Utilities String HandlingLow-Level IO Multibyte CharactersANSI C LibraryThe ANSI C Library contains standard ANSI C functions,which you can use in LabWindows/CVI.Advanced Analysis LibraryThe Advanced Analysis Library contains functions that simulate and analyze large sets of numerical data quickly and efficiently.Controls/Graphs/Strip ChartsPictures Axis Label Strings CanvasGeneral FunctionsList/Tree (Label/Value) ControlsText BoxesGraphs and Strip ChartsMenu BarsMessage/Prompt Popups File/Directory Popups Graph Popups Windows Interrupt Support Creating and ModifyingRetrieving and Comparing Values Timers Tables SplittersActiveX Controls Data Binding Functions Drawing Batch Drawing Pens ClippingAccessing Pixel Values MiscellaneousMenu Items Control MenusTrees Graph Plotting and Deleting Graph Cursors Graph Legend Strip Chart TracesDigital Waveform Graph Plotting Axis Scaling Font Popups Signal Generation1D Operations 2D Operations Complex Numbers1D Complex Operations Frequency Domain Time Domain One-Step Filter Functions Old-Style Filter Functions FIR Digital Filters Windows Filter Information Utilities Measurement BasicsProbability DistributionsAnalysis of Variance Nonparametric Statistics Old-Style Functions InterpolationVector & Matrix AlgebraReal Matrices Complex Matrices Additional Numerical MethodsStatisticsCurve FittingCascade Filter FunctionsIIR Digital FiltersSignal ProcessingComplex OperationsArray OperationsTimer/WaitDate/Time Keyboard File Utilities Directory Utilities MultithreadingThread PoolExternal Modules Port IOStandard Input/Output Window Runtime Error ReportingOld-Style FunctionsInterruptsPhysical Memory Access Task Switching Extended Functions MiscellaneousGeneral Functions Reading/Writing Callbacks Thread Safe Variable Thread LockThread Local Variable Advanced FunctionsThread Safe QueueLaunching ExecutablesCall Scheduling Functions CallbacksVariant Related FunctionsPassing Values as Variants Assigning Values to Variants Querying the Type of a Variant Retrieving Values from Variants Array FunctionsC Array to SafeArray Conversion SafeArray to C Array Conversion Querying SafeArrays BSTR Functions Resource Management Error Processing ConfigurationLocales Multithreading Low-level FunctionsCreating ActiveX Objects Calling Methods and Properties EventsServer Creation FunctionsObject Functions Advanced FunctionsObject Helper Functions IUnknown Functions IDispatch Functions DLL Server Entry PointsTask Configuration/ControlAdvancedChannel Creation/ConfigurationCreate Analog Input ChannelsPositionCreate T EDS Analog Input ChannelsPositionPositionWatchdog Timer External Calibration DSA Calibration Create Analog Output Channels Create Digital Input Channels Create Digital Output Channels Create Counter Input ChannelsCreate Counter Output Channels Advanced S tart Trigger Reference Trigger Advance Trigger AdvancedSwitch Functions Signal Routing Device ControlCalibrationSystem Configuration TEDSError HandlingExport HW Signals Scale ConfigurationInternal Buffer Configuration AdvancedWrite FunctionsTiming TriggeringRead FunctionsInstrument Driver SessionLocking ChannelsRepeated Capabilities Attribute CreationAdd AttributeAdd Repeated Attribute Invalidation Lists Comparison Precision CallbacksSet Read Callback Set Write Callback Set Check Callback Set Coerce Callback Set Compare Callback Set/Get/Check AttributeSet Attribute Get Attribute Check AttributeCaching/Status-Checking ControlRange TablesRange Table EntriesGet ViInt32 Entry Get Range Table Num Entries Get ViReal64 Entry Range Table Ptr Dynamic Range Tables Error InformationInstrument Specific Error Queue Memory Allocation Helper FunctionsString Callbacks Direct Instrument I/O S tring/Value Tables Value Manipulation Default Callbacks Attribute Information Interchangeability Warnings Logical Names ConfigurationInherent Attribute Accessors Resource TemplateResource ManagementResource-Specific OperationsBasic Message-Based I/OFormatted I/OMemory-Based I/O (High Level)Memory-Based I/O (Low Level)Shared MemoryInterface-Specific OperationsOpen/Close Configuration I/ODevice Control Bus ControlBoard Control Callbacks LockingThread-Specific StatusGPIB 488.2 FunctionsDevice I/OTrigger and ClearSRQ and Serial PollsParallel PollsRemote/LocalSystem ControlLow-level I/OFile I/OString Manipulation Data FormattingFormatting Functions Scanning Functions Status FunctionsSystem Configuration Commander Word Serial Servant Word Serial Low-Level VXIbus Access High-Level VXIbus Access Local Resource Access VXI Signals VXI InterruptsVXI Triggers System Interrupts VXIbus Extenders Backward CompatibilityCommander Word Serial Servant Word SerialNote The Advanced Analysis Library is part of the LabWindows/CVI Full Development System. The LabWindows/CVI Base Package includes the standard LabWindows/CVI Analysis Library. If you have the BasePackage installed, refer to the Library Tree for a list of the standard Analysis Library classes.DIAdem Connectivity LibraryThe DIAdem Connectivity Library contains functions thatdirectly transfer data between LabWindows/CVI and DIAdem.Object ManagementAdvanced Data Storage Data RetrievalEnumeration FTP (Client)Low Level FTP Telnet (Client)POP3 (Client)Internet LibraryThe Internet Library contains functions that communicate with and receive files and commands from remote servers.PropertiesFileChannel Group Channel MiscellaneousNote The LabWindows/CVI Base Package does not include the Internet Library.DDE Support LibraryThe DDE Support Library contains functions that create an interface between other Windows applications using the DDE standard.Server Functions Client FunctionsL a b W i n d o w s /C V I L i b r a r y R e f e r e n c e/cvi。

CVI第01讲绪论

CVI第01讲绪论

第01讲 虚拟仪器及其开发语言LabWindows/CV I§1 虚拟仪器虚拟仪器(“VI ”)是计算机技术、仪器技术和通信技术相结合的产物。

定义为:虚拟仪器就是在通用计算机上加上一组软件和/或硬件,使用者在操作这台计算机时,就象是在操作一台他自己设计的专用电子仪器。

其优势在于可由用户自己定义通用仪器系统,且功能灵活,容易构建,因此应用广泛。

用户可将各种计算机平台、硬件、软件和各种附备件结合起来,形成自己所需要的各种特定设备。

可以是一台数字多用表,也可以是一台示波器,还有可能是一台信号源,或者它同时具有这些设备的所有功能甚至于更多的功能。

一、虚拟仪器的组成1、按照虚拟仪器的组成划分,它可以分为计算机、应用软件和仪器硬件三个部分。

1)、计算机:提供虚拟仪器通用平台,数据存储,显示等; 2)、仪器硬件:获取被测信号,产生激励信号等;3)、应用软件:控制数据采集、控制、分析、处理和显示等,是虚拟仪器的关键。

2、按照虚拟仪器的功能划分,可以分为:数据采集、数据分析、结果表达。

二、虚拟仪器的结构图1-2 虚拟仪器的结构图1-1 虚拟仪器的内部功能划分虚拟仪器由仪器硬件平台和应用软件两大部分构成。

硬件平台包括:计算机、I/O接口设备(主要完成被测信号的采集、放大和模/数转换)。

见书上P5。

三、虚拟仪器的特点见书上P2。

四、常用术语VI: Virtual Instrument 虚拟仪器GPIB:General Purpose Interface Bus 通用接口总线VME:VersaModle Eurcaed Versa总线模块欧式卡(采用主控/目标结构,异步非复用传输模式)PCI:Peripheral Component Interconnect Special Interest Group ,PCISIG 简称PCI 外部设备互连VXI: VME Extensions for Instrumentation VME在仪器的扩展VPP: VXI Plug&Play VXI即插即用PXI: PCI Extensions for Instrumentation PCI在仪器的扩展DAQ: Data Acquire 数据采集GUI: Graphical User Interface 图形用户界面IDE: Integrated Development Environment 集成开发环境VISA:Virtual Instrument Software Architecture 虚拟仪器软件结构IVI: Interchangeable Virtual Instruments 可互换虚拟仪器SCPI:Standard Commands for Programmable Instruments 程控仪器标准命令LXI:LAN Extension for Instrumentation LXI在仪器的扩展§2 LabWindows/CVI的开发环境LabWindows/CVI是一个完全的ANSI C开发环境,用于仪器控制、自动检测、数据处理的应用软件。

LabwindowsCVI学习技巧与资料

LabwindowsCVI学习技巧与资料

LabwindowsCVI学习技巧与资料测控软件一般包括:用户界面、程序控制、数据采集和数据分析4部分。

CVI文件一般包括:工程文件(Pr)、源文件(.C)、头文件(h)和用户界面文件(.uir).Labwindows技巧学习必看(摘录)CVICVI是基于ANSI C的快速开发环境,适用于有C,C++基础。

使用VB,VC,BC运用控件式组织用户界面的工程师Build--Target Type--Dynamic Link LibraryCVI 是事件驱动式的运行方法,排除响应各个事件,造成显示滞后。

需要强制在函数中加入“Process system event()CVI对多线程的支持(1)概念篇每个进程至少有一人上基本线程(主线程)线程与数据一起隔离在某一物理区域,在进程中声明的数据可通过该线程进行访问。

如何实现CVI窗体的全屏?GetMonitorFromPanel(Main,&montior);//获得显示器IDGetMonitorAttribute(monitor,ATTR_HEIGHT,&height);//得到高度GetMonitorAttribute(monitor,ATTR)WIDTH,&width);//得到宽度SetPanelSize(Main,height-25,width);//设置窗口高宽度(高度需要去除任务栏的部分)SetPanelPos(Main,25,0);//设置窗口位置如何在LABWINDOWS中调用MATLAB程序?CVI和Matlab混合编程,必须要行安装Matlab在CVI中,建立ActiveX控制服务器,选择MatlabAutomatin Server type Library(Matlab必须在CVI之前安装才能看到这个选项),创建后将生成三个文件,XXX.FPxxx.C和XXX.h,将.C和.H文件包含在CVI工程中就可以了。

.C文件中包含着CVI和 Matlab的接口函数。

LabWindowsCVI教程数据库应用程序的设计主讲乔立岩精品文档17页

LabWindowsCVI教程数据库应用程序的设计主讲乔立岩精品文档17页

16.03.2020
1/15
第十讲 数据库应用程序设计
一条记录(行)
一个字段(列)
• •
16.03.2020
表里的数据本身并无顺序。在用SELECT语句从表 中回收数据时,发生排序、分组和其它数据操作。
表中每列都有一个数据类型。相对于不同的数据库 管理系统(DBMS),可用的数据类型定义也是存
在差异的。
11/15
第十讲 数据库应用程序设计
• 步骤4. 断开SQL连接
▪ SQL操作结束后,应断开SQL连接来释放系统资源。 这个步骤在任何方向上取值时都是特别重要的,它可 保证工具包适当地关闭并删除临时登记文件。
• 步骤5. 断开数据库
▪ 全部数据库操作结束时,应断开通过SQL建立的数据 库连接,以适时地释放系统资源。
• 可获取SELECT语句返回的字段名和数据类型。
• 不用SQL语句即可创建表并选择、插入、更新 和删除记录。
16.03.2020
9/15
第十讲 数据库应用程序设计
8. SQL Toolkit数据库操作基本步骤
• 步骤1. 连接数据库
执行SQL语句前,必须建立数据库连接。LabWindows/CVI SQL工具包支持单个数据库或多个数据库的多个同步连接。
▪ 使用SELECT语句必须将选择的字段绑定到程序中的 变量上。接着用取值函数获取所选记录。每次调用取 值函数,工具包将列变量拷贝到在程序中绑定的变量。 更新行或创建行时还可用绑定的变量,即更新行或创 建行时将新值拷贝到绑定的变量并随后调用适当的函 数,将程序中的数据添加到数据库对应的字段。
16.03.2020
第十讲 数据库应用程序设计
1. 数据库的基础知识
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
LabVIEW, VEE
LabWindows/CVI
19.08.2020
4/18
2. LabWindows/CVI的历史
19.08.2020
5/18
3. LabWindows/CVI的特点
(1)针对测试测量领域的ANSI C语言开发环境
C compiler for Virtual Instruments (CVI)
变量命名 程序的格式和注释 复杂的程序要事先规划设计
19.08.2020
7/18
4. 程序结构
测控软件一般包括:用户界面、程序控制、数 据采集和数据分析4部分
19.08.2020
8/18
5. 开发环境
(1)主要窗口
LabWindows/CVI开发环境的三个主要窗口是工程窗口 (.prj)、源代码窗口(.c)和用户界面编辑器窗口(.uir)。
19.08.2020
15/18
LabWindows/CVI的函数库
19.08.2020
16/18
(4)交互式代码生成 C文件中生成程序结构:Main, Switch, If, For Loop… … UIR文件中生成代码框架: Main Function, Callback Functions (panel, control, menu) 函数面板中函数的自动插入
20/18
C源代码文件
.uir 用户界面资源文件
.h
用户界面资源头文件
.lib 外部静态库模块文件
.obj 目标文件
.h
外部模块头文件
.dll 动态链接库文件
.lib 动态链接库导入库文件
.fp 函数库(函数数和函数面板)文件
19.08.2020
13/18
(3) 函数面板(function panel)
19.08.2020
14/18
四个用途:
函数面板里的在线帮助提供对函数的作用和 调用参数的解释说明;
函数面板能自动声明,并自动将函数参数的 变量添加到源程序代码中;
函数面板能在加入程序之前交互执行,从而 可以对参数值作试验直到满意为止;
函数面板自动生成代码,将函数调用语句自 动插入程序源代码中。
(5)程序的编译、生成、运行与调试 两种编译器模式:Borland C++, MS C++ 两种运行模式:release, debug Build目标文件类型:.exe, .dll, .lib 单步执行:Step Into, Step Over 断点设置:程序断点,手动断点和条件断点 变量监视
自动化测试与控制研究所
第一部分
整体概述
THE FIRST PART OF THE OVERALL OVERVIEW, PLEASE SUMMARIZE THE CONTENT
2/18
Contents
1. LabWindows/CVI的编程环境 2. 图形用户界面设计 3. 用户事件处理 4. 信号的产生、分析和处理 5. 数据格式化、文件读取和I/O端口操作 6. 串行口通讯和网络数据传输 7. 动态链接库和Windows SDK 8. 多线程程序设计 9. 数据库应用程序设计 10. 仪器驱动程序设计
LabWindows/CVI教程(1)
集成开发环境(IDE)
/531net/instrument Email: qiaoliyan@ MSN: qiaoliyan@ Tel: 86413532/33 ext. 526 Office: 科学园2A栋526
19.08.2020
3/18
第二讲 LabWindows/CVI的开发环境
1. 虚拟仪器软件的重要性
软件成为了虚拟仪器的核心 虚拟仪器和自动测试系统都需要进行软件设
计 要求有高效、便捷、专业的软件开发环境 几种软件开发环境的比较
VC++, VB, Delphi, Borland C++ Builder
19.08.2020
17/18
提问与回答
用思想传递正能量
18/18
结束语
感谢参与本课程,也感激大家对我们工作的支持与积极 的参与。课程后会发放课程满意度评估表,如果对我们
课程或者工作有什么建议和意见,也请写在上边
19/18
谢谢您的观看与聆听
Thank you for watching and listening
工程窗口
19.08.2020
9/18
工程窗口的菜单
19.08.2020
Байду номын сангаас
10/18
源代码窗口
19.08.2020
11/18
用户界面编辑窗口
19.08.2020
12/18
(2) 文件类型
.prj 工程文件
.cws 工程组文件
.exe 可执行文件
*_dbg.exe 调试状态执行文件
.c
(2)丰富的库函数,每个函数都提供函数面板 (3)专业化的图形界面设计控件 (4)交互式编程环境,丰富的调试手段
19.08.2020
6/18
学习LabWindows/CVI的几点建议
1. 要有良好的C语言基础 2. 多上机实验 3. 充分利用LabWindows/CVI的函数库 4. 通过例子学习(…CVI\Samples\… …) 5. 有明确的应用背景 6. 程序要进行严格的调试 7. 养成良好的编程习惯
相关文档
最新文档