Realization of the Drawing Module of Intelligent Electron Spin Resonance Instrument System Based on VB 6.0

Publisher:MysticDreamerLatest update time:2010-07-26 Source: 现代电子技术 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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.

Reference address:Realization of the Drawing Module of Intelligent Electron Spin Resonance Instrument System Based on VB 6.0

Previous article:Electromagnetic Design of Long Stator Synchronous Linear Motor
Next article:Neural Network Adaptive Control of Redundant TT-VGT Robot

Latest Industrial Control 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号