Design of Taxi Meter System Based on AT89S51 Single Chip Microcomputer

Publisher:星尘散落Latest update time:2011-07-04 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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.

[page]

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.

Reference address:Design of Taxi Meter System Based on AT89S51 Single Chip Microcomputer

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

Using AT89S51 single-chip microcomputer to indicate the status of multiple switches
  1. Experimental tasks   P1.0-P1.3 of the AT89S51 microcontroller are connected to four LEDs L1-L4, and P1.4-P1.7 are connected to four switches K1-K4. The programming reflects the state of the switch on the LED. (When the switch is closed, the corresponding light is on, and when the switch is open, the correspondi
[Microcontroller]
Using AT89S51 single-chip microcomputer to indicate the status of multiple switches
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号