With the improvement of living standards, people are no longer satisfied with the enjoyment of food, clothing and housing, and the comfort of travel has attracted more and more attention. Therefore, the taxi industry has brought people the enjoyment of travel with low-cost and high-quality services. However, there are always disputes over sales that plague the development of the industry. However, the best way to resolve this contradiction is to improve the taxi meter and use a more sophisticated meter to provide passengers with more convenient and fast services. Taxis in my country began in the 1970s. With the development of electronic technology, the design technology of taxi meters has also been continuously improved. The development of domestic taxi meters has gone through four stages, from the traditional mechanical type composed of all mechanical components to the semi-electronic taxi meter, and then from the integrated circuit type to the current taxi meter based on the single-chip system design. The taxi meter based on the single-chip system design is a control element with a single-chip microcomputer as the core, and uses a sensitive Hall switch type device. It has the characteristics of strong functions, reliable performance, simple circuits, and low cost. Coupled with the optimized program, it has a high level of intelligence.
1 System Hardware Design
The taxi meter system is based on the AT89S51 single-chip microcomputer, and consists of a key circuit, an AT24C02 power-off storage circuit, a mileage calculation circuit, and a digital tube display circuit. By using the flexible programming design and rich I/O ports of the single-chip microcomputer, as well as its control accuracy, it can not only realize basic mileage pricing price adjustment and clock display, but also realize expansion functions to a large extent, and it is convenient to upgrade the system in the future. Figure 1 shows the block diagram of the meter system.
1.1 Design of mileage calculation and pricing circuit
Mileage calculation is to send the signal detected by the Hall sensor A44E installed on the wheel to the single-chip microcomputer, which is processed and calculated and sent to the display unit. The detection principle of A44E is shown in Figure 2. Port P3.2 is used as the input end of the signal, and the external interrupt 0 is used internally. Every time the wheel rotates a circle (assuming the circumference of the wheel is 1 m), the Hall switch detects and outputs a signal, causing the single-chip microcomputer to interrupt and count the pulses. When the count reaches 1,000 times, that is, 1 km, the single-chip microcomputer controls the amount to increase automatically. The calculation formula is:
current unit price × number of kilometers = amount
1.2 Design of data display circuit
The design uses a timer/counter to send an interrupt request signal to the host every 0.1 s, and uses a parallel interface circuit to complete the real-time display function of the clock. At the same time, the dynamic scanning circuit is used to display the starting price and current cumulative price of the taxi.
Since the design requires the display output of unit price (2 digits), distance (2 digits), and total amount (3 digits), plus an additional extended clock display (including the display of hours, minutes, and seconds), the LCD liquid crystal segment code display is used. The data cannot be seen clearly at a distance of 1 m from the screen, which cannot meet the requirements, and its contrast cannot meet the requirements during the day. Therefore, a 6-digit LED digital tube split screen display is used.
When the taxi is not moving, press S1 to realize the split screen display of the data; when the car is moving, only the total amount and unit price display are displayed. When the destination is reached, if the customer requires to view the total mileage, S1 can be pressed to switch to the mileage and unit price display for the customer to query.
1.3 Design of AT24C02 power-off storage circuit
The function of the storage circuit is to store the currently set unit price information when the power is disconnected. The storage circuit is shown in Figure 3. It is designed with the 2 KB serial electrically erasable and programmable storage chip AT24C02 launched by Atmel, and the transmission mode is I2C bus. The advantages of this design are its simplicity and high processing efficiency. Generally, the address input terminals A0, A1, A2, and write protection WP are connected to Vcc or GND; SCL and SDA are connected to pull-up resistors (the resistance value of the pull-up resistor can be selected by referring to the relevant data manual, and 5 to 10 kΩ resistors can usually be selected. The resistance value selected in the design is 5.1 kΩ) and then connected to the ordinary I/O port of the microcontroller, which can realize the operation of the microcontroller on AT24C02. The function of the pull-up resistor is to reduce the static power consumption of AT24C02.
1.4 Start and clear circuit
In the system circuit, a start/clear button is designed to start the mileage counter or clear the mileage counter. The button switch is connected to an interrupt request line of the microcomputer system. When the switch is pressed once, it is used as a meter start interrupt request; when it is pressed again, it is used as a system meter clear interrupt.
1.5 Design of key circuit
The circuit uses a total of 4 keys, namely S1, S2, S3, and S4. Their functions are: S1 is a split-screen display switch key; S2 is a function setting key; S3 is a '+'/day and night switch key; S4 is a '-'/midway waiting switch.
2 System software design
2.1 Main program module
The main program flow chart is shown in Figure 4. In the main program module, it is necessary to complete the initialization of each interface chip, the initialization of the taxi starting price and unit price, the design of the interrupt vector, and the interruption, loop waiting and other tasks. In addition, the start/clear flag register, mileage register and price register need to be set and initialized in the main program module. Then, the main program will complete different operations such as start, clear, mileage and price calculation according to the content of each flag register.
When S1 is pressed, the meter starts to calculate and judge whether the mileage has exceeded the starting price kilometers according to the content in the mileage register. If it has exceeded, the current cumulative price is calculated according to the mileage value, the unit price per kilometer and the starting price, and the result is stored in the price register, and then the time and the current cumulative price are sent to the display circuit
for display. When arriving at the destination, since the Hall switch does not send a pulse signal, the meter stops and displays the current amount to be paid and the corresponding unit price. When the meter is started next time, the system automatically clears the display and re-initializes the process.
2.2 Timing interrupt service program
In the timing interrupt service program, an interrupt is generated every 100 ms. When 10 interrupts are generated, it is 1 s, and the data is sent to the corresponding display buffer unit, and the display subroutine is called for real-time display.
2.3 Mileage counting interrupt service program
Whenever the Hall sensor outputs a low-level signal, the microcontroller is interrupted once. When the mileage counter counts the mileage pulses for 1,000 times, there is a program to accumulate the current total amount, so that the microcomputer enters the mileage counting interrupt service program. In this program, it is necessary to complete the accumulation operation of the current mileage and the total amount, and store the results in the mileage and total amount registers.
2.4 Midway waiting interrupt service program
When the Hall switch does not output a signal in the counting state, the T1 timer in the chip is started. Whenever the timing reaches 10 minutes, the current amount is added with the unit price of the midway waiting, and the unit price of the midway waiting is automatically added every 10 minutes thereafter. When the midway waiting ends, it automatically switches to normal pricing.
2.5 Start/clear mileage interrupt service program
When the system has a start/clear interrupt request, the first interrupt can be set as a start interrupt, the second interrupt can be set as a clear interrupt, and the content of the flag register can be set to "1" or cleared to "0" accordingly in the interrupt service program. Among them, when the flag is "1", it means that this interrupt is a start interrupt; when it is "0", it means that it is a clear interrupt.
2.6 Display subroutine service program
Since the data is displayed on a split screen, 4 display subroutines are used, namely: hour, minute, and second display subroutine (HMS_DIS), amount unit price display subroutine (CP_DIS), distance unit price display subroutine (DP_DIS) and unit price adjustment subroutine (PA_DIS).
2.7 Keyboard service program
The keyboard adopts the query method and is placed in the main program. When no key is pressed, the microcontroller loops the main program. Once the right key is pressed, it will turn to the corresponding subroutine for processing, and return after the processing is completed.
3 Conclusion
Since this taxi meter uses a single-chip microcomputer as the core control element and a sensitive Hall sensor device as the detection device, it has the characteristics of strong functions, reliable performance, simple circuit and low cost. In addition, the optimized program makes it have a high level of intelligence, which solves the shortcomings of previous taxi meters such as inaccurate pricing and short service life.
Previous article:OLED display implementation based on C8051F023 microcontroller
Next article:Design of portable amplitude-frequency characteristic tester based on MC8051 core
Recommended ReadingLatest update time:2024-11-16 17:51
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- 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!
- 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
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- How to choose between different chips in TI's Sub-1GHz product line?
- What are the benefits of using an op amp to drive a MOS tube? Who knows? Tell me
- How to convert Allegro PCB to AD PCB?
- PIC32MK encounters problems in UART data transmission and reception using DMA
- Answer the question to win a prize: ADI MEMS industrial monitoring helps the healthy development of machines
- 【BearPi-HM Nano】WiFi test
- Nordic has released a WIFI chip. What do you think?
- Recruiting part-time motor modeling training teachers
- Add a wireless zoom function to your phone
- What should I do if CCS5.5 is not installed properly?