• Inventory
  • Products
  • Technical Information
  • Circuit Diagram
  • Data Sheet
Technical Information
Home > Technical Information > MCU And DSP > Design and Implementation of Vehicle Digital Instrument Based on 51 Single-chip Computer (Fig.)

Design and Implementation of Vehicle Digital Instrument Based on 51 Single-chip Computer (Fig.)

Source:value
Category:MCU And DSP
2023-05-24 14:30:43
30

Making Vehicle Digital Instruments based on MCS 51 MCU

Abstract: This paper introduces the design and implementation of a vehicle digital instrument (VDI) with MCS 51 single-chip computer as its main controller and ADC0809 as its main peripheral elements, such as air pressure, oil pressure, temperature and Hall element sensors. The instrument system has the advantages of intuitive, accurate display, convenient and reliable use, and represents the development trend of automotive instruments.
Keywords: MCS 51 single-chip computer; Sensors; Digital Instruments for Vehicles

Introduction
- Vehicle instrumentation is an important interface and interface for information exchange between drivers and vehicles, and it is an important guarantee for safe driving of vehicles. With the wide application of electronic technology, it is an inevitable trend that traditional automotive instruments are gradually replaced by electronic control digital instruments based on microprocessors. However, at present, the digitization level of vehicle gauges in China is not high, most of the gauges are analog, and most of the analog gauge headers are large and numerous, making the display system crowded and beautiful. Others have a high failure rate, which increases the economic burden of users and reduces the safety factor of vehicles.
- To overcome these shortcomings, this paper puts forward the technical improvement of 51 single-chip computer, ADC0809, Hall switch and DS18B20 digital temperature sensor. A new type of full-digital instrument system is designed and implemented, which has the advantages of intuitive and accurate display, high sensitivity, long service life, smart and beautiful appearance, low cost, etc.

1 System Composition and Working Principle
- The system functions are coordinated by hardware and software. The hardware part mainly completes the collection and conversion of various sensor signals and the display of various information. The software mainly completes signal processing and control functions.
- Its working principle is that 89C51 single-chip computer queries the output signals of each sensor in turn (analog signals output by analog sensors such as air pressure and oil pressure need to be converted to analog by ADC0809); Then 89C51 processes the input signal accordingly and outputs it through the display module 44780, at the same time it can output various warning signals.

2 Hardware Composition
- The system hardware mainly includes the following modules: 89C51 master module, sensor module, ADC0809 A/D conversion module, 44780 display module, etc. 89C51 mainly completes peripheral hardware control and some operation functions, sensor completes signal sampling function, ADC0809 completes the function of converting analog signal to digital signal, 44780 display module completes character and digital display function.


2.1 Master Module
- The system uses AT89C51 single-chip computer produced by ATMEL company, which has 4KB flash memory, 128B memory and 24MHz working frequency. At the same time, it has 32 input and output lines, 16-bit timer/counter, 5 interrupt sources and 1 serial port.
2.2 Temperature Sensor DS18B20
- DS18B20 is a single-line digital thermometer chip introduced by Dallas Company, which can collect temperature data in the field and convert the temperature data directly into digital output. The interface circuit diagram between DS18B20 and AT89C51 is shown in Figure 2. DS18B20 works in the external power supply mode. Single-chip 89C51 uses P2.0 and DS18B20 to communicate.


2.3 44780 Display Module
- This system uses 44780-driven LCD, HD44780 (KS0062) is a large-scale dot matrix LCD controller (with driver) manufactured with low-power CMOS technology, and connected with 4 bit/8 bit microprocessor. It enables dot matrix LCD to display rich information such as upper and lower case letters, numbers and symbols, and has a strong universal application. It is easy to use, and users can form a complete dot matrix LCD system with a few components. The required display can be achieved by feeding related data and instructions.
- 44780 display module has 8 data lines and 3 control lines. It can be connected with a microprocessor or microcontroller. By feeding data and instructions, the module can work properly. The connection circuit between 44780 display module and 89C51 single-chip computer is shown in Figure 3.


- It needs to be noted that the display module that is actually put into use needs to be customized to LCD manufacturers according to the specific requirements of the vehicle manufacturers on the display interface of the instrument.
2.4 A/D Conversion Module

