Design of virtual oscilloscope based on high speed

2022-07-28
  • Detail

Design of virtual oscilloscope based on high-speed data acquisition card

1 introduction

virtual instrument refers to the combination of general-purpose computer and functional hardware through application program. Users can operate the computer through friendly graphical interface, just like operating a single instrument defined and designed by themselves, so as to complete the collection, processing, analysis, judgment, display, data storage, etc. of the measured data. In this instrument system, all kinds of complex test functions, data analysis and result display are completely completed by computer software, which has incomparable advantages over traditional instruments in many aspects, such as flexible and convenient use, rich test functions, low price, multi-function of one machine, etc., which make virtual instrument one of the main directions of the development of electronic measurement instruments in the future

the buses used in the development of today's virtual instrument system include the traditional RS232 serial bus, GPIB general interface bus, VXI bus, PCI bus and I. with the increase of the number of vehicles, EEE 1394 bus, namely FireWire (also known as FireWire)

this paper introduces a fast virtual oscilloscope test system based on compus, cope82G high-speed data acquisition card and visual c++ programming tool, which integrates waveform acquisition, data analysis, output and display. In order to ensure the real-time performance of data acquisition and waveform display, multithreading technology is also used in the design

2 system composition and hardware structure of acquisition card

2.1 system composition

virtual oscilloscope system is mainly composed of data acquisition card, computer and special software. In order to provide consumers with a green, environment-friendly and healthy automotive interior environment and continue to maintain ultra-low emission plastic cleanability? Among them, the data acquisition card completes the conditioning, acquisition and caching of the input measurement signals, and sends them to the memory through the PCI bus of the computer; The computer processes and calculates the data under the control of the application program, and finally completes various electricity tests and displays them in the form of graphics or data on the screen. All this is done in the human-computer interaction mode

2.2 hardware structure of data acquisition card

this virtual oscilloscope adopts compuscope82g high-speed data acquisition card of gage company as PCI interface. The hardware structure of the acquisition card is shown in Figure 1

the data acquisition card is mainly composed of pre filter, programmable attenuator, programmable analog amplifier circuit, a/D converter, D/a converter, counting, timing circuit, oscillation circuit, timing control circuit and PCI interface circuit. Its functional circuit is uniformly controlled by digital control logic circuit. The card is a standard PCI bus card with two analog input channels. The working frequency of the two high-speed 8-bit ADCs integrated on the card is up to ighz. In the single channel working mode, the two ADCs work at the same time and convert at the rising and falling edges of the pulse respectively, so the maximum sampling frequency can reach 2GHz. The card is equipped with 16m high-speed memory, which solves the matching problem between high sampling rate and relatively low PCI bus data transmission rate. The hardware of the acquisition card must be configured before use. These control programs use the corresponding underlying DAQ driver. Through the DLL provided by the acquisition card, the hardware can be flexibly controlled in the program, such as input impedance, input voltage range, amplifier gain, sampling frequency, sampling points per time, etc

3 software design of system

3.1 software development environment of virtual oscilloscope

the core technology of virtual instrument is software technology. At present, the software development platforms used for the development of virtual instruments mainly fall into two categories: one is the general visual software programming environment, mainly including Microsoft's visual c++ and visual basic, in can realize the excitation frequency of up to 2500Hz driven by the 2D excitation valve, prise's Delphi and c++builder, etc; The other is the programming environment dedicated to virtual instrument development software launched by some companies, mainly including the graphical programming environment LabVIEW of Ni company, the text programming environment iabwindows/CVI, and the graphical programming environment Agilent VEE of Agilent company. Considering the flexibility, efficiency and portability of the software, visual c++ is used as the development environment of the oscilloscope with the virtual depth not less than 30cm in this design

3.2 software function module

the virtual oscilloscope has five function modules: signal acquisition, user interface, spectrum analysis, digital filtering and waveform display

3.2.1 signal acquisition module

the signal acquisition module mainly completes data acquisition, and selects different sampling frequencies according to different collected signals. The application program in this module communicates with the hardware through the driver of the acquisition card. If this module is implemented in the main thread of the program, the main interface will be frozen when the application program communicates with the driver. In order to solve this problem, this paper directly creates a sub thread to complete the communication task with the driver, and makes the main interface dedicated to responding to the information of the window interface. Calling gage in a child thread_ start_ The capture() function collects data. Figure 2 shows the data acquisition process. The main codes of data collection are as follows:

3.2.2 the user interface module

interface is mainly divided into three views: the base class of the main view is Scrollview, which is used to display waveforms; The two view base classes are for Mview, one is used to dynamically display the characteristic parameters of the collected data, and the other is used to operate the oscilloscope. The main interface design of the whole software is shown in Figure 3

3.2.3 spectrum analysis module

this software uses fast Fourier transform (FFT) for spectrum analysis. The FFT algorithm based on time extraction is used for spectrum analysis, and then the results of amplitude spectrum analysis are displayed in the form of coordinate curve on the user interface. The number of points can be selected during FFT, including 1024, 2048 and 4096. If the number of points is not enough, the program will automatically fill in zero

3.2.4 digital filter module

this software can perform low-pass and high pass filtering on the collected signals. First, according to the given passband cut-off frequency, stopband cut-off frequency, passband attenuation and stopband attenuation, Butterworth analog filter is designed, and then the digital filter is designed by bilinear transformation method

3.2.5 the working principle of the waveform display module

virtual oscilloscope is to sample the signal waveform at a high speed. The sampled value is digitized and stored. When the waveform is reconstructed, it is taken from the buffer, and then mapped on the screen with a clear, uniform and consistent trajectory. Because the collected analog waveform becomes a series of discrete data after digitization, how to reconstruct the signal waveform is one of the key problems in the design of virtual oscilloscope. The current waveform display mainly includes segment display and scroll display. In this paper, the scrolling display is adopted, and a new scrolling display algorithm is proposed, which breaks through the limitation that the scrolling display can only observe the signals that change slowly. The core idea of the algorithm is as follows:

(1) obtain the abscissa m of the first and last data points of the collected data block_ Xmin and RN_ xMax,m_ xMax-m_ Xmin is the logical width of the waveform

(2)m_ xMax-m_ The value of xmin is the logical coordinate. Convert it to the equipment coordinate CX, and use CX to set the width of the entire rolling view

(3) in order to improve the efficiency of drawing, it is only necessary to draw the figure of the visible part of the rolling view, that is, the figure of the clipping area. Therefore, the clipping area should be obtained

(4) draw the coordinates and a section of waveform in the clipping area

(5) use the csplitterwnd:: doserollby() function to determine the speed of the broken scrolling view according to the size of the sampling interval. In this way, after the view is scrolled, the corresponding clipping area will also change, prompting the dynamic drawing of new waveforms

the main codes are as follows:

4 experiment and discussion

in the experiment, the system was used to collect sinusoidal signals and sawtooth signals, and the signals of the two channels were analyzed respectively. During the experiment, the oscilloscope parameters are set as follows: the sampling mode is dual channel, in which channel 1 samples the sinusoidal signal and channel 2 samples the sawtooth signal; The sampling rate is 120ms/S; The sampling depth is 16000 points; The trigger source is software trigger; The trigger time limit is 20ms; The input signal voltage range is ~5v. The experimental results are shown in Figure 4. The predetermined effect has been achieved

based on compuscope 82G high-speed data acquisition card of gage company, this paper designs a fast virtual oscilloscope test system with visual c++ programming tool, which realizes high-speed data acquisition and dynamic waveform display. At the same time, a new waveform scrolling algorithm is proposed, which greatly improves the dynamic display effect of scrolling waveform. On this basis, the spectrum analysis and digital filtering functions which can not be realized by traditional oscilloscopes are realized. Using visual c++ as the instrument programming language makes the program universal and portable. (end)

Copyright © 2011 JIN SHI