Design of Virtual Oscilloscope Test System Based on C Language Development Environment

Publisher:Amy啊111111Latest update time:2019-12-03 Source: elecfans Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

introduction

With the development of virtual instrument technology, new measurement and control methods that use "virtual instruments" to replace traditional instruments are replacing traditional measurement and control systems, that is, using data acquisition cards, signal conditioning cards or other computer peripheral hardware to collect and detect signals, and then using computers to process, calculate and analyze signals and display test results.


Labwindows/CVI is an integrated software development environment based on the standard C language. The steps for developing virtual instruments are mainly to first determine the basic framework of the program, create the user interface, then complete the writing of the program code, and finally create the project file, add the program file, header file, and user interface file to the project, and compile and debug to generate an executable file.


1 Design of data acquisition card

Traditional data acquisition cards include multiplexers, amplifiers, sample/hold devices, A/D converters, D/A converters and other devices. The PCI (peripheral component interconnect) bus is a high-performance 32/64-bit address data multiplexing high-speed peripheral device interface local bus. With the continuous improvement of the performance of microprocessors, people have continuously put forward new requirements for the I/O bandwidth of microcomputer systems. The original standard buses, such as ISA, EISA and Mc, have gradually become unable to meet the requirements of modern data acquisition technology. The introduction of the PCI local bus has broken the bottleneck of data transmission. With its excellent performance and adaptability, it has become the mainstream of the microcomputer bus. The data acquisition system based on the PCI bus is the development direction of the high-speed data acquisition system. The overall structure of the data acquisition card based on the PCI bus can be designed as shown in Figure 1:

Design of Virtual Oscilloscope Test System Based on C Language Development Environment

After completing the hardware design of the data acquisition card, you need to write the driver for the board. WDM (Window Driver Model) is a driver model strongly promoted by Microsoft, which provides more features, including plug-and-play, power management, WMI, etc., and WDM is also a cross-platform driver model that can be recompiled and run on different platforms without modifying the code.


2 Virtual Oscilloscope Software Design

The virtual oscilloscope test system obtains discrete data through peripheral hardware circuits and displays and analyzes the signal in the time domain. This obtains test results that are close to those of real instruments. This design uses a data acquisition card to obtain analog signals, and its software structure is shown in Figure 2:

Design of Virtual Oscilloscope Test System Based on C Language Development Environment

1) Signal acquisition module

Since this design uses a non-NI data acquisition card, it cannot be implemented directly using the LabWindows/CVI function library. However, the driver of the board design is generally provided in the form of a dynamic link library, so for LabWindows/CVI, the dynamic link library in the driver can be directly used to sample the experimental data file. We store the collected data in a one-dimensional array for analysis and calculation.


2) Waveform display module

The design uses the Graph provided by LabWindows/CVI to display the waveform. The collected data is stored in a dynamic array with adjustable size, and the data is analyzed in the time domain and displayed in a graph. The waveform display module also includes basic operations such as superposition and subtraction of AB channel waveforms. The implementation method is to use C language to simply add and subtract data elements.


3) Time domain analysis module

The time domain analysis includes the autocorrelation of channels A and B, the cross-correlation analysis of the AB channel signals, the convolution of the AB channel, and the Lissajous diagram of the AB channel. The correlation operation design is completed using the Convolve() function in the LabWindows/CVI function library. The convolution is completed using the Correlate() function. The left side of Figure 2 shows the signal of the AB channel, where the pulse signal can be expressed as:

Design of Virtual Oscilloscope Test System Based on C Language Development Environment

The sine signal can be expressed as: x(n)=sin(k), 0≤k≤1024, k∈Z. The right side of Figure 3 shows the result of the convolution of x(n) with u(k). The horizontal axis represents the number of sampling points, a total of 1024 points, and the vertical axis represents the amplitude. The amplitude gain is 1V/d.

Design of Virtual Oscilloscope Test System Based on C Language Development Environment

4) Signal conditioning module

The signal conditioning module is mainly designed to adjust the vertical gain, vertical displacement, and horizontal gain of the signal. The specific implementation of the design is also achieved through the operation of the array in C language. Figure 4 shows the program flow chart of the signal conditioning module.

Design of Virtual Oscilloscope Test System Based on C Language Development Environment

5) Storage Module

Due to the limitation of storage hardware, real oscilloscope can only store 2 to 4 data. However, in the virtual digital storage oscilloscope, unlimited data can be accessed arbitrarily by using storage media such as hard disk, and the storage is safer. The specific implementation method is: the storage samples the measured signal, then converts it into an array, and then saves the array to a file. The reading is just the opposite. The working process is shown in Figure 5.

Design of Virtual Oscilloscope Test System Based on C Language Development Environment

3 Test results and simulation analysis

According to the design process of LabWindows/CVI, we completed the design of the virtual oscilloscope and sampled and analyzed the sine signal. The results are shown in Figure 6:

Design of Virtual Oscilloscope Test System Based on C Language Development Environment

The main problem of virtual instrument is the simulation of instrument, and simulation includes two aspects, one is the simulation of instrument function, the other is the simulation of instrument appearance and panel. This design focuses on the simulation of instrument function.


1) Simulation of data processing and waveform storage functions

Through the design of virtual instrument software functions, we have completed the display of signals, correlation operations, convolution operations, file storage and reading, and basically realized the functions of the oscilloscope, achieving the goal of simulation.

2) Bandwidth simulation

Generally speaking, the bandwidth of a virtual oscilloscope generated directly by a computer is actually the bandwidth of the computer, and the upper limit of the frequency it can measure depends on the performance of the computer. In fact, the oscilloscope is limited by various factors, and its bandwidth is much lower than the bandwidth of the computer. The main factors that limit the bandwidth of the oscilloscope are:


① Limitation of the upper operating frequency of the oscilloscope.

② Limitation of Y channel amplifier bandwidth.

③ Limitation of the scanning speed of the timing circuit.


In order to achieve the simulation effect, a 100MHz, -3dB low-pass digital filter is designed for the virtual oscilloscope. Although the use of IIR filters such as Chebishev can better maintain the amplitude-frequency characteristics of the measured signal, its phase-frequency characteristics are not ideal. Therefore, a FIR filter is designed using a rectangular window to ensure that the signal passing through the filter can linearly approach the phase of the measured signal. The spectrum characteristics of the rectangular window are shown in the following formula (see Figure 7).

Design of Virtual Oscilloscope Test System Based on C Language Development Environment

Design of Virtual Oscilloscope Test System Based on C Language Development Environment

As shown in Figure 7


4 Conclusion

The emergence of virtual instruments is a turning point for the test and measurement industry. It means that we can change the performance of the instrument anytime and anywhere by changing the virtual instrument software module according to our needs. However, it is still difficult to complete the development of a high-performance virtual test system. The non-interchangeability between different interface buses requires us to develop different hardware drivers for each interface bus, which reduces the versatility of virtual instruments. The contradiction between the complexity of high-performance virtual instrument interface circuits and the need for high-speed data measurement is also a reason that restricts its widespread application. However, as an emerging instrumentation technology, virtual instrument technology has only developed for a few decades. I believe that with the continuous development and improvement of computer technology and virtual instrument technology, it will replace traditional instruments and become the main force in the instrumentation industry.

Reference address:Design of Virtual Oscilloscope Test System Based on C Language Development Environment

Previous article:Design and verification of logic chip function test system using FPGA chip
Next article:Effectively measure power supply ripple using RIGOL programmable digital oscilloscope

Latest Test Measurement Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号