- Because the system needs to process multiple analog signals, ADC0809 A/D conversion module is used, which uses the method of successive approximation to complete A/D conversion; The 8-way analog switch with latch function inside the chip can convert 8 0-5V input analog voltage signals. It takes about 100 to complete the conversion μ S. Its output has a TTL three-state latch buffer, which can be directly connected to the port 80 of the single-chip 89C51. The interface circuit between ADC0809 and 89C51 is shown in Figure 4.
2.5 Speed Sensor
- After investigation, the speed sensor is a vulnerable device in the vehicle sensor, so the system improves the speed sensor, which consists of Hall switch and magnet. The working principle is to install the Hall switch and magnet in the appropriate position of the frame and wheel respectively. When a vehicle is driving, under the action of the magnet, the Hall switch generates a switch signal. By counting the Hall switch in a unit time, the instantaneous speed of the vehicle can be calculated, and the cumulative switch signal can calculate the distance of the vehicle. It has the advantages of high sensitivity, low price and easy damage.


2.6 Other analog sensors
- The measurement of air pressure, oil pressure, oil volume and other parameters uses analog sensor. The output analog signal is input to single chip 89C51 after ADC0809 analog-to-digital conversion, and output after corresponding software processing.
2.7 Anti-jamming Design
- Because the instrument system is designed for automobiles and motorcycles, and the ignition system of automobiles and motorcycles has strong electromagnetic interference, and the vehicle is mobile, and may be in a strong electromagnetic interference environment, anti-interference measures must be taken, otherwise the system cannot run stably and reliably. This system uses anti-interference measures which combine hardware with software.
- Specifically, the system mainly uses the following five anti-jamming measures.
- Using anti-jamming power supply:
- The power supply line of single-chip computer system is the main source of interference. The power supply of this system is provided by car battery. The ignition system and audio equipment of the vehicle may interfere with this system. For this reason, the 12V power supply of car battery can be made up of Pi-shaped filter circuit by magnetic beads and capacitors, then it can be transformed by UA7805C, and then the power supply of this system can be obtained by voltage stabilization and filtering. In addition, a 0.01mF ceramic capacitor is placed on each integrated circuit chip to eliminate most of the high frequency interference. At the same time, good grounding is an important condition for the stable operation of the system. Because the system has both analog and digital circuits, it is designed to be separated from analog digitally and connected at only one point.
- Photoelectric isolation:
- A photoelectric isolator is used in I/O channel to isolate the single-chip computer system from various sensors and switches electrically. A large part of the interference can be blocked. The switch signal output from the speed measuring subsystem of this system is coupled to the P3.2 port of the single chip computer through the photoelectric isolator 4N33.
- Overvoltage protection circuit:
--The system also designs an overvoltage protection circuit on the input and output channels, which is composed of current limiting resistor and regulator to prevent the introduction of high voltage and damage to single-chip computer system.  
- In addition, in this system, to eliminate the jitter interference caused by button action, a Schmitt trigger 74HC14 is added between the button and 89C51.
- Anti-interference measures for analog/digital conversion circuit:
- The digital signal sent by ADC0809 module of the system is transmitted to the single chip computer after being locked by the latch. The latch is very sensitive to the interference. When there is interference on the latch line, the current data will be locked blindly. For this reason, the latch and the single chip computer can be designed on the same circuit board, so that the transmission line transmits the locked control signal. When designing software, repeat the same signal as quickly as possible to reduce the probability of interference signal impact.
- CPU anti-jamming measures:
- When the interference signal acts on the single chip computer itself, the single chip computer will not be able to execute the program in its normal state, thus causing confusion. For this system, the following methods are used.
- Manual reset: When the microprocessor is out of control, the reset method can be used to make the program start automatically from 0000H. A reset key is set for this system. When the microprocessor is out of control, simply press the reset key and hold it for more than 10ms.
Power-off protection: When the vehicle bumps on the road, it may cause poor power contact, such as power supply, which makes the system into a chaotic state. When the power supply voltage returns to normal, it is difficult for the system to restore normal. A power-off protection is designed for this system. The power-off signal is detected by the hardware circuit and added to the external interrupt input of the single-chip computer. Interruption of power loss is defined as interruption, which enables the system to react to power loss in time. In the power-off interruption subroutine, the on-site protection is carried out first. When the power supply returns to normal, the single-chip computer resets, restores the site, and continues to work. For the program to run, you can use a software trap and a watchdog to pull the program back to reset. Specifically, you can bury some flags in RAM. With these flags, you can determine the reason for the reset and jump directly to the corresponding program according to different flags each time the program resets. This allows the program to run continuously and the user may not easily notice that the program has been reset while in use.

3 Software Design
- The software of this system mainly consists of six modules: main program, interrupt subprogram, data collection and A/D conversion subprogram, display subprogram, alarm subprogram, etc. Because the software written in C language is easy to achieve modularization, and the generated machine code is of high quality, readability and good portability, the software of this system is written in C language, and is compiled and connected in the integrated development environment of Keil Vision3 Demo version.
3.1 Main Program Design
- The main program mainly completes hardware initialization, subroutine invocation and other functions. The main program flowchart is shown in Figure 5.


3.2 Data Acquisition Subprogram Design
The data acquisition and A/D conversion subprogram samples, quantifies and processes the corresponding analog signals according to the input parameters, and returns the values of the corresponding signals to the main program.
3.3 Display Subprogram Design
--Display subprogram completes the display output of symbols and values.
3.4 Interrupt Subprogram Design
- The interrupt subprogram has three interrupt sources: keyboard, wheel (which produces an interrupt pulse every turn of the wheel) and power-off protection circuit, which respectively complete panel function setup, speed measurement function and power-off protection. Since there are six interrupt sources in this system, the external interrupt source is expanded with a priority encoder (74LS148).
3.5 Alert Subprogram
- mainly to control the alarm signal output under abnormal circumstances. If the temperature of the coolant rises to near boiling point (e.g. 95-98 C), or when the amount of fuel in the fuel tank is less than a certain value, the audio alarm device will send out different frequency alarm signals, and the corresponding indicator lights up (the task of lighting the alarm indicator is done by the display subprogram) to draw the driver's attention.

4 Emulation and Debugging
4.1 Emulator Selection
- This system uses ME-52 single-chip computer simulation development system, which simulates the clock signal in real time up to 33MHz and provides 2-24MHz. It also provides 64KB program code memory, supports simulation of all programs and data address spaces, and supports Franklin V3.xx/Keil 6.xx compilation and connection tools. Project Manager with separate control project files. In addition, it has VC++ style window residence, window dynamic slicing and Workbook mode window interface.
4.2 Emulation Debugging
- In the phase of simulation debugging, the strategy of "bottom-to-top integration" is adopted to simulate and test module by module, and then integrate step by step. For example, the display module, speed measurement module, temperature measurement module and so on can be simulated first, and then the successful modules can be added to the main program one by one to simulate. Errors are found in the simulation process, and the "block compression strategy" is used to quickly find and correct errors. Note that problems in the integration process are mostly caused by resource use conflicts between modules. When the software module is successfully emulated, it can be simulated online with the hardware. At this time, most of the problems in debugging are caused by connection errors, virtual welding, unreasonable wiring and so on.

5 Concluding remarks
With the wide application of electronic technology, the LCD of vehicle gauge display screen will become a trend. In this paper, 51 single-chip computer and new sensor are proposed to improve the vehicle gauge. At present, the prototype has been successful. The operation results show that the new digital instrument system is reliable and easy to use. On this basis, the next step is to develop a comprehensive information system to expand the types of information displayed and controlled, such as traffic map information, travel information, network information, telephone information, control air conditioning system and audio system, to provide greater convenience to users.

Reference
[1].ADC0809 Datasheethttp://www.dzsc.com/datasheet/ADC0809_123186.html.
[2]. DS18B20 Datasheethttp://www.dzsc.com/datasheet/DS18B20_819975.html.
[3].89C51datasheethttp://www.dzsc.com/datasheet/89C51_105386.html.
[4].AT89C51datasheethttp://www.dzsc.com/datasheet/AT89C51_810155.html.
[5].HD44780 Datasheethttp://www.dzsc.com/datasheet/HD44780_371772.html.
[6].TTLdatasheethttp://www.dzsc.com/datasheet/TTL_1174409.html.
[7].4N33 Datasheethttp://www.dzsc.com/datasheet/4N33_64207.html.
[8].74HC14datasheethttp://www.dzsc.com/datasheet/74HC14_99158.html.
[9].74LS148 Datasheethttp://www.dzsc.com/datasheet/74LS148_1134751.html.
[10].MCS-51datasheethttp://www.dzsc.com/datasheet/MCS-51_477840.html.
[11]. Shao Bei. Reliability technology and development of single-chip computer system. Electronic Products World, 1998,8:20-21
[12]. Zhang Yigang, Peng Xiyuan, Tan Xiaoyun, etc. MCS-51 Single-chip Computer Application Design [M]. Harbin University of Technology Press, 1997
[13]. Zhang Peiren, Sun Zhanhui, Zhang Cunfeng, etc. Principle and Application of MCS-51 Single-chip Computer [M]. Tsinghua University Press, 2002





Source:Xiang Xueqin