基于LABVIEW的串口通讯实现.doc
基于LABVIEW的串口通讯实现
TheDesignofserialcommunicationbasedonLABVIEW
摘要
美国国家仪器公司的LABVIEW是一种图形化编程语言,它的根源在于自动化控制和数据采集。其图形化的代表性,类似于过程流程图,它为科学家和工程师提供一个直观的编程环境,在过去20年中成熟历程中,这个语言已经成为一个通用的编程环境。LABVIEW使得它成为很好的自动化选择环境有几个主要特点,这些措施包括简单的网络通信,交钥匙执行共同的通信协议(RS232,GPIB总线等),成为过程控制和数据拟合、快速简便的用户界面的建设和一个有效率的程式码执行环境的强大工具。我们讨论这种语言的优点,并提供一个例子,在公司内部是用来在整合和控制自动化平台的应用套件的书面。
关键词:LABVIEW;RS-232;串口
Abstract
NationalInstrumentsLABVIEWisagraphicalprogramminglanguagethathasitsrootsinautomationcontrolanddataacquisition.Itsgraphicalrepresentation,similartoaprocessflowdiagram,wascreatedtoprovideanintuitiveprogrammingenvironmentforscientistsandengineers.Thelanguagehasmaturedoverthelast20yearstobecomeageneralpurposeprogrammingenvironment.LABVIEWhasseveralkeyfeatureswhichmakeitagoodchoiceinanautomationenvironment.Theseincludesimplenetworkcommunication,turnkeyimplementationofcommoncommunicationprotocols(RS232,GPIB,etc.),powerfultoolsetsforprocesscontrolanddatafitting,fastandeasyuserinterfaceconstruction,andanefficientcodeexecutionenvironment.Wediscussthemeritsofthelanguageandprovideanexampleapplicationsuitewrittenin-housewhichisusedinintegratingandcontrollingautomationplatforms.
Keywords:LABVIEW;RS-232;serialport
TOC\o1-3\h\z\u第一章绪论 1
研究背景 1
虚拟仪器的发展趋势 1
1.1.2RS-232串口的发展历程 2
第二章虚拟仪器 3
2.1虚拟仪器的概述 3
2.1.1虚拟仪器的特点及优势 3
2.1.2虚拟仪器系统的组成 4
虚拟仪器I/O接口设备 5
2.1.4虚拟仪器的软件结构 6
2.2图形化虚拟仪器开发平台——LABVIEW 7
2.3虚拟仪器与传统仪器的比较 8
第三章RS-232串口 9
3.1RS-232 9
3.1.1RS-232外部结构 9
特性 11
3.2.1电气特性 12
近距离通信 13
串口通讯流控制 13
第四章系统的总体设计与实现 15
4.1串行通信系统的流程 15
系统的搭建成型 15
4.2.1程序前面板设计 15
程序框图设计——添加函数 15
串口参数设置 16
4.2.4while循环内的构架 16
4.2.5条件结构区域内的排布 20
4.2.6WHILE循环结构区域内的排布 21
程序框图完善 21
4.3LABVIEW前面板的设计 23
4.4串口通信的测试 26
结论 29
致谢 30
参考文献 31
第一章绪论
研究背景
随着计算机系统