1 System functions and features
This system uses a single-chip microcomputer to manage and control the entire measurement circuit, making the entire system intelligent, small in size, low in power consumption, using fewer electronic components, less internal wiring, low cost, and easy to manufacture, install, debug and maintain. In this system, the single-chip microcomputer is used as a lower computer to complete the temperature measurement task. The measurement results can be displayed locally, or communicated with the upper computer (PC) through the lower computer to give the results and prompt information. The upper computer and the lower computer mostly communicate through the RS-232 serial interface of the PC. Visual Basic is a visual object-oriented structured programming language that uses event-driven technology. The upper computer of this system uses Visual Basic to develop microcomputer communication programs under the Windows environment.
2 Basic principles of the system The
system structure is shown in Figure 1, where the computer is required to be able to run Windows 98 or higher versions) operating system and development environment VB6.0, with a standard RS232 serial port, and its main functions are data acquisition and processing and system control, and it is a platform for human-computer interaction.
There are 4 temperature collection points on site. The temperature is collected by AD590 and sent to the A/D converter input terminal of the single-chip microcomputer. The maximum measurement range is 50 degrees. The single-chip microcomputer collects temperature signals regularly and packages them into data frames according to the serial communication protocol. VB6.0 programming is used in the microcomputer, and the MSCOMM control is selected for serial port communication. The MSComm control is an extended control provided by Microsoft to support VB program access to the serial port, and also supports query methods and event-driven communication mechanisms. Event-driven communication is a very effective method for interactively processing serial port transactions, especially suitable for Windows program writing. Therefore, it is quite simple to use it to realize data communication of the microcomputer serial port, and serial port access and data communication can be easily realized with very little program code.
3 Hardware Design
3.1 Measurement Circuit Design
After AD590 converts the temperature into the corresponding current, a current-voltage conversion circuit is required (as shown in Figure 2), in which capacitor C plays a filtering role. In this circuit, considering that the temperature measurement range is 0-50 degrees, and the output voltage range of ADC0809 is 0-5V, the resistor R2 is 3.3 kilo-ohms, R3 is 15 kilo-ohms, R2 is a sliding rheostat with higher precision than R3, the resistor R4 is 100, R5 is 50 kilo-ohms, R4 is a sliding rheostat with higher precision than R5, and the resistor R6 is 33 kilo-ohms. The operational amplifier is a temperature-voltage conversion circuit. For the convenience of testing, the output voltage at 0 degrees is set to 0V during design. The output voltage rises by 100mV for every degree increase. The relationship between the output voltage and the voltage is: U=K(T-T0)V, where K is the proportional coefficient, K=0.98V/degree, T is the ambient temperature in degrees, and T0 is the lower limit of the temperature measurement, 0 degrees. When T=+50 degrees and T=0 degrees, the upper limit of the output voltage of the conversion circuit is Umax=5V, and the lower limit of the voltage is Umin=0V. The implementation method is: first adjust R2 to make I1=273.2uA. When the temperature is 0 degrees, the current I2=273.2uA passing through AD590, at this time I3=0uA, there is no voltage drop on R4 and R5, that is, the output voltage is 0V; when the ambient temperature is 50 degrees, the current flowing through AD590 is 323.2uA, at this time, I3=I2-I1=50uA, adjust R4 to make R4+R5=98 kilo-ohms, and (R4+R5)*I3=4.9V. Similarly, the output voltage corresponding to the remaining temperatures can be calculated.
3.2 Analog-to-digital conversion interface circuit design
This system uses the 89C51 chip as the main chip to manage and control the entire system. The chip has high integration and is compatible with the 8051 single
-processor. The difference is that there is a 4KB ROM on the chip, which is PEROM (FLASH memory). There are many types of A/D converters.
The most widely used ones are: successive approximation A/D converter, dual integral A/D converter, and V/F conversion A/D converter. The single-chip microcomputer 89C51 used in this system is 8-bit, so an 8-bit A/D converter is used, and its interface circuit is simple. The data output of most integrated A/D converters has TTL level, and the data output register has a controllable three-state output function, which can be directly hung on the data bus. Otherwise, a buffer interface must be added, and the data is read out twice, which is more troublesome. According to the measurement resolution required by the system, when an 8-bit A/D converter is used, its resolution is 50/250=0.2, which is higher than the specified value. Temperature is a slowly changing physical quantity. When measuring it, a high-speed A/D converter is not required, and a sampling and holding device is not required on the channel. The successive approximation A/D converter belongs to a medium-speed A/D converter and is often used in industrial multi-channel single-chip control systems. Based on the above reasons, this system uses
ADC0809 as an analog-to-digital converter. Its structural block diagram is shown in Figure 3. This chip is an 8-bit successive approximation A/D conversion chip, with 8-way analog switches controlled by address latch, the maximum nonlinear error is less than +1LSB, and a single +5V power supply is used. The analog input voltage range is 0 +5V, and the corresponding digital output is 00H FFH. It can latch a three-state output, and the output is compatible with TTL. The power consumption is 15mW, and the conversion time is 100 S. There is no need to adjust zero or full scale. There are 28 pins, among which: IN0, IN1, IN2, ..., IN7 are connected to 8-way analog input; AD-DA, ADDB, and ADDC are connected to the address line to select one of the 8 inputs.
In this system, ADDC is grounded, AD-DA and ADDB are connected to P3.3 and P3.4 of 89C51 respectively, forming 4 inputs; ALE is address latch enable, START is the chip start pin, the falling edge of the pulse on it starts a new A/D conversion, connected to P3.7; EOC is the conversion end signal, connected to P362, and requests an interrupt to the microcontroller; OE is the output enable terminal, directly connected to +5V; CLK is the clock terminal, because the chip clock frequency only works at 640KHZ at most, it is usually connected to this pin by the ALE of the microcontroller after frequency division; DB0 DB7 is digital output, connected to PO, LSB represents the lowest bit, and MSB represents the highest bit.
3.3 Serial interface circuit design
The lower computer (microcontroller) communicates asynchronously with the upper computer (PC) through the serial port (RXD and TXD), using the RS-232 standard interface. RS-232 specifies its own electrical standard, which cannot meet the transmission requirements of TTL level (MCS-51 single-chip microcomputer serial port level is TTL level). Therefore, when the RS232 level is interfaced with the TTL level, level conversion must be performed. At present, the most commonly used chips for RS232 and TTL level conversion are the transmission line driver MC1488 and the transmission line receiver MC1489. In addition to level conversion, their functions also realize the conversion of positive and negative logic levels.
4 Software Design
The system software mainly uses VB6.0 to program the RS232 serial port. To achieve communication between hardware. MSComm is an ActiveX control provided by Microsoft for serial communication programming. ActiveX controls include a series of properties, methods and events. Applications access the functions of controls through the interface provided by ActiveX controls. Communication controls leave many complex operations to VB and Windows to handle. Programmers only need to set some of the properties when programming.
The key codes of the system are as follows:
Coast CMDconfig = "%0101210600" 'Set port command character,
0--100 degrees, scientific unit
Coast CMDdataInl = "#O1" 'Read serial port 1 data command character
Coast CMDdataIn2 = "#02" 'Read serial port 2 data command character
Coast CMDspanCalibration = "$010" 'Calibration command character
Coast CMDoffsetCalibration = "$011" 'Offset calibration command character
Coast CMDconfigStatus = "$012" 'Read port information command character
Coast CMDmoduleName = "$OlM" 'Read module name command character
Private Sub CmdStart_onClick() 'Start command subroutine
MSComml.CommPor = COMnum 'Set port number
If MSComml.PortOpen = False Then 'Open serial port
MSComml.PorOpen = True
End If
If COMnum = 1 Then
CMDdataln = CMIMataInl
Else
CMDdataln = CMDdataIn2
End If
MSComml.Outpu t= CStr(CMDdataIn)&vbCr 'Issue a reading command
TimeDelay 500 'Delay 500 ms
Picturel.CurrentX = 0 'Draw the starting point of the curve coordinates
Picturel. CurrentY = temperature
Timer1.Enabled = True 'Start timing
End Sub
Private Sub MSComml_OnComm() 'Event response subroutine
Select Case MSComml.CommEvent 'Judge MSComml communication event
Case comEvReceive 'Receive event generated by receiving Rthreshold bytes
MSComml.RThreshold = 0 'Close OnComm event reception
TimeDelay 20 'Delay 20ms
temperatureShow = Right(MSComml.Input.7) 'Read the first data byte (BCD code high byte)
temperature = VaI(temperature5how ) 'Numeric combination, calibrate the decimal point
MSComml.Output = CStr(CMDdataIn)&vbCr'Send read command
MSComml.InBufferCount = 0'Clear cache
MSComml.
RThreshold = 1 'Close OnComm event receiving
Case comEventBreak 'Receive Break
…
Case Else
End Select
End Sub
The minimum system clock can be set to 1ms. In use, it should be noted that due to the limited serial port speed, the system running speed is limited, and the sampling rate of the ADAM4013 module is also limited, so the serial port sampling interval cannot be set less than 50ms, otherwise a delay error will occur. In fact, for temperature acquisition, a sampling rate of 20 times/s is sufficient, and a large sampling rate is not very meaningful.
5 Conclusion
The system does not handle the situation when the temperature exceeds the temperature measurement range. An alarm circuit can be added in the system improvement. Connect a port of the microcontroller to a light-emitting diode. When the measured temperature exceeds the specified temperature, the light-emitting diode lights up to remind the user. This system is designed for real-time display and data storage, which is convenient for intuitive observation of temperature changes and data processing. The biggest feature of this system is that it is easy to implement. It does not require a data acquisition card or a hardware driver. The hardware connection is convenient and the software compilation is relatively easy to master. It is particularly suitable for short-term temperature measurement system development.
Previous article:Speed Control System of Two-phase Brushless DC Motor Based on DSP
Next article:Valve Remote Control System Based on CAN Bus
- Popular Resources
- Popular amplifiers
- 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!
- Rambus Launches Industry's First HBM 4 Controller IP: What Are the Technical Details Behind It?
- 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
- MCU development full-time/part-time and sales assistant
- MAX10 pin crosstalk
- [RVB2601 Creative Application Development] Practice 4 - Keyboard Control of Network Music Playback
- Download the information to win a Jingdong card | Tektronix's innovative new generation touch screen oscilloscope
- G100 acoustic imager is used in many product development and fault diagnosis fields
- EEWorld invites you to dismantle (fifth issue): dismantle Xiaomi fast charging power strip
- The moon rises over the sea, and the world is sharing this moment
- [Project source code] Cymometer, an equal-precision frequency meter based on FPGA
- Last 4 days to apply for free: Mil based on NXP high-speed, high-performance LS1028A development board
- Treatment of cross-partition area and slot in EMC design of power board