An FPGA Design and Application of Taxi Meter

Publisher:EternalBlissLatest update time:2010-01-06 Source: 西安通信学院Keywords:FPGA  Max+Plus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

O Introduction

FPGA (Field Programmable Gate Array) is a high-density programmable logic device that supports system programming and can implement different logic functions by writing different configuration data. Using FPGA to design electronic systems has obvious characteristics such as short design cycle and easy modification. It is particularly suitable for scientific experiments, prototype development and small-batch production of electronic products.

In this paper, a taxi meter is designed based on FPGA devices using EDA tool software Max+P1usⅡ. It can intuitively display the mileage of the taxi and the fees payable by the passengers in the form of decimal numbers, and has certain practical application value.

1 System Design Requirements

The taximeter to be designed is required to display the mileage and the fare to be paid by the passenger, with the mileage accurate to 0.1 km and the fare to be paid by the passenger accurate to 0.1 yuan, and the display must be in decimal form. The taxi fare standard is: the starting fare is 6 yuan, and the mileage is the starting fare within 3 km; when the mileage is between 3 and 7 km, 1.6 yuan will be added for every kilometer traveled; when the mileage exceeds 7 km, 2.4 yuan will be added for every kilometer traveled.

2 System Design

The system can be designed with discrete components or with a single-chip microcomputer. The use of programmable FPGA has obvious characteristics such as short design cycle and easy modification. With the rapid development of programmable logic devices and EDA software, more and more electronic systems are designed with FPGA. Once the system reaches a certain scale of mass production, it is also easier to convert it into ASIC chip design. Therefore, a taxi meter is designed based on FPGA. In the EDA tool software MAX+plusⅡ, this system uses a combination of hardware description language Verilog HDL and schematic design to design each module, and finally composes each module into the entire system.

Taxis can display the mileage they have traveled by generating pulses through the rotation of the wheels, and then counting the pulses through a counter. Assume that a taxi generates a pulse every 2 meters it travels. Since the mileage must be accurate to 0.1 km, that is, 100 meters, a new pulse signal must be output every 50 pulses, which is called the 100-meter pulse signal. As the clock signal of the mileage counter, it can be obtained by dividing the frequency with a counter with a modulus of 50.

The mileage counter can be realized with a three-digit BCD code counter, which can display up to 999. The first two digits are integers, and the third digit is a decimal, which means that the maximum mileage that can be displayed is 99.9 km. Since taxis are mostly in urban areas and suburbs, the three-digit BCD code counter can realize mileage counting. The mileage counter will also periodically output a pulse signal every time it counts 1 km, which is called a 1 km pulse signal, which can be realized through a certain combination circuit.

The core part of the system is how to implement the charging. Here we need to design a BCD code adder. Based on the starting price, according to the different mileage and the charging standard, a unit price is added for each additional km. The unit price can be generated by programming in Verilog HDL. The overall design block diagram of the system is shown in Figure 1.

Overall design diagram of the system

2.1 Unit price generation module

The Verilog HDL source program of the unit price generation module is as follows:

program

The input signals bai and shi are the two-digit integer mileage output by the mileage counter, and the output signal jia is the unit price generated according to the charging standard, which is output in the form of a three-digit BCD code, with the first two digits being integers and the third digit being a decimal. That is, when the mileage is within 3 km, jia=0; when the mileage is between 3 and 7 km, jia=016 (1.6 yuan); when the mileage exceeds 7 km, jia=024 (2.4 yuan).

The advantage of using Verilog HDL to write programs to implement module functions is that when the taxi fare standards change, the new design can be easily completed by rewriting the program, which is much more convenient than modifying the hardware circuit. This is also an important advantage of using Verilog HDL to implement module functions. [page]

2.2 Three-digit BCD code adder

The system uses a three-digit BCD adder, which can perform three-digit decimal addition operations. The output of the adder is the fare that the passenger has to pay. Here, the first two digits are integers, and the third digit is a decimal, which means that the maximum that can be displayed is 99.9 yuan. The three-digit BCD adder is composed of three one-digit BCD adders cascaded together.

A single-bit BCD code consists of four binary digits. The addition of four binary digits will produce a number greater than 9, and appropriate adjustments must be made to produce the correct result. The Verilog HDL source code of a single-bit BCD code adder is as follows:

program

The simulation waveform and generated module symbol of a one-bit BCD code adder module are shown in Figures 2 and 3.

Simulation waveform of BCD code adder module

Block symbol generated by the BCD code adder module

In this module, A and B are the input BCD codes, CIN is the carry signal from the low bit, CO is the carry output signal generated by this chip to the high bit, and SUM is the sum of two numbers. The three-digit BCD code adder is composed of three cascaded modules. Its circuit schematic and simulation waveform are shown in Figures 4 and 5.

Circuit Schematic

Simulation waveform [page]

2.3 Buffer module

The output of the three-digit BCD code adder passes through the buffer and is fed back to the input end as an addend. Under the action of the 1km pulse signal, each pulse is added to the unit price to form a continuous accumulation function. The buffer also has a control input terminal LD. When LD=0, under the action of the 1km pulse, the output starting price is 6 yuan; when LD=1, under the action of the 1km pulse, the output is equal to the input. The Verilog HDL source program of the buffer is as follows:

