河南科技大学毕业设计(论文) 基于labview、fpga的虚拟仪器平台开发与设计
摘要
现代生产要求电子仪器品种多、功能强、精度高、自动化程度高,而且要求测试的速度快、实时性好,具有良好的人机界面。虚拟仪器正好可以实现这些要求。在电子实验中使用多种仪器,如信号发生器、万用表、频率计、示波器等,如果能把它们都设计成虚拟仪器,利用计算机来提高仪器的集成度,减少实验匹配的仪器的种类、数量和实验室面积,便能从根本上改变实验室的面貌,克服传统测量仪器单一功能的缺点。
本设计正是以这种思想为出发点,以电子技术实验室的真实函数信号发生器、示波器、频率计为蓝本,利用LabVIEW编程来设计虚拟函数信号发生器、虚拟存储示波器、虚拟频率计,并将其合并在一个虚拟平台上面,能够分别实现虚拟仿真函数信号发生器、存储示波器、及频率计的功能,实现真正意义上的虚拟仪器平台。其虚拟平台上面的函数信号发生器可以产生正弦波、三角波、方波三种波形,并能够实现波形频率从1Hz到2MHz可调,峰峰值从0.1V到8.0V可调,实时性很好;示波器能正确的显示波形,并能实现频率和幅值的可调;频率计可以对0HZ到99.99KHZ的信号进行频率的测量。
本设计利用RS-232串口进行数据的传输,实现了LabVIEW与FPGA的通信。同时对仿真信号的生成与控制做了详细的分析,以及对设计中的问题进行了深入的探讨。本设计旨在找到一个能够改革教学实验室的有效途径。
关键词:虚拟仪器,LabVIEW,RS-232,FPGA
I
河南科技大学毕业设计(论文) THE DESIGN OF VIRTUAL INSTRUMENTS PLATFORM
BASED ON LABVIEW AND FPGA
ABSTRACT
Modern production requires electronic instrumentation variety many, strong function, high precision, high degree of automation, and high speed, good real-time in testing, good man-machine interface. Virtual Instruments can meet precisely these requirements. A variety of instruments are used in the electronic experiments, such as signal generator, multimeter, frequency meter, oscilloscope, etc. If we are able to design them to virtual instruments, improve the integration of instruments using computer and reduce the type and number of instruments matched to experiments and the space of laboratory, then we can change the face of the laboratory fundamentally and conquer the shortcomings of single function of the traditional measuring instruments.
The design of this thinking is the starting point of electronic technology to the real function of the laboratory signal generator, oscilloscope, frequency meter based on the use of LabVIEW programming to design the virtual function signal generator, virtual storage oscilloscope, the virtual frequency meter, and combined in a virtual platform, to achieve the virtual simulation function, respectively, signal generator, oscilloscope, and frequency of functions, the realization of the true sense of the virtual instrument platform. Its virtual platform for the above function signal generator can produce sine wave, triangle wave, square wave three, and be able to achieve the waveform frequency from 1Hz to 2MHz Adjustable peak peak adjustable from 0.1V to 8.0V, a very good real-time; oscilloscope waveform display correctly, and to achieve an adjustable frequency and amplitude; 0HZ Cymometer can 99.99KHZ signal to the frequency measurements.
The design of the use of RS-232 serial port for data transmission, the realization of the LabVIEW and FPGA communication. At the same time, the generation of simulation and control signals to do a detailed analysis, as well as
II
河南科技大学毕业设计(论文) design issues in detail. The design of a reform aimed at finding an effective way of teaching laboratory.
KEY WORDS: Virtual Instrument,LabVIEW,RS-232,FPGA
III
河南科技大学毕业设计(论文) 目 录
前 言 .................................................................................................. 1 第1章 绪论....................................................................................... 2 §1.1 虚拟仪器的背景 ................................. 2
§1.1.1 数字信号处理技术 ........................... 2 §1.1.2 虚拟仪器技术 ............................... 2 §1.2 本课题研究的意义 ............................... 3
§1.2.1 设计的依据及意义 ........................... 3 §1.2.2 国内外发展状况 ............................. 4 §1.3 关于LabVIEW .................................... 5
§1.3.1 开发环境LabVIEW ........................... 5 §1.3.2 选择LabVIEW的原因 ......................... 5 第2章 系统的构想与方案设计 ....................................................... 7 §2.1 上位机与下位机 ................................. 7 §2.2 DDS的工作原理 .................................. 7 §2.3 方案论证 ....................................... 8 §2.4 系统整体框图与设计思想 ........................ 11
§2.4.1 系统框图 .................................. 11 §2.4.3 频率计设计思想 ............................ 12 §2.4.2 函数信号发生器设计思想 .................... 13 第3章 上位机设计 ......................................................................... 15 §3.1 LabVIEW软件设计思想 ........................... 15 §3.2 人机交互界面设计 .............................. 17
§3.2.1 人机交互界面的构成 ........................ 18 §3.2.2 界面的组件设计 ............................ 19 §3.3 主VI程序框图设计 ............................. 20
§3.3.1 程序框图 .................................. 20 §3.3.2 器件选择部分设计 .......................... 21 §3.3.3 串口发送部分设计 .......................... 21 §3.4 函数信号发生器程序框图的设计 .................. 22
IV
河南科技大学毕业设计(论文) §3.4.1 程序框图 .................................. 22 §3.4.2 波形类型部分设计 .......................... 23 §3.4.3 频率选择部分设计 .......................... 24 §3.4.4 峰峰值调节部分设计 ........................ 25 §3.4.5 串口发送部分设计 .......................... 25 §3.5 频率计程序框图的设计 .......................... 26
§3.5.1 程序框图 .................................. 26 §3.5.2 发送数据类型控制部分设计 .................. 26 §3.5.3 串口发送部分设计 .......................... 28 §3.5.4 串口接收部分设计 .......................... 28 §3.5.5 显示部分设计 .............................. 29 §3.6 设计中用到的主要VI ............................ 29 第4章 下位机设计 ......................................................................... 31 §4.1 FPGA软件中主模块的设计思想 .................... 31
§4.1.1 主模块的软件设计原理总图 .................. 31 §4.1.2 FPGA软件中主模块的设计原理 ............... 31 §4.2 FPGA软件中函数信号发生器的设计思想 ............ 32
§4.2.1 函数信号发生器的软件设计原理总图 .......... 32 §4.2.2 FPGA软件中函数信号发生器的设计原理 ....... 32 §4.3 FPGA软件中频率计的设计思想 .................... 34
§4.3.1 频率计的软件设计原理总图 .................. 34 §4.3.2 FPGA软件中频率计的设计原理 ............... 34 §4.4 频率计的系统模块设计 .......................... 35
§4.4.1 串口接收模块 .............................. 35 §4.4.2 串口转换模块 .............................. 38 §4.4.3 分频模块 .................................. 39 §4.4.4 控制模块 .................................. 40 §4.4.5 串口发送模块 .............................. 41 §4.4.6 频率计模块 ................................ 42 §4.5 函数信号发生器的系统模块设计 .................. 45
§4.5.1 串口接收模块 .............................. 45
V