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 taximeters to calculate the mileage traveled by the taxi using gear ratios, and then converted the fare to the mileage. However, mechanical gears are larger in size, the calculation is not very accurate, and they are easy to wear. Later, the sensor method was adopted, using the sensor to receive the running information of the car to calculate the mileage and fare. However, this method usually allows interference signals to also generate counting pulses, so it is not perfect. The author quotes microcontroller technology and uses encoding and decoding information transmission methods to complete the formation of meter counting pulses. The microcontroller can detect the sensor signal very accurately, so the pricing will be very accurate. The components required to complete this device are simple, the cost is very low, and it is technically easy to implement.
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 revolution of the rotating shaft is fixed, and when the rotating shaft rotates, it drives a small magnet to rotate, and its transmission ratio is also certain. The small magnet faces the magnetic induction sensor once every time it rotates, and the magnetic induction sensor will Generating a low pulse of about 20 ms, the mileage of the taxi and the corresponding fare can be calculated by counting 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 to be a signal generated by the sensor, it sends a set of codes to the decoder's microcontroller through another I/O port, and the decoder's microcontroller first Determine whether the data currently to be received is the encoding sent by the encoder or the decoding sent by the decoding writer. When it is determined that the decoding is sent by the decoding writer, the decoder's microcontroller receives the decoding and saves the decoding to 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 decoding. Encode, then read the decoded code in its own E2PROM, compare it with the received code, if they are the same, the decoder microcontroller will send a pricing pulse to the pricing device through an I/0 port, otherwise no pricing pulse will be sent. Note: The encoding and decoding of each taxi meter here are different, which is beneficial to the management of taxis and to prevent theft of the meter. The decoding in the decoder is written into its E2PRoM using a decoding writer. of. Each taxi meter has an encoder and a decoder, and all taxi meters share a decoding writer. In other words, before the meter is sold, the same decoding writer is used to write different initial decodes to the decoders of all meters. After writing the initial decoding, the meter no longer needs a decoding writer, unless the meter is broken and the decoder needs to be replaced. In this case, the decoding writer needs to be used to write the initial decoding to the new decoder. The hardware circuit design diagram is shown in Figure 2 and Figure 3.
2 Implementation of system functions
2.1 Sensor The
encoder part of this system uses a sensor to receive the running signal of the taxi. The sensor used here is a magnetic induction sensor. When it faces the small magnet driven by the vehicle's rotating shaft, the output pin of the sensor A low pulse of about 20ms will be generated.
2.2 Encoder
The microcontroller used in the encoder part is PIC12C508A. The fourth pin GP3 of the PIC12C508A chip is used to detect the output signal of the sensor. When a certain sensor signal is detected, 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 in a certain timing sequence. Each data is pulse-based. sent out. Whatever the decimal number is, just send a few low pulses, and the time it takes to send one decimal data must be within 255μs. The program flow chart is shown in Figure 4.
2.3 Decoding writer
The microcontroller used in the decoding writer part is AT89C51. The function of the decoding writer is similar to that of the encoder. Since the decoding sent must be able to be changed at any time, 5 small numeric keyboards can be connected here, and the decoding to be sent by the decoding writer can be obtained from the 5 small numeric keyboards. In order to distinguish it from the code sent by the encoder, the decoding writer needs to first send a distinguishing character so that the decoder can identify whether it is currently receiving data sent by the encoder or the decoding writer. The distinguishing character is followed by decoding. The sending method of all these data is exactly the same as that of the encoder encoding. It is output by the P3.4 port of the AT89C51 microcontroller. The program flow chart is shown in Figure 5.
2.4 The microcontroller
used in this part of the decoder is PIC12CE5C18, which has E2PROM inside. You can use the I2c protocol to read and decode from the E2PROM at any time or write new codes to the E2PROM. 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 into 5 internal data storage units respectively. Then call the receiving data subroutine to receive 1 data and save it to an internal data storage unit first to determine whether the data is the 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 it to 4 internal data storage units. The received 5 decimal data will be decoded with the previous one. Compare the five decimal data from 00h to 04h in the internal E2PROM read by the device. If they are equal, a 2 ms low pulse will be sent on the GP0 pin as a pricing pulse. If they are not equal, the data will be received again. If the difference character is 10, it means that if the decoding writer wants to modify the decoding of the decoder, it must immediately receive the 5 data following the difference character, and save these 5 decimal data to 00h~04h of E2PROM, overwriting the previous ones. decoding. The program flow chart is shown in Figure 6, and the subroutines called are shown in Figures 7 and 8.
Conclusion
This system solves the shortcomings of previous taxi meters such as inaccurate pricing and short service life. It now uses coding and decoding technology with a single-chip microcomputer as the main control unit, so that each taxi meter has a different code, thus preventing taxis from entering each other. Mutual theft of taxi meters facilitates taxi companies' management of taxis. At the same time, the peripheral circuits of the microcontroller can be expanded at any time, and the system can be continuously upgraded through software programming.
Previous article:Pulse coding sensor implemented using single-chip microcomputer
Next article:Micropower Chinese human-machine interface design based on MSP430 microcontroller
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
- [MSP430F5529 Review] 7. TFT Color Screen Snake
- TI C2000 Basic Learning
- Interest group training topic: Use MOS tube or + op amp to realize a DC/DC closed-loop voltage regulator
- Simple square wave generator based on 51 single chip microcomputer
- MSP430fr6989 serial port DMA sending experimental routine
- [RISC-V MCU CH32V103 Review] First impression of CH32V103C8T6 chip
- 100 check items for PCB design to ensure you have no problems with your design!
- How to write the corresponding program process according to the timing diagram
- Differences and similarities between detection circuits, filter circuits, frequency selection circuits, threshold comparison circuits, and bandpass circuits
- When designing PCB, how to consider electromagnetic compatibility EMC/EMI, specifically...