For the stm32 oscilloscope, there are a lot of online channels. I want to express my design ideas here. This project has been prepared for a long time. First of all, I would like to thank the previous team. I feel that Chen Shi and Yu have received many considerations from two experienced embedded engineers. If it is not for work adjustment or other reasons, it is very likely that the product will come out. However, I am deeply sorry for not finishing the process. Here I will describe my design process, hoping to help my friends who are doing the oscilloscope. It is also a summary of this project.
The effective measurement frequency of this oscilloscope is 0.1 ~ 100 kHz
Dual-channel
Integrated Signal Generator
The time axis increments by 1, 2, and 5 in the range of 2us ~ 1 s
Timeline: 12 cells per screen
Hardware structure:
- Primary core mongozet6
- Touch screen ssd1289 320*240 rgb565
- AD: Internal ADC 1 MHz sampling rate of stm32
Dual-channel.
(Design extension external high-speed ad, the above reasons failed to be completed)
- Da: a sine wave, sawtooth wave, and square wave within 20 KB of the internal DAC.
- Platform: ucosiii,
- Image: ucgui
Software Design: Design Philosophy
The entire data process is as follows:
Data SamplingThere are three parts:
- High-speed sampling (2us ~ 20us including 20us );
Take 20us as an example:
20us x 12 x.
The sampling rate is 1 MB, that is, 1 us can only sample 1 piece of data. As mentioned above, the screen width is 320.
In this case, one data entry corresponds to one or several points on the display.
Therefore ~ The maximum sampling rate is 1 MHz for sampling between 20 us.
Continuous sampling mode is adopted.
- Medium Speed sampling (50us ~ 20 ms, including 20 ms );
In this period, as long as the sampling period is adjusted and the selected timeline is the same, the sampling points can correspond to the points on the screen one by one.
The sampling mode is triggered by a timer.
- Low-speed sampling (when the value is greater than or equal to 50 ms ).
According to brands such as Haitai Ke's oscilloscope, the screen is displayed cyclically at this low speed (the screen is closed ).
The sampling mode is also triggered by the timer.
Data Parsing:
- Waveform Parameters: Cycle, duty cycle, maximum value, minimum value, and so on.
It is easy to obtain the data parameters after obtaining the sample data.
Here, we need to mentionRelationship between sampling points and display points:
Sampling at medium speed and low speed:
The display points of the sampling points correspond one to one.
During High-speed sampling:
Regardless of the time axis, the sampling period is 1us;
The relationship between the sampling point and the display point is (320 screen width)/(timeline * 12 grids/1us)
- Find the trigger point:
Low-speed sampling is not triggered because it is displayed cyclically.
Sample three times the screen data at high speed and medium speed, and compare the data with the trigger line to obtain a matching piece of data for display.
Signal Generator:
This part is simple. First, calculate a periodic waveform and put it in an array. Then, update da cyclically with DMA.
Display:
This part is straightforward:
Here are two screenshots:
Http://www.tudou.com/programs/view/xhzx85TF-Is/
Http://www.tudou.com/programs/view/-GiTeVanFhk/