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

Publisher:DazzlingGazeLatest update time:2006-09-18 Source: 国外电子元器件Keywords:oscilloscope Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

  1 Introduction
  Virtual instrument (VI-ViItuaIInstrument) refers to the combination of general-purpose computers and functional hardware through applications. Users can operate the computer through a friendly graphical interface, just like operating a single instrument defined and designed by themselves, thereby completing Collection, processing, analysis, judgment, display, data storage, etc. of the measured data. In this kind of instrument system, various complex test functions, data analysis and result display are all completed by computer software. In many aspects, it has incomparable advantages over traditional instruments, such as flexible and convenient use, rich test functions, low price, and one-stop service. These make virtual instruments become one of the main directions for the development of electronic measuring instruments in the future.

  The buses used in today's virtual instrument system development include the traditional Rs232 serial bus, GPIB general interface bus, VXI bus, PCI bus and IEEE 1394 bus, which is Firewire (also called Firewire).

  This article introduces a fast virtual oscilloscope test system based on the PCI bus interface CompuS, cope82G high-speed data acquisition card and Visual C++ programming tool. This system integrates waveform acquisition, data analysis, output, and display. In order to ensure the real-time performance of data acquisition and waveform display, multi-threading technology is also used in the design.

2 System composition and hardware structure of acquisition card
2.1 System composition
  The virtual oscilloscope system is mainly composed of data acquisition card, computer and special software. Among them, the data acquisition card completes the conditioning, acquisition and caching of the input measurement signals, and transmits them through the computer PCI bus. Send it into the memory; the computer processes and calculates the data under the control of the application program, and finally completes various power tests and displays them on the screen in the form of graphics or data. All this is done in human-computer interaction mode.

2.2 Hardware structure of data acquisition card

  This virtual oscilloscope uses the CompuScope82G high-speed data acquisition card of Gage Company as the PCI interface. The hardware structure of the capture 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 , whose functional circuits are uniformly controlled by digital control logic circuits. The card is a standard PCI bus plug-in card with 2 analog input channels. The two high-speed 8-bit ADCs integrated on the card have a working frequency up to 1GHz. In single-channel working mode, the two ADCs work at the same time. The rising and falling edges are converted, so the maximum sampling frequency can reach 2GHz. The card is equipped with 16M high-speed memory, which solves the problem of matching high sampling rate and relatively low PCI bus data transmission rate. The hardware of the capture card must be configured before use. These control programs use the corresponding underlying DAQ driver. Through the DLL that comes with the acquisition card, the hardware can be flexibly controlled in the program, such as input impedance, input voltage range, amplifier gain, sampling frequency, number of sampling points per time, etc.

3 System software design
3.1 Software development environment of virtual oscilloscope
  The core technology of virtual instrument is software technology. At present, there are two main categories of software development platforms used for virtual instrument development: one is a general visual software programming environment, mainly including Microsoft's Visual C++ and Visual Basic, Inprise's Delphi and C++Builder, etc.; the other is a general visual software programming environment. The first category is the programming environment dedicated to virtual instrument development software launched by some companies, mainly including NI's graphical programming environment LabView and text programming environment IabWindows/CVI, and Agilent's graphical programming environment Agilent VEE. Considering the flexibility, efficiency and portability of the software, visual C++ is used as the development environment of the virtual oscilloscope in this design.

3.2 Software function modules
  The virtual oscilloscope has five major functional modules: signal acquisition, user interface, spectrum analysis, digital filtering, and waveform display.

3.2.1 Signal acquisition module
  The signal acquisition module mainly completes the collection of data, and selects different sampling frequencies according to the different signals collected. The application program in this module communicates with the hardware through the driver of the capture card. If this module is implemented in the main thread of the program, the main interface will freeze when the application program communicates with the driver. In order to solve this problem, this article directly creates a sub-thread to complete the communication task with the driver alone, allowing the main interface to be dedicated to responding to information from the window interface. Data is collected in the child thread by calling the gage_start_capture() function. Figure 2 shows the data collection process. The main code for data collection is as follows:

?
3.2.2 The user interface module
  interface is mainly divided into 3 views: the main view base class is ScrollView, which is used to display waveforms; the 2 view base classes are For-mView, and 1 is used to dynamically display the characteristics of the collected data. parameters, and the other one is used to operate the oscilloscope. The main interface design of the entire software is shown in Figure 3.

3.2.3 Spectrum analysis module
  This software uses Fast Fourier Transform (FFT) to perform spectrum analysis. Spectrum analysis uses a time-based extraction FFT algorithm, and then the amplitude spectrum analysis results are displayed in the form of a coordinate curve on the user interface. You can choose the number of points when performing FFT. There are 3 choices: 1024, 2048, and 4096. If the number of points is not enough, the program will automatically fill in zeros.

3.2.4 Digital filter module
  This software can perform low-pass and high-pass filtering on the collected signals. Firstly, a Butter-worth analog filter is designed based on the given passband cutoff frequency, stopband cutoff frequency, passband attenuation and stopband attenuation, and then a digital filter is designed using the bilinear transformation method.

3.2.5 Waveform display module
  The working principle of the virtual oscilloscope is to sample the signal waveform at high speed. The sampled values ​​are digitized and stored. When the waveform is reconstructed, the numbers are fetched from the buffer, and then a clear and uniform trajectory image is used. on the screen. Since the collected analog waveform is digitized and becomes a series of discrete data, how to reconstruct the signal waveform is one of the key issues in the design of virtual oscilloscopes. The current waveform display mainly includes segmented display and rolling display. Here, scrolling display is used, and a new scrolling display algorithm is proposed, which breaks through the limitation that scrolling display can only observe slowly changing signals. The core idea of ​​the algorithm is as follows:

  (1) Obtain the abscissa m_xMin and rn_xMax of the first and last data points of the collected data block, m_xMax-m_xMin is the logical width of the waveform.

  (2) The values ​​of m_xMax-m_xMin are logical coordinates, convert them into device coordinates cx, and use cx to set the width of the entire
scroll view.

  (3) In order to improve the efficiency of drawing, you only need to draw the graphics of the visible part of the scroll view, that is, the graphics of the clipping area, so you need to get the clipping area.

  (4) Draw a waveform within the coordinates and clipping area.

  (5) Use the CSplitterWnd::DoSerollBy() function to determine the speed of the scroll view based on the size of the sampling interval. In this way, the corresponding clipping area will also change after the view is scrolled, prompting new waveforms to be drawn dynamically.

  The main code is as follows:

?
4 Experiment and Discussion
  In the experiment, the system was used to collect sine signals and sawtooth wave signals, and spectrum analysis was performed on the signals of the two channels. During the experiment, the oscilloscope parameters were set as follows: the sampling mode is dual channel, where channel 1 samples the sine signal and channel 2 samples the sawtooth signal; the sampling rate is 120Ms/s; the sampling depth is 16 000 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 intended effect was achieved.

  This article designs a fast virtual oscilloscope test system based on Gage's CompuScope 82G high-speed data acquisition card and uses Visual C++ programming tools to achieve high-speed data collection and dynamic waveform display. At the same time, a new waveform rolling algorithm is proposed, which greatly improves the dynamic display effect of rolling waveforms. On this basis, spectrum analysis and digital filtering functions that cannot be achieved with traditional oscilloscopes are realized. Using Visual C++ as the instrument programming language makes the programs written highly versatile and portable.

Keywords:oscilloscope Reference address:Design of virtual oscilloscope based on high-speed data acquisition card

Previous article:Intelligent instrument design based on HT47 series RISC microcontroller
Next article:Design and implementation of transformer test system based on MCU CPLD

Recommended ReadingLatest update time:2024-11-16 17:43

Waveform Chart in LabVIEW
   A curve is a graphical display of a set of X and Y corresponding values. Usually, the Y value in the curve chart represents the data value, while the X value represents the time. The waveform chart control can be found in the Modern>>Graph sub-panel of the Controls tool panel. This control is a numerical indicator c
[Test Measurement]
Waveform Chart in LabVIEW
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号