1. Master the basic principles of digital oscilloscope measurement.
2. Be familiar with the hardware structure of digital storage oscilloscope.
3. Master the CVI software design of virtual digital storage oscilloscope.
Design a virtual digital storage oscilloscope
(1) Design a virtual digital storage oscilloscope interface that includes basic functions such as coupling mode selection, volt/div adjustment, trigger source selection, and time base selection. The horizontal scale of the display screen is required to be 10div, and the vertical scale is required to be 10div.
(2) Based on the completion of content (1), realize a virtual dual-trace digital storage oscilloscope with adjustable amplitude and time base.
Requirements: ① The vertical sensitivity includes at least four levels: 50mV/div, 0.1V/div, 0.5V/div, and 1V/div; ② The scanning speed includes at least eight levels: 0.1u/div, 1u/div, 10u/div, 100u/div, 500u/div, 1m/div, 10m/div, and 0.1s/div; ③ Add a dual-trace oscilloscope function that can simultaneously display the waveforms of two measured signals.
(3) Data processing design
requirements: ① Display the amplitude of the measured signal including: effective value, peak-to-peak value, and average value; ② Display the frequency value of the measured signal.
(4) Design waveform storage and playback functions based on the 32K storage depth provided by the oscilloscope hardware in the electronic measurement experiment box.
3. Experimental Equipment
1. SJ-8002B electronic measurement experiment box 1 set
2. Computer 1 set
3. Signal source (DDS signal source of the platform can also be used) 2 sets
4. Q9 line 1 set
5. Oscilloscope 1 set
4.1 Digital Oscilloscope Principle
The digital storage oscilloscope uses an A/D converter to convert analog signals into digital signals, and then stores the data in a semiconductor memory RAM. When necessary, the contents stored in the RAM are called out, and the waveform is reproduced through the LCD in a dot matrix or wired manner. The principle block diagram can be referred to Figure 1. In this oscilloscope, the signal processing and signal display functions are separated, and its performance mainly depends on the performance of the AD, RAM and microprocessor for signal processing. Because RAM memory is used, it can write data quickly and read data slowly, so that there will be no flickering even when observing slow signals.
4.2 Composition of Virtual Digital Storage Oscilloscope
Figure 1 Virtual digital storage oscilloscope
The virtual oscilloscope integrates the computer and the measurement system, replaces some hardware functions of traditional instruments with computer software, and replaces the physical panel of traditional instruments with computer monitors. The instrument panel that is easy to operate and lifelike can be designed through relevant software. It can not only realize the functions of traditional oscilloscopes, but also has the characteristics of storing, reproducing, analyzing, and processing waveforms. It can also process, process and analyze various signals and complete measurement tasks of various scales. Moreover, the instrument is small in size, consumes less power, is easy to carry, and can be used on different computers.
Therefore, in SJ-8002B, the principle of virtual digital storage oscilloscope is also cited to realize data acquisition. The signal conditioning, AD conversion, SRAM for storing data, and control logic are all in the experimental platform, and the computer mainly plays the role of data processing and display.
4.3 SJ-8002B Electronic Measurement Experiment Box Oscilloscope Hardware Structure
4.3.1 Test range and acquisition parameter adjustment range
Test voltage amplitude range: -20V~+20V (peak-to-peak value)
Measurement frequency range: 1Hz~1MHz
Sampling clock:
timebase sequence number |
0 |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
Sampling clock frequency |
20M |
20M |
20M |
20M |
20M |
20M |
20M |
20M |
20M |
20M |
timebase sequence number |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
Sampling clock frequency |
10M |
5M |
2.5M |
1M |
500K |
250K |
100K |
50K |
25K |
12.5K |
Programmable gain:
Div Number |
0 |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
Channel total gain A |
20 |
10 |
5 |
2 |
1 |
0.5 |
0.2 |
0.1 |
0.05 |
0.02 |
Data cache depth: 64KB
Analyze the collected data and display the peak value, average value, effective value, frequency, period and other parameters of the waveform.
4.3.2 Hardware Schematic Diagram
Figure 2 SJ8002B oscilloscope hardware schematic
Figure 2 is a block diagram of the oscilloscope module. As can be seen from the figure, the dual channels of high-speed acquisition are completely independent, so a variety of different test tasks can be completed, realizing the various functions of the virtual dual-trace digital storage oscilloscope.
4.3.3 Control Logic
The hardware control of the oscilloscope is mainly divided into two parts: data writing (acquisition) and data reading (display). All control logic is stored inside the CPLD, as shown in Figure 3:
Figure 3 Oscilloscope hardware control logic
Ain1 and Ain2 channels are connected to the same sampling clock and converted at the same time. The converted data is sent to SRAM for latching through the buffer. When one acquisition is completed, the host reads back the data for further processing, such as filtering, display, etc.
Data writing: Under the control of the sampling clock CLK, AD9288 digitally discretizes the two input analog signals into 8-bit digital signals and sends them to SRAM through the data buffer. The address is provided by the same address counter, which is an up/down counter (incrementing when acquiring data and decrementing when reading). In this way, the data acquired each time will be smoothly stored in SRAM.
4.3.4 Acquisition Part
The key device of the acquisition part is ADI's AD9288, which is an 8-bit dual-channel monolithic integrated analog/digital converter with a sample-and-hold circuit, with low power consumption, small size, good dynamic characteristics, and easy to use. Dual 8bits, 40MSPS, low power consumption (90mw per channel), SNR=47DB (at 41MHz), analog input range of each channel 1.024Vp-p, center level Vin0=1/3 Vdd, 3.0V analog power supply (2.7V-3.6V), two data output modes (complementary code or original code), level compatible with TTL/CMOS.
4.3.5 Conditioning Circuit
Since AD9288 uses differential input, it is necessary to convert the DC-coupled unilateral signal of the analog input of the experimental board into a differential signal without distortion, and shift the signal amplitude to meet the 0.5-1.5V input requirement of AD9288. The following channel circuit is used to achieve signal conversion.
Figure 4 Differential signal conversion circuit
In the circuit, U1 is a follower, which is used for impedance matching. Two operational amplifiers are used to generate differential signals, of which U2 is a common-phase amplifier as input, and U3 is an inverting amplifier as input supply. Two diodes and U4 form the signal shifting part.
4.3.6 Attenuation and gain control circuit
Since the test range of the oscilloscope (-20V~+20V) is wider than the test range of AD9288 (0.5V~1.5V), a two-stage amplitude adjustment circuit of signal attenuation and signal gain is added to the front end of the acquisition circuit to ensure the correctness of the measurement and improve the accuracy of the measurement. [page]
Figure 5 Attenuation circuit
The first stage of the input channel is a high-resistance attenuation circuit as shown in Figure 5. This ensures that the digital oscilloscope has a higher input impedance and attenuates the larger input signal to meet the needs of the subsequent circuit. Here, the circuit is switched by a relay. The primary gain factor A1=0.5, 1.25, 2.5, 5 is set by setting the on-off of the attenuator; the coarse adjustment of the amplitude and the DC offset are controlled by the 12-bit DAC7512. The gain of the op amp is changed by an electronic switch to achieve amplitude adjustment. The secondary gain factor is A2=×5, so the total channel gain A=K1*A1*K2*A2
4.3.7 Data processing
Calculate the effective value, mean, peak value, and frequency of the measured signal.
The mathematical expressions of the voltage average and peak value of the discrete signal are as follows:
Voltage effective value: Voltage
average value:
Voltage peak-peak value:
Signal frequency calculation: According to the definition of frequency, the number of changes per second. The
above parameters of the measured signal can be obtained by calling the function processing_data() provided by the experimental platform software. For a detailed description of this function, see the function list provided by the experimental platform in Section 5.2.
5.1 Design of Virtual Digital Storage Oscilloscope Interface Design
a virtual digital storage oscilloscope interface that includes basic functions such as coupling mode selection, volt/division adjustment, trigger source selection, and time base selection. The horizontal scale of the display screen is required to be 10 div and the vertical scale is 10 div, as shown in Figure 6.
Figure 6 Virtual digital storage oscilloscope panel
The controls used include list control (Ring), command button (Command), graphic control (Picture), text control (Text), and numeric control (Numeric).
5.2 On the basis of completing the interface design,
the requirements for realizing a virtual dual-trace digital storage oscilloscope with adjustable amplitude and time base are as follows: ① Set the vertical sensitivity to at least 50mV/div, 0.1V/div, 0.5V/div, and 1V/div; ② Set the scanning speed to at least 0.1u/div, 1u/div, 10u/div, 100u/div, 500u/div, 1m/div, 10m/div, and 0.1s/div; ③ Add dual-trace oscilloscope function to display the waveforms of two measured signals at the same time; ④ Data processing design: Display the amplitude of the measured signal including: effective value, peak-to-peak value, and average value; Display the frequency value of the measured signal.
When designing, the program flow and function call that can be referred to are shown in Figure 7. First, initialize the EPP interface and retrieve the acquisition parameters set by the user interface, such as coupling mode, trigger mode, vertical sensitivity, time base, etc., and then start the acquisition; when the preset acquisition points are acquired, the computer reads the data back; finally, process the read-back data, such as calculating the amplitude and frequency, filtering and displaying the waveform.
Before designing, please complete the calculation and selection of the gain and time base corresponding to each gear and fill in the results in Table 1 and Table 2 below. Calculation method example:
⑴ Given a vertical sensitivity of 20mv/div, the range = 20mV × 10 = 200mV = 0.2V; Since the input range of AD9288 is 0.5V----1.5V, in order to improve the resolution, a 5-fold channel total gain can be used, that is, 0.2V×5=1 V, corresponding to the test range and acquisition parameter adjustment range of the SJ8002B electronic measurement experiment box in Section 4.3.1, the Div number can be obtained as 2. [page]
Vertical sensitivity |
50mV/div |
0.1V/div |
0.5V/div |
1V/div |
Range(V) |
||||
Total channel gain |
||||
Div Number |
Table 1
⑵ Given a scanning speed of 200u/div, the sampling time TS = 200u×10 = 2000u=2ms. Since the number of full-screen sampling points is fixed at 25,000 points, FS×TS <25,000 means FS < 12.5M. Since the provided clock is not 12.5M, the closest 10MHZ can be selected as the sampling clock.
Timebase Sequence Number |
||||
tdiv(s) |
0.1u/div |
1u/div |
10u/div |
100u/div |
Sampling clock (Hz) |
||||
Timebase Sequence Number |
||||
tdiv(s) |
500u/div |
1m/div |
10m/div |
1s/div |
Sampling clock (Hz) |
Table 2
Figure 7 Oscilloscope software flow chart
The main functions provided by the CVI software and experimental software platform that can be used as reference in the design are shown in the following table:
(1) |
Function |
EPP interface initialization |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Function prototype |
void epp_init(void) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Input parameters |
none |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Output parameters |
none |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return value |
none |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
(2) |
Function |
Returns the current value of a control |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Function prototype |
int GetCtrlVal (int panelHandle, int controlID, void *value) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Input parameters |
panelHandle - the panel handle in memory, that is, the handle value of the panel where the control is located |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Output parameters |
value Returns the current value of the control |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return value |
0 - Success Other values - Failure |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
(3) |
Function |
Ain1 and Ain2 acquisition process control |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Function prototype |
int sampling ( unsigned char coupling1_cw, int div1, int DC1_code, unsigned char coupling2_cw, int div2, int DC2_code, int timebase, unsigned chartri, int sampling_points, int Panel_Handle, int stop_ID, unsigned char ain1_data[], unsigned char ain2_data[], double *show_pots) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Input parameters |
coupling1_cw, coupling2_cw == Ain1, Ain2 channel coupling mode control word
DC1_code, DC2_code == Ain1, Ain 2 channel vertical offset, value range 10 ~ 4095
tri == Trigger source selection 0: Clock CLK1 3: External signal 4: Internal DDS1 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Output parameters |
ain1_data[] == Ain1's collected value |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return value |
0 - Collection is successful; output value is valid |
(4) |
Function |
The enable_timer() function is called to set the timer to start and implement cyclic collection. |
Function prototype |
int SetCtrlAttribute (int panelHandle, int controlID, int controlAttribute, ...) |
|
Input parameters |
panelHandle - the panel handle in memory, that is, the handle value of the panel where the control is located |
|
Output parameters |
none |
|
return value |
0 - Success Other values - Failure |
|
(5) |
Function |
Acquisition data processing - calculate the frequency, peak-to-peak value, average value and effective value of the signal according to the acquisition parameter settings |
Function prototype |
int processing_data (unsigned char data[], int points, unsigned char coupling_cw, int div,int timebase, double *signal_fr, double *vp, double *vm, double *ve) |
|
Input parameters |
data[ ] - array for collecting data |
|
Output parameters |
signal_fr== signal frequency Hz |
|
return value |
0 - OK, the output value is valid |
|
(6) |
Function |
Displaying waveforms on graph controls |
Function prototype |
int PlotWaveform (int panelHandle, int controlID, void *yArray, int numberOfPoints, int yDataType, double yGain, double yOffset, double initialX, double xIncrement, int plotStyle, int pointStyle, int lineStyle, int pointFrequency, int color) |
|
Input parameters |
panelHandle - the handle value of the panel where the graphic control is |
|
Output parameters |
none |
|
return value |
Integer representing the handle of the drawn graphic |
5.3 Design waveform storage and playback functions based on the 32K storage depth provided by the oscilloscope hardware in the electronic measurement experiment box.
There are two command button (Command) controls on the virtual storage oscilloscope panel designed in Section 5.2, as shown in Figure 6. Saving the waveform (Save button) calls the ArrayToFile() function, opening the waveform file (Open button) calls the FileToArray() function, and displaying the waveform calls the PlotWaveform() function. The above functions are all provided by the CVI software and can be used directly.
6.1 Observation of dual-trace display waveform
Two function signal sources generate two voltage signals respectively, one generates a sine wave with an amplitude of 5V and a frequency of 5KHz, and the other generates a triangle wave with an amplitude of 3V and a frequency of 5KHz. The designed virtual digital storage oscilloscope is used for dual-trace display and the waveform is drawn.
Draw the waveform of signal one: Draw the waveform of signal two:
6.2 A sine wave with a frequency of 5KHz and amplitude variation (effective value) as shown in the following table is generated by the function signal source, and the effective value is measured using the designed virtual digital oscilloscope.
Standard signal (V) |
0.25 |
0.5 |
2.5 |
5 |
Channel 1 (Ain1) (V) |
|
|
|
|
Channel 2 (Ain2) (V) |
|
|
|
|
6.3 The function signal source generates a sine wave with an amplitude of 5V and a frequency variation as shown in the table below. The frequency is measured using the designed virtual digital oscilloscope.
Standard signal (KHZ) |
0.01 |
0.1 |
0.5 |
1.0 |
5.0 |
10.0 |
50.0 |
100.0 |
1000.0 |
Channel 1 (Ain1) (KHZ) |
|
|
|
|
|
|
|
|
|
Channel 2 (Ain2) (KHZ) |
|
|
|
|
|
|
|
|
|
7. Questions for reflection and practice
1. Can you use an oscilloscope with a bandwidth of 20MHz to observe sine waves and square waves with a repetition frequency of 15MHz? Why?
2. When using an oscilloscope to measure various waveform parameters, how do you reduce its measurement error?
3. What methods can be used to measure the rise and fall time of a square wave?
Previous article:Design of Simple Oscilloscope Based on Single Chip Microcomputer
Next article:Design and implementation of digital cursor direct reading oscilloscope
- Popular Resources
- Popular amplifiers
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- Seizing the Opportunities in the Chinese Application Market: NI's Challenges and Answers
- Tektronix Launches Breakthrough Power Measurement Tools to Accelerate Innovation as Global Electrification Accelerates
- Not all oscilloscopes are created equal: Why ADCs and low noise floor matter
- Enable TekHSI high-speed interface function to accelerate the remote transmission of waveform data
- How to measure the quality of soft start thyristor
- How to use a multimeter to judge whether a soft starter is good or bad
- What are the advantages and disadvantages of non-contact temperature sensors?
- In what situations are non-contact temperature sensors widely used?
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- Sn-doped CuO nanostructure-based ethanol gas sensor for real-time drunk driving detection in vehicles
- Design considerations for automotive battery wiring harness
- Do you know all the various motors commonly used in automotive electronics?
- What are the functions of the Internet of Vehicles? What are the uses and benefits of the Internet of Vehicles?
- Power Inverter - A critical safety system for electric vehicles
- Analysis of the information security mechanism of AUTOSAR, the automotive embedded software framework
- LIS2MDL array magnet displacement data acquisition for magnetic nail navigation AGV
- Domestic Bluetooth BLE chip
- EEWORLD University Hall----Digital Image Processing (MATLAB) Shandong University (Jiang Mingyan)
- [RT-Thread reading notes] First acquaintance
- How the Circuit Works
- Did you know? TI's 77Ghz single-chip mmWave sensor enables automated parking
- Analog Dialogue Collection
- How to concatenate 8 sbits of data into one? Bitwise operation? How to implement it?
- Ask a question about bit fields
- Circuit - What does HVCCR mean?