Smart test
Design of Digital Instrument System for Vehicles by Using Single-chip Microcomputer and Sensors
Vehicle instrumentation is one of the important human-computer interaction devices on the vehicle, mainly used to provide the driver with information related to the operating state of the vehicle. With the widespread application of electronic technology, traditional automobile instruments will gradually be replaced by electronically controlled digital instruments based on microprocessors.
1 The working principle and functional block diagram of the system
In this paper, it is proposed to use ADμC845 single-chip microcomputer and related sensor devices to design the digital instrument system for vehicles.
The function of this system is coordinated by the hardware and software. The hardware part mainly completes the collection and conversion of various sensor signals and the display of various data information; the software mainly completes the signal processing and control functions. The system function block diagram is shown as in Fig. 1. ADμC845 single-chip microcomputer obtains the output signal of each sensor, which is converted by its own analog-to-digital converter. The converted data is displayed and output by the LCD screen and LED indicator, when part of the data reaches or exceeds the set peak value. Output alarm signal.
00.gif
Figure 1 System functional block diagram
2 hardware design
2.1 Main control module
This system uses ADμC845 as the main chip. It is a high-performance 24-bit data acquisition and processing system newly launched by ADI. It integrates two high-resolution delta-sigma ADCs, 10/8-channel input multiplexer, an 8-bit MCU and program, data flash/electric erasing memory. At the same time, it can provide 62KB flash/electric erasing program memory, 4KB flash/electric erasing data memory and 2304B data RAM.
ADμC845 can generate a 12.58MHz high frequency clock through an on-chip lock loop PLL to make it run on a 32KHz external crystal oscillator. This clock can be sent via a programmable clock separated from the MCU clock operating frequency. The on-chip microcontroller is an optimized single instruction cycle 8052 flash memory MCU. The MCU maintains compatibility with the 8051 command system at the same time. With 12.58MIPS performance. Two separate ADCs (main ADC and auxiliary ADC) are composed of an input multiplexer, a temperature sensor and a programmable gain amplifier PGA that can directly measure low-amplitude signals. Both the main and auxiliary ADCs use high-frequency "chopping" technology to provide excellent direct current (DC) offset and offset drift indicators. ADμC845 has both serial and scheduling modes. The pin competition mode can be provided through the EA pin.
The analog-to-digital conversion part of this system uses the 24-bit Σ-Δ ADC of the single-chip microcomputer itself. It can be set to 4/5 fully differential input channels or 8/10 pseudo differential input channels. The main channel has buffer and internal buffer prohibition functions. The input range is divided into 8 gears between ±20mV~±2.56mV, and one gear can be selected during use. These channels are used to directly convert the signal from the sensor. Auxiliary channel is used to receive auxiliary signal input. This channel has no buffer, and only has an input range fixed at ±2.56V.
2.2 Sensor module
2.2.1 Temperature sensor. The temperature sensor of this system adopts the precision platinum resistance temperature sensor PTl000. It has good linearity, low temperature coefficient dispersion and stable performance. This sensor is installed in the coolant circuit to measure the temperature of the coolant, and the temperature range is -40~+130℃. The output voltage of PTl000 is directly connected to the analog-to-digital conversion analog channel of the single-chip microcomputer through the voltage conditioning circuit. When the coolant temperature is too high. Output alarm signal.
2.2.2 Hall sensor. The vehicle speed sensor and the engine speed sensor use Hall sensors. When the wheel starts to rotate, the Hall sensor starts to generate a series of pulse signals. The instantaneous speed and engine speed of the vehicle are calculated by counting them in a unit of time. The accumulated pulse signals can calculate the mileage of the vehicle. Since the duty ratio of the pulse position remains constant at any speed, in order to improve the waveform, we use RC filtering and triode amplification to shape and amplify the pulse signal.
2.2.3 Oil volume sensor. The oil quantity signal is an analog signal, so we get the pulse signal through the high capacitance oil sensor, and after filtering, amplifying and linearizing circuit processing, send it to the analog channel of the single-chip microcomputer analog-to-digital conversion. Due to the turbulence in the operation of the vehicle, the fuel level in the mailbox is constantly swinging, so the component parameters in the conditioning circuit are particularly important. A reasonable circuit will help data processing in the software. The time to one revolution-calculate the running speed from this.
2.2.4 Oil pressure sensor. The pressure sensor adopts an electronic oil pressure sensor, which is installed on the main oil passage of the engine. The pressure range is 0.01~0.6Mpa. When the engine is running. The pressure measuring device detects the pressure of the engine oil and converts the pressure signal into an electrical signal. After voltage amplification and current amplification, the amplified electrical signal is sent to the analog-to-digital conversion analog channel of the single-chip microcomputer through the signal line. The microcontroller compares the converted value with the preset alarm voltage value. When it is lower than the warning voltage. Output alarm signal.
2.3 Display module
The display module includes LED indicator and LCD liquid crystal display. The liquid crystal adopts the graphic dot matrix liquid display LSDl2864CT with 20 external pins. It uses an 8-bit data bus and 5 control lines to connect with the microcontroller. as shown in picture 2. It can display graphics and 8x4 (16x16 dot matrix) Chinese characters. Use LCD screen with Chinese character library. Makes the displayed data more intuitive and clear and easy to understand. The LED displays include too low oil pressure, too high cooling water temperature, too little fuel, the hand brake is not loose, the door is not closed, the trunk is not closed, please fasten your seat belt, etc. The LCD liquid crystal display content includes vehicle speed, mileage, engine speed, coolant temperature, fuel quantity, oil pressure and so on.
2. 4 keyboard control circuit
The keyboard control circuit is made up of P3.0~P3.5 of ADμC845. The connection method is shown in Figure 2. The keyboard has 8 keys in 2 rows and 4 columns. Use 6 I/0 as control lines. Among them, P3.0 and P3.1 are used as row scan lines, and P3.2 is used. P3.5 is used as a column return line to form a matrix keyboard. In operation. In order to prevent the double-click and jitter of the keys, when a key is pressed. The program does not immediately enter the key processing program. Only when the key is pressed and released does it enter the program processing.
11.gif
Figure 2 Display and keyboard circuit
3 software design
The software design of this system includes the system main program, keyboard scanning subroutine, interrupt subroutine, data acquisition and A/D conversion subroutine, LCD and LED indicator display subroutine, alarm signal subroutine, watchdog timer and Power monitor subroutines, etc.
3.1 The main program design
The main program mainly realizes the initialization of the system and the call to each subroutine, as shown in Figure 3. System initialization mainly includes the initialization of liquid crystal display, display buffer value, interrupt and register flag value.
3.2 Data acquisition and conversion subprogram design
This subroutine performs sampling, quantization and corresponding arithmetic processing according to the corresponding analog signal input by the analog channel, and returns the value of the corresponding signal to the main program.
3.3 Interrupt subroutine
The interrupt sources of this system mainly include interrupt pulses generated by Hall sensors, watchdog timers and power monitors. And the interrupt system of ADμC845 can provide 11 interrupt sources, which can fully meet the requirements of this system. The Hall element outputs a low level for each revolution. The accumulated number of levels and the circumference of the tire can be used to obtain the mileage of the vehicle. The frequency divider is used to obtain the low level from the Hall element, the low level generates an interrupt and starts the counter, and stops counting when the second low level arrives, and obtains the time of one revolution to calculate the running speed. Count the number of Hall level changes per unit time. The real-time speed of the engine can be obtained.
Figure 3 main program flow chart
3.4 Display and alarm subroutine
The display subroutine extracts the display buffer value according to the keyboard scan result, and then completes the display output of the value and the symbol on the LCD screen and LED lights.
When the coolant temperature is too high, the oil volume is not enough to set the value, or the oil pressure is not enough, etc. abnormal conditions. The alarm subroutine lights up the corresponding indicator lights and causes the audio device to generate alarm signals of different frequencies to attract the user's attention.
4 Anti-interference design
ADμC845 microcontroller has good anti-electromagnetic interference performance. But in order to ensure the stable and reliable operation of the system. This design still adopts the anti-jamming measures that combine hardware circuit design and software watchdog programming.
The hardware circuit design mainly includes the following parts: The system power supply is obtained by transforming, stabilizing, and filtering the on-board battery power supply. And join the current limiting resistor and voltage regulator tube to prevent high voltage and reverse input: in order to save the mileage data in time when the power is off. Add a 1000F electrolytic capacitor to the input of the power supply: use a one-point connection to reduce the interference between the digital and analog circuit power supplies, especially the interference of the digital circuit to the analog circuit; use a photoelectric isolator to connect the single-chip system and various sensors , The switch is electrically isolated.
Software anti-jamming refers to the software programming of the watchdog timer (WDT) and power supply monitor (PSMI) of ADμC845. After enabling the watchdog. If there is no “feeding the dog” operation within a predetermined time, that is, if the WDE bit in WDCON is set to 1, the watchdog will reset the system service or generate an interrupt; when the digital power or analog power drops to a certain value, a PSMI interrupt is generated , The low level of CMPA and CMPD indicates whether the digital power supply or the analog power supply is low. If CMPA and CMPD return to high level. After maintaining the high level for 250ms, the PSMI is cleared.
5 concluding remarks
The innovation of this article: The design of the digital instrument system for vehicles is carried out by using the new ADμC845 single-chip microcomputer and sensor with outstanding anti-interference performance, as well as the liquid crystal display. The widescreen liquid crystal display makes the display function of this system more powerful. At the same time, the new ADμC845 microcontroller. It also opens up a broader space for the next step to develop a comprehensive information system on this basis, expand the types of display and control information.