Category:
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
0
1
2
3
4
5
6
7
8
9
Position:IcFull.com » IC Electronic information » Category: V

IC Electronic information

VB + Access-based temperature acquisition system design

In Electronic Infomation Category: V | on April 22,2011

With the rapid development of modern information technology, data acquisition aspects of technology is constantly moving forward, and ATMEGA128L-8AU datasheet and plays an important role of information technology, is timely and ATMEGA128L-8AU price and accurate data is collected and ATMEGA128L-8AU suppliers and the manner of data collection have become the focus of attention . With the continuous development of embedded technology, a variety of data acquisition systems used in various fields continuously. Temperature acquisition in the smart home, industrial control, intelligent agriculture, etc. are applied. Lower the temperature acquisition system based controller adopts STC89C52 microcontroller, temperature sensor DS18B20 collected by the temperature, the PC using VB to program, collect data through the serial port, into the Access database, and real-time display in the interface temperature curve.

1 overall design

The temperature acquisition system block diagram in Figure 1 shows the overall, system-bit machine that is ready-made system uses microcontroller development board, development board comes with DS18B20 temperature sensor, the development board also comes with the ability to maintain the microcontroller work of the external circuit; host computer using the Chinese version of Microsoft Visual Basic 6.0 integrated development environment and Microsoft Office Access 2003 database development software.


overall block diagram of Figure 1

2 PC Design and Implementation

PC design is the main difficulty lies in the serial heavy machine received from the next bit of data and the data sent to the database and the data shown in real time with the curve. PC overall design flow shown in Figure 2.


Figure 2 PC

overall design flow

Receive data from the serial port used mainly Mscomm32.ocx control in Microsoft Visual Basic 6.0 to add the control, you need to set the COM port (can change), baud rate (9600), data bits (8), stop bit (1 ), parity bit (0), etc., through OnComm () event-driven way of receiving data.

Database using the Microsoft Office Access 2003, first to establish a database, the establishment of a database shown in Figure 3, there are four fields, namely, number, temperature, collection date, collection time, the corresponding data type to Automatic numbers, numbers, text, text.


Figure 3 database table diagram

In Microsoft Visual Basic 6.0 Programming Access database to operate, first of all connected data source, and then open the database and set the appropriate data manipulation, and then update the database, and finally close the database, in the actual operation and control through the control Adodc Datagrid connections to data sources associated with the interface display.

2.1 key design steps

1) first in the VB development environment to create a new EXE project, and then placed on the form some of the necessary controls, such as buttons (Command) control, text box (Textbox), etc.;

2) add a component to add Microsoft conmm control 6.0, Microsoft datagrid control 6.0 and Microsoft ADO data control 6.0 in the three controls;

3) in the database software in the new database, and create a new table temp;

4) connect to the database Access, and to test whether the connection is successful;

5) connected by Adodc with Datagrid, data sources and interface display link;

6) through the Command button and the database search, delete, modify, and add a link to achieve the corresponding functions;

7) drawing through the picturebox control to achieve the function;

8) to serial data and link databases and picturebox control.

2.2 PC Programming (block)

2.2.1 serial process


2.2.2 write data to the database




3-bit machine under the Design and Implementation

3.1 lower computer hardware and principle

Lower temperature acquisition system based controller adopts STC89C52 microcontroller, temperature sensor DS18B20 collected by the temperature, the hardware circuit diagram shown in Figure 4.


Figure 4, the hardware circuit diagram

STC89C52 MCU with:

1) It is the MCS-51 MCU derivative products, in the instruction, the hardware structure and the on-chip resources is fully compatible with standard 8052 microcontroller, DIP40 package series are compatible with the 8051 Pin-to-Pin, use easy to grasp;

2) High-speed (maximum clock frequency 90 MHz), low power, low price, reliable, widely used, versatile, in the system / application programmable (ISP, IAP), does not account for the user resources. The system uses a microcontroller interrupt STC89C52, two timers and P0 ~ P3 4 ports. 11.059 2 MHz external crystal oscillator, and use the 30 pF capacitor to ground to improve the stability and reliability.

DS18B20 with: 1) only requires one I / O ports can be realized communication; 2) DS18B20 Each device has a unique serial number; 3) the practical application does not require any external components to to achieve temperature; 4) measuring the temperature range between -55 ~ 125 ; 5) digital thermometer resolution users can select 9-12; 6) internal temperature, the lower alarm settings.

DS18B20 to use: DS18B20 uses a 1-Wire bus protocol, rather to the microcontroller STC89C52, we must use the software to simulate a single bus protocol timing to complete the DS18B20 chip access. As DS18B20 is a I / O line to read and write data, therefore, to read and write data bits have strict timing requirements. DS18B20 have a strict protocol to guarantee you the correctness and completeness of data. The agreement defines the timing of several signals: initialization sequence, read the timing, write timing. All timing is the host as a master device, a single bus device as a slave device. Every time the transmission of commands and data are written from the host startup sequence initiative began, if the request to send data back to a single bus device, during write command, the host need to start reading the timing for data reception. The transmission of data and commands are low in advance.

3.2 software

Software design focus is to capture the temperature back to back and correct the temperature of the acquisition sent through the serial port, the software design flow chart shown in Figure 5.


Figure 5 software design flow

Software initializes all ports and timers, serial port, etc., in determining whether there is an interrupt, if you receive X, then start sending data, if the received character S, then stops sending data, or to determine whether the arrival 0.5 s intervals, if achieved, will begin collecting temperature data sent, or to determine whether there is an interrupt.

4 test results

Figure 6, the actual temperature acquisition system based operation renderings.


temperature acquisition system Figure 6 the effect of the actual operation diagram

5 Conclusion and Future

The temperature acquisition system can acquire through the microcontroller DS18B20 temperature sensor to the data and send real-time with a serial port to PC; host computer has the ability to receive data in real time and real-time received data into Access database ; to the temperature curve shown in real time to the interface; database with number, date, time and temperature four attributes; database with search, modify, delete, add and find the first record, next record, previous record and last record function; to record start time, end time and the time difference; displays the current time and date.

ATMEGA128L-8AU datasheetATMEGA128L-8AU suppliersATMEGA128L-8AU Price

All right reserved:icfull.com © 2010-2016 Certificate