Introduction
With the development of society, taxis have become a very convenient and common means of transportation in people's lives, but taxi meters are relatively backward. In the past, taxis used mechanical meters, which used gear ratios to calculate the mileage of taxis and converted the mileage into fares. However, mechanical gears are large in size, the calculation is not very accurate, and they are easy to wear. Later, sensors were used to receive the running information of the car, so as to calculate the mileage and fare. However, this method usually causes interference signals to generate counting pulses, so it is also imperfect. The author quoted single-chip microcomputer technology and used encoding and decoding information transmission methods to complete the formation of meter counting pulses. The single-chip microcomputer can detect the sensor signal very accurately, so the price will be very accurate. The devices required to complete this device are simple, the cost is very low, and it is also easy to implement technically.
1 System Principle
The system block diagram is shown in Figure 1. This article mainly introduces the design of the modules in the dotted box. The transmission ratio between the number of revolutions of the taxi driving wheel and the number of revolutions of the shaft is certain, and when the shaft rotates, it drives a small magnet to rotate, and its transmission ratio is also certain. Every time the small magnet rotates one circle, it will face the magnetic induction sensor once, and the magnetic induction sensor will generate a low pulse of about 20 ms. The mileage of the taxi and the corresponding fare can be calculated by calculating the number of low pulses generated by the magnetic induction sensor.
|
The encoder's microcontroller detects the magnetic induction sensor signal through an I/0 port. When it is determined that the signal is generated by the sensor, it sends a set of codes to the decoder's microcontroller through another I/O port. The decoder's microcontroller first determines whether the data currently to be received is the code sent by the encoder or the decode sent by the decoder writer. When it is determined that the decode is sent by the decoder writer, the decoder's microcontroller receives the decode and saves the decode to the E2PROM using the 12c bus protocol; when it is determined that the code is sent by the encoder, the decoder's microcontroller first receives the code, then reads out the decode in its own E2PROM, and compares it with the received code. If they are the same, the decoder microcontroller sends a pricing pulse to the meter through an I/0 port, otherwise it does not send a pricing pulse. Note: The encoding and decoding of each taxi meter here are different, which is conducive to the management of taxis and preventing the theft of meters. The decoding in the decoder is written into its E2PRoM using a decoding writer. Each taxi meter has an encoder and a decoder, and all taxi meters share a decoder writer. That is, before the meter is sold, the same decoder writer is used to write different initial decodes for the decoders of all meters. After writing the initial decode, the meter no longer needs the decoder writer, unless the meter breaks down and needs to replace the decoder, in which case the decoder writer needs to write the initial decode to the new decoder. The hardware circuit design diagram is shown in Figures 2 and 3.
2 Implementation of system functions
2.1 Sensors
The encoder part of this system uses sensors to receive the running signal of the taxi. The sensor used here is a magnetic induction sensor. When it is facing the small magnet driven by the vehicle shaft, the output pin of the sensor will generate a low pulse of about 20ms.
2.2 Encoder
The microcontroller used in the encoder part is PIC12C508A, and the output signal of the sensor is detected by the 4th pin GP3 of the PIC12C508A chip. After detecting a certain sensor signal, the microcontroller will continuously send 5 decimal data (that is, the encoding form is a 5-digit decimal number) to the decoder at its 7th pin GP0 according to a certain timing sequence. Each data is sent out in a pulse manner. How many low pulses are sent according to the decimal number, and the time used to send a decimal data must be guaranteed to be within 255μs. The program flow chart is shown in Figure 4.
2.3 Decoder writer
The microcontroller used in the decoder writer is AT89C51, and the function of the decoder writer is similar to that of the encoder. Since the decode sent needs to be able to change at any time, 5 small numeric keyboards can be connected here, and the decode to be sent by the decoder writer can be obtained from the 5 small numeric keyboards. In order to distinguish it from the code sent by the encoder, the decoder writer needs to send a distinguishing character first, so that the decoder can identify whether the data currently received is sent by the encoder or the decoder writer. The distinguishing character is followed by the decoding. The sending method of all these data is exactly the same as the sending method of the encoder code, and is output by the P3.4 port of the AT89C51 microcontroller. The program flow chart is shown in Figure 5.
2.4 Decoder
|
The microcontroller used in this part is PIC12CE5C18, which has an internal E2PROM. The I2C protocol can be used to read out the decoded data from the E2PROM or write new codes to the E2PROM at any time. The working process is described below. First, the decoder reads out the 5 decimal data from 00h to 04h in the internal E2PRoM and saves them in 5 internal data storage units respectively. Then the data receiving subroutine is called to receive 1 data and save it in 1 internal data storage unit first to determine whether this data is a distinguishing character 10. If it is not a distinguishing character, it means that the data received now may be the code sent by the encoder, then continue to receive the next 4 data and save them in 4 internal data storage units, and compare the received 5 decimal data with the 5 decimal data from 00h to 04h in the internal E2PROM read by the previous decoder. If they are equal, a 2 ms low pulse is sent on the GP0 pin as a pricing pulse, and if they are not equal, the data is received again. If the distinguishing character is 10, it means that the decoder writer needs to modify the decoder's decoding. It must immediately receive the 5 data following the distinguishing character and save these 5 decimal data to 00h~04h of E2PROM, overwriting the previous decoding. The program flow chart is shown in Figure 6, and the subroutine it calls is shown in Figures 7 and 8.
Conclusion
This system solves the shortcomings of the previous taximeter, such as inaccurate pricing and short service life. Now, the coding and decoding technology with a single-chip microcomputer as the main control unit is adopted, so that each taxi meter has a different code, thereby preventing the misappropriation of taxi meters between taxis and facilitating the management of taxis by taxi companies. At the same time, the peripheral circuit of the single-chip microcomputer can be expanded at any time, and the continuous upgrading of this system can be achieved through software programming.
Previous article:Using VC++.NET to realize serial communication between C167CR microcontroller and PC
Next article:Design of the interface between intelligent LCD touch display terminal and single chip microcomputer
Recommended ReadingLatest update time:2024-11-17 05:51
- Popular Resources
- Popular amplifiers
- Wireless Sensor Network Technology and Applications (Edited by Mou Si, Yin Hong, and Su Xing)
- Modern Electronic Technology Training Course (Edited by Yao Youfeng)
- Modern arc welding power supply and its control
- Small AC Servo Motor Control Circuit Design (by Masaru Ishijima; translated by Xue Liang and Zhu Jianjun, by Masaru Ishijima, Xue Liang, and Zhu Jianjun)
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!
- 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
- 2020 National College Student Electronics Contest Test Questions
- High voltage and small size: the latest technology trends of Nichicon's drive film capacitors
- [Chip] Interesting chips, interesting engineer souls
- Serial communication
- TMS320C6678DSP SRIO channel and frequency settings
- Should 5G be blamed for cheating in the college entrance examination?
- How to use DRV8703-Q1
- Installation and use of saleae logic analyzer
- Generate sawtooth wave
- With the 5G wave, it’s time to upgrade RF filters!