Data Monitoring System Based on VC++

Publisher:XiangtanLatest update time:2012-01-07 Keywords:SPCE061A  VC++ Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Introduction : Currently, most of the main monitoring system software is implemented by configuration software or VB. Configuration software modularizes functions, and for smaller systems, some redundant functions are not used, resulting in a waste of resources. However, VB has limited functions and low operating efficiency. With the popularity of the Windows operating system and its powerful functions, more and more programs support the Windows operating system. Since VC is a Microsoft product, it has a powerful program interface and rich development resources to write Windows programs. In addition, VC has strict memory management, good allocation processing on the stack, small size of generated code, and high stability. Therefore, VC++ has become the mainstream development tool for current programs. This article mainly introduces how to use VC++ to write monitoring programs. This program is used in the data acquisition and wireless transmission system based on Lingyang microcontroller SPCE061A to monitor the data collected on site.

1. System framework and functions of each part

This system is divided into two parts: data collection and transmission part, data receiving part. As shown in Figure 1:

Figure 1 System Block Diagram

Among them: the data acquisition part collects the external voltage value and converts the analog value of the voltage into a digital value.

The wireless transmission module is responsible for sending and receiving the converted digital values.

The display module processes the digital value and displays the measured voltage value.

The data monitoring part processes the data received by the receiving module and displays the measured voltage value.

2. Design of data monitoring program

To realize the data monitoring function, three problems need to be solved:

1. How does the host computer (PC) receive data?

2. How to process the data after receiving it so that the data displayed on the screen is more intuitive.

3. Due to measurement errors, how to use software methods to reduce errors.

2.1 Receiving Data

After the wireless receiving module receives the data from a distance, it sends the data to the serial port of the host computer. The MSComm control provided by VC++ 6.0 sends and receives data through the serial port, providing serial communication functions for the application. When there are characters in the serial port receiving buffer, the OnComm event of the MSComm control can be used to capture and process these data. During the programming process, you can add your own processing code to the OnComm event processing function to process the obtained data.

2.2 Processing Data

The data received from the serial port is a 16-bit binary code. It is not intuitive to display it directly, so it needs to be converted into a voltage value.

2.2.1 . Format of raw data

Because this system collects two channels of data, in order to distinguish which channel the voltage value belongs to, we set the highest bit (15th bit) of the 16-bit binary code as the channel identification bit, 0 represents the first channel and 1 represents the second channel. The 14th to 10th bits of data are useless and are 0, and the 9th to 0th bits are voltage data. The structure is shown in Figure 2:

Figure 2 Original data structure

2.2.2 Data Processing

Assume that the received 16-bit data is X

First determine which voltage data is from: if X ≥ 32768 (the decimal number corresponding to the binary number 10000000000000000), it means the data comes from the second channel. Subtract 32768 from X to get the real voltage data Y, and then calculate the measured voltage value through the formula: the formula is: V=Y*6.6/1024 (this formula is determined according to the voltage acquisition module and will not be described in detail here). If X < 32768, it means the data comes from the first channel, and the voltage value V is directly obtained by the above formula.

2.3 Display voltage value

The program displays the two data in two text boxes, as shown in Figure 3:

Figure 3 Program interface

The first channel is displayed on the left and the second channel is displayed on the right. The data received first is displayed at the top of the text box and the data received later is arranged in sequence below. The text box is cleared when the "Clear" button is clicked.

2.4 Reduce Errors

Since the voltage acquisition module itself has a certain resistance, the voltage measurement value is always smaller than the actual value. We use the software method to multiply the Y obtained in 2.2.2 by a fixed number (this number is set to 1.023 after many experiments) to make the measured value closer to the actual value. The following are the experimental results:

The first A/D conversion is shown in Table 1.

Table 1 A/D1 conversion comparison table Unit: Volt

Actual voltage

4.902

4.466

3.970

3.570

2.996

2.462

1.994

1.550

1.042

Display voltage

4.9

4.5

4.0

3.5

3.0

2.5

2.0

1.5

1.0

Receiving voltage

4.90

4.46

3.96

3.51

3.00

2.46

1.99

1.50

1.03

The second A/D conversion is shown in Table 2.

Table 2 A/D2 conversion comparison table Unit: V

Actual voltage

4.982

4.472

4.040

3.464

2.992

2.504

1.990

1.538

0.996

Display voltage

5.0

4.5

4.0

3.5

3.0

2.5

2.0

1.5

1.0

Receiving voltage

4.98

4.47

4.03

3.47

2.99

2.50

1.98

1.53

0.99

2.5 Flowchart

As shown in Figure 4

Figure 4 Program flowchart

3. Conclusion

This article introduces the design process of the monitoring program based on VC++ in combination with practical applications. The designed program has the functions of receiving data, displaying data, and correcting errors. It has a simple structure, high operating efficiency, and occupies less system resources, which reflects the superiority of VC. In terms of the error correction function, an algorithm can also be designed for the error caused by A/D conversion to make the displayed voltage value more accurate, which will be further studied in the next step of work.

The author's innovation : Unlike most monitoring software that uses configuration software or VB, this article uses VC++ to write the monitoring program.

References :

1 Luo Yafei et al. Application Basics of Lingyang 16-bit MCU. Beijing: Beijing University of Aeronautics and Astronautics Press, 2005.

2 Chen Wei, Chen Faguo, Wang Shixun. Application of wireless data communication technology in TPMS. Journal of Wuhan University of Technology, 2005, 27 (5): 241~244

3 PTR8000.pdf. Xuntong Technology. www.freqchina.com

4 nRF905.pdf. Xuntong Technology. www.freqchina.com

5 Ding Libo, Jiang Xiaohua, Zhang He. Design of data acquisition system based on wireless digital transmission technology. Selection of wireless transmission/reception IC chips and data communication technology (2): 168~171

6 Shi Yunmei, Liu Meiyan, Yang Genxing. Research on Network Resource Management[J]. Microcomputer Information 2006(1);109-11
Keywords:SPCE061A  VC++ Reference address:Data Monitoring System Based on VC++

Previous article:Design and implementation of serial interface between single chip microcomputer and LCD
Next article:Design of high-speed data acquisition system based on MAX114

Recommended ReadingLatest update time:2024-11-16 21:29

Research on Water Meter Number Image Acquisition System Based on DSP TMS320VC5402
1 Introduction As the requirements for image acquisition in scientific research are increasing, the storage capacity and speed of the number image acquisition system have been put forward higher and higher technical requirements. In order to realize the automatic reading of number images, the CCD image
[Embedded]
Research on Water Meter Number Image Acquisition System Based on DSP TMS320VC5402
About the working principle and application of VC360 thermal imager
  VC360 Thermal Imager   It uses infrared detectors and optical imaging lenses to receive the infrared radiation energy distribution pattern of the measured target and reflect it on the photosensitive element of the infrared detector, thereby obtaining an infrared thermal image, which corresponds to the thermal distri
[Test Measurement]
Design of Signal Analysis System for RF Reader/Writer Based on SPCE061A
  Introduction   Radio frequency identification (RFID) technology is a non-contact automatic identification technology based on the radio frequency principle. Its basic principle is that the signal transmits information through spatial coupling (alternating magnetic field and electromagnetic field), and this informat
[Microcontroller]
Design of Signal Analysis System for RF Reader/Writer Based on SPCE061A
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
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号