program

2.4 Overall Circuit

Connecting each module into an overall circuit according to the input-output relationship is shown in Figure 6.

Connect each module into an overall circuit according to the input and output relationship

In the overall circuit, clk is the original clock input terminal, cr is the asynchronous reset terminal, q[11. . O] outputs the mileage, and jiaqian[11. . O] outputs the fare that the passenger should pay.

3 System Simulation Verification

The simulation waveform of the overall circuit is shown in Figure 7.

Simulation waveform of the overall circuit

It can be seen from the system simulation waveform 7(a) that when the reset terminal cr=0, the mileage is immediately reset, and the fare to be paid by the passenger is displayed as a three-digit decimal number 060 (starting price 6 yuan), indicating that the passenger has just boarded the car. When the reset terminal cr=1, the taxi starts to move, and the mileage and fare are counted. The mileage is displayed as a three-digit decimal number, with the first two digits being integers and the third digit being a decimal, that is, it is counted once every 100 meters.

It can be seen from the system simulation waveform 7(b) that when the vehicle travels 3 km, the cost increases from 6 yuan to 7.6 yuan, and when the vehicle travels 4 km, the cost increases from 7.6 yuan to 9.2 yuan. When the vehicle travels between 3 and 7 km, the cost increases by 1.6 yuan for every kilometer traveled.

The system simulation waveform in Figure 7(c) shows the gradual accumulation of costs after every 1 km of driving. The system simulation waveform fully verifies the expected design requirements.

4 Conclusion

The simulation verification shows that the taxi meter designed in this paper can normally display the mileage and the fees to be paid by passengers, which meets the predetermined charging standards and functional requirements. The design based on FPGA has high integration and short design cycle. Especially when the charging standards change, it is easy to complete the new design by rewriting the Verilog HDL source program.

Keywords:FPGA  Max+Plus Reference address:An FPGA Design and Application of Taxi Meter

Previous article:Design of DSP external E2PROM interface based on SPI
Next article:Modification and testing of OC8051 IP core on FPGA

Recommended ReadingLatest update time:2024-11-16 23:52

Research on Hardware Circuit Design of PCB Tester Based on FPGA
Introduction The basic test principle of PCB bare board tester is Ohm's law. Its test method is to add a certain test voltage between the points to be tested, select the two points to be tested on the PCB board with a decoding circuit, obtain the voltage signal corresponding to the resistance value between the two po
[Test Measurement]
Research on Hardware Circuit Design of PCB Tester Based on FPGA
A solution to implement DSP on FPGA based on C language
Hardware designers have begun to adopt FPGA technology in high-performance DSP designs because it can provide 10-100 times faster computing than PC-based or microcontroller-based solutions. Previously, it was difficult for software developers who were not familiar with hardware design to take advantage of FPGAs, but n
[Embedded]
A solution to implement DSP on FPGA based on C language
Design of Multi-channel SSI Communication Controller Based on FPGA
Using VHDL hardware description language and Xilinx FPGA as the design platform, the control unit with open source soft core MC8051 as the core is designed to control the SoPC architecture communication controller of 4-way SSI protocol modules, and the communication controller is functionally simulated and verified.
[Industrial Control]
Design of Multi-channel SSI Communication Controller Based on FPGA
Smartly Expand Microprocessor Connectivity Using Low-Cost FPGAs
Challenges of Microprocessor Interconnection Microprocessors are an indispensable component in modern electronic system design. However, as systems become more complex, with more extensive functions and user interfaces, system architectures using mid-range microprocessors face three key challenges when connecting one
[Power Management]
Smartly Expand Microprocessor Connectivity Using Low-Cost FPGAs
LabVIEW FPGA and software design RF instrument advantages detailed explanation
    Overview   The number of wireless devices, the diversity of communication standards, and the complexity of modulation schemes continue to increase every year. With the birth of each new generation of technology, the cost of testing wireless devices using traditional technology requires a large amount of more
[Test Measurement]
LabVIEW FPGA and software design RF instrument advantages detailed explanation
FPGA Design and Simulation of Quadrature Amplitude Modem
Abstract: Quadrature amplitude modulation (QAM) is a relatively efficient channel modulation technology in terms of power and bandwidth, so it has been widely used in channel modulation technology. The FPGA implementation of its carrier signal generally adopts the lookup table method, which consumes a lot of ROM res
[Industrial Control]
FPGA Design and Simulation of Quadrature Amplitude Modem
FPGA Power System Management
Introduction   The origins of field programmable gate arrays (FPGAs) can be traced back to the 1980s, evolving from programmable logic devices (PLDs). Since then, FPGA resources, speed, and efficiency have improved rapidly, making FPGAs the solution of choice for a wide range of computing and processing applications,
[Embedded]
FPGA Power System Management
Design and implementation of GPS baseband verification system based on FPGA prototype
As the complexity of SoC design increases, the time required for verification has accounted for more than 70% of the entire design cycle. How to reduce verification time has become a very important issue. The GPS baseband chip is a typical SoC, and its main functional module is the correlator, which is used to demod
[Embedded]
Design and implementation of GPS baseband verification system based on FPGA prototype
Latest Embedded Articles
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号