In recent years, electron paramagnetic resonance (EPR) or electron spin resonance (ESR) technology has become a new type of science and technology. Its application field is very wide, especially in physics, chemistry, and medicine. Many electronic manufacturers have launched different types of electron spin resonance instruments to the market. The development of its hardware is very rapid, but the corresponding system software support is relatively weak. Therefore, the development of system support software for electron spin resonance instruments will become a new hot spot.
1 Development environment of drawing module
For the development of a certain system, developers can choose various programming languages. Commonly used high-level languages include C--, Java, PB, Visual Basic, etc. Each language has its own advantages and disadvantages, and the language selected based on different user needs is also different. Visual Basic 6.0 was selected in the development of this experimental system. The main reasons for choosing it are:
(1) Visual Basic 6.0 has a friendly visual interface;
(2) The communication control that comes with Visual Basic 6.0 can easily communicate with the intelligent electron spin resonance instrument;
(3) The line drawing function in Visual Basic 6.0 can freely draw the spectrum lines in the drawing area;
(4) The program code is easy to modify and expand later.
2 Drawing Area Implementation
Here, a picture box (pictuer 2) is used to display the resonance spectrum, so the first step is to position the picture box on the form and set its appearance and other properties. In this experiment, the curve displayed in the drawing area (picMain) has coordinate values, so first draw a picture box, and then customize the curve generation area in the picture box. To customize the picture box or drawing area, you must first determine where they are located in the form. So the following first explains the definition of the coordinate system in VB.
2.1 Determination of coordinate system
Introduction to VB coordinate system: There are three coordinate systems in VB, the screen coordinate system, the form coordinate system and the object coordinate system in the form. These three coordinate systems all use the upper left corner as the origin of the coordinates, which is inconsistent with the commonly used geometric coordinate system, and often makes people feel uncomfortable when drawing. VB allows programmers to customize the coordinate system and define the position of the origin of the coordinates as needed. The default coordinate system is that the coordinates of the upper left corner of the container are (O, O) and the coordinates of the lower right corner are (width, Height). In order to define the coordinate system according to your needs, the Scale related properties are used.
Set the coordinates of the upper left corner by setting ScaleLeft and ScaleTop. In the experiment, the coordinates of the lower right corner are:
2.2 Setting the drawing area grid
The drawing area is customized. To make the drawing area more beautiful, a grid that intersects horizontally and vertically is added to the drawing area. The horizontal axis is fixed to have only 5 subdivisions, and the vertical axis is fixed to have 4 subdivisions. Some of the code is as follows:
2.3 Setting coordinates
Draw the x-axis and y-axis according to the size and height of the drawing area.
3. Generation of real-time curves in the drawing module
After drawing the drawing area and coordinate system, you need to draw the real-time curve in the drawing area. The real-time curve is usually drawn with the help of the Timer control. The Timer control is used to regularly send the data monitored by the serial port or other instruments to pic_main. The curve is usually drawn as a line graph, which is drawn using the Line method of PictureBoxl. The Line method can be used to draw a straight line or a rectangle on a form or picture box.
The general format of the Line method is:
[Object name.] Line(x1, y1)-(x2, y2)[, color]
Among them: (x1, y1) is the starting point coordinate; (x2, y2) is the end point coordinate; the color can use the RGB function to specify the color of the line or rectangle. The code is as follows:
3.1 Curve Generation
The curve is generated as:
3.2 Clock Update Curve
The clock update curve is:
In this way
, the task of displaying the data collected from the microcontroller in real time in the drawing area is completed.
Use 4 lines to describe the dual cursor. First, place 4 straight line controls on the drawing area. The 4 lines are placed in the form of 2 pairs of coordinates (cross intersection). And set the properties of the 4 lines:
The names of the 4 straight lines are c0_x, c0_y, c1_x, c1_y.
The colors are c0_x.bordercolor&H0000OOFF&; c1_x.bordercolor&HOOFFFF00&.
4.1 Get the coordinates of any point
Get the coordinate value by clicking the left mouse button on the curve
4.2 Display of coordinate values of any point
Because the coordinate values of any point are obtained, when the mouse is placed at any position on the curve, the values of coordinates CO() and C1() will change accordingly.
The coordinates of a point are shown in Figure 1.
The curve generated by the final experiment is shown in Figure 2.
5 Conclusion
The electron spin resonance instrument data support system is based on the VB 6.0 platform, with simple code and easy expansion. Students can expand the system functions according to their personal needs. The control program designed by the system plots the measured data into a dynamic curve displayed in the drawing area, making the collection of experimental data more intuitive and accurate.
Previous article:Electromagnetic Design of Long Stator Synchronous Linear Motor
Next article:Neural Network Adaptive Control of Redundant TT-VGT Robot
- Popular Resources
- Popular amplifiers
- There are many practical VB programming cases here, which is convenient for everyone to learn VB.
- WinBig. A file archive utility written in VB. Compression and decompression routines are LZSS. Full
- Nonlinear fitting method of sensors in dynamic measurement
- Research on SPWM Inverter with CAN Bus Based on dsPIC30F4012
- Molex leverages SAP solutions to drive smart supply chain collaboration
- Pickering Launches New Future-Proof PXIe Single-Slot Controller for High-Performance Test and Measurement Applications
- CGD and Qorvo to jointly revolutionize motor control solutions
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- Nidec Intelligent Motion is the first to launch an electric clutch ECU for two-wheeled vehicles
- Bosch and Tsinghua University renew cooperation agreement on artificial intelligence research to jointly promote the development of artificial intelligence in the industrial field
- GigaDevice unveils new MCU products, deeply unlocking industrial application scenarios with diversified products and solutions
- Advantech: Investing in Edge AI Innovation to Drive an Intelligent Future
- CGD and QORVO will revolutionize motor control solutions
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- The problem of increasing the driving capability of the oscillation circuit
- Antenna Design Solutions for Next Generation Mobile Devices
- Chapter 3 Using external interrupt EXTI to read keystrokes
- What are the effects of placing TVS tubes in front and behind? Which one is correct? Why?
- MAGTROL HD-106-8NA-0100 Dynamometer Failure
- Which big shot can surpass the design in the picture and realize fingerless touch screen?
- 【bk7231N】First experience with firmware upload platform
- LLAKG: Arduino automatic watering system (Episode 3: C language program upgrade and function optimization)
- [NXP Rapid IoT Review] - NXP Rapid IOT Studio Experience
- TI Signal Chain and Power Q&A Series Live Broadcast - USB Type-C Special Prize Live Broadcast in Progress!