• Inventory
  • Products
  • Technical Information
  • Circuit Diagram
  • Data Sheet
Technical Information
Home > Technical Information > EDA/PLD/PLC > Taxi Meter Based on CPLD/GA

Taxi Meter Based on CPLD/GA

Source:allen0312
Category:EDA/PLD/PLC
2023-05-28 05:02:58
34

With the rapid development of EDA technology, the design technology and tools of electronic systems have undergone profound changes. The appearance of large-scale programmable logic device CPLD/GA has brought many conveniences to designers. It not only has low cost, short cycle and high reliability, but also has complete intellectual property rights. This paper introduces a taxi meter system which is composed of Altera programmable logic chip EPM7128SLC84-15 as control and some peripheral circuits.

1 System Composition

The composition of a taxi meter based on CPLD/GA is shown in Figure 1. The main functions of each part are as follows: (1) A counter counts the pulse signals from wheel sensors (one pulse per turn). Wheel diameters may be different for different types of vehicles. Select the car type by setting 1 to adjust the car with different wheel diameters. (2) The B counter accumulates the 100m pulses and outputs the BCD code of the actual kilometer to the decoding dynamic scan module. A pulse is sent to the C counter for each full 500. Setup 2 achieves the prefabrication of starting kilometers. (3) The C counter achieves a cumulative count of variable step sizes (i.e., adjustable unit price) and charges every 500 meters. Set-up 3 is used to complete overpricing, starting price pre-preparation, etc. (4) Decoding/dynamic scanning decodes the distance and cost values and drives the digital tube by dynamic scanning. (5) The display of the digital tube will use four-digit LED digital tube to display kilometers and billing amounts (three integers, one decimal digit).

2 Module Design

Taxi meter is composed of model adjustment module, metering module, billing module, decoding dynamic and scanning module. The whole system is designed with module. First, the function modules are written with VHDL, and then the top-level schematic diagram is used to connect the function modules.

2.1 Model Adjustment Module

Taxi models are not single, and tire diameters vary from model to model. According to the survey and statistics, there are roughly four types of taxi tire diameters, 520mm, 540mm, 560mm and 580mm, respectively. To make taxis of different types send out a pulse for every 100 meters they drive, this can be done by setting the factor of the Predictable Frequency Divider. The frequency division coefficients calculated from the above wheel diameters are 61, 59, 57 and 55, respectively. Pre-fabricated data is controlled by two car type setup switches. The relationship between DIP switch status and wheel diameter is shown in Table 1 (Table "1" is high level and "0" is low level).

Table 1 Type setup


In parameter prefabrication, use With_ Select statement (lookup table method) to make crossover selection:

With cartype select

Typecounter<= "111101" when "00", --520mm

"111011" when "01", --540mm

"111001" when "10", - 560mm

"111000" when "11", --580mm

"000000" when others;

The frequency divider uses an additive frequency circuit, whose duty cycle can be adjusted by datal(x), and the frequency divider has a "start" / "clear" end (high level clear). The time series simulation waveform is shown in Figure 2. As you can see from the diagram, for the model with the switch set to "10", when the 57th pulse arrives, the oclk end of the module changes from high to low and outputs a low level signal. The vehicle type adjustment module (hereinafter referred to as FP) is encapsulated in Figure 4.

2.2 Metering Module

The range module is an additive counter with a modulus of 10 and a step size of 1. The module can pre-fabricate parameters so that when the actual count value is greater than the pre-fabricated value, a pulse is sent every 500 meters, and the count value is sent to the decoding dynamic scan module for display. The precompressed parameters use uncompressed BCD codes, so binary 1010 to 1116 States must be skipped when the counter is designed. In VHDL program, it is implemented with IF statement.

If km(3 downto 0)=1001 then km:=km+"0111":

Else km: =kin+1;

End if;

The meter module also has a Start/ Zero end. Parameter prefabrication also uses With_ Select statement. The relationship between Start Mileage and Switch Settings is shown in Table 2. The meter module (hereinafter referred to as MILE) is encapsulated in Figure 4.

Table 2 Start Mileage Settings

2.3 Billing Module

The billing module is an additive counter with a modulus of 10 and variable step size. The module prefabricates the step by switching on and off, and changes the step when a certain prefabricated parameter is exceeded. The billing module also uses uncompressed BCD code, but since the step size is not 1, it must be adjusted when adding uncompressed BCD, otherwise overrun errors may occur when the preset parameters are exceeded or not exceeded. Here we use AF marker bit which imitates a computer to set up a half-carry mark. When the sum is greater than 9 or the half-carry mark is "1", the sum and adjustment are made.

If datal (3 downto 0) > 9 or datal(4) ='1'then'

Datal (3 downto 0): = datal (3 downto 0) + 0110;

Datal (8 downto 5): =datal (8 downto 5)+1;

End if;

Where data (4) is a half-carry flag. The starting price and overcharge setup parameters are shown in tables 3 and 4, respectively. The billing module (hereinafter referred to as MONEY) is encapsulated in Figure 4.

Table 3 Starting Price Settings

Table 4 Overprice plus settings

2.4 Display Module

The display module consists of seven segments of LED digital tube decoding and dynamic scan display.

2.4.1 Seven Segments LED Digital Tube Decoding

This design uses a seven-segment cathode digital tube. According to the corresponding relationship between the hexadecimal number and the seven-segment display segment code table, the With_of VHDL is used. Select or When_ Else statements are easy to decode.

2.4.2 Dynamic Scan Display

Dynamic scanning uses the visual persistence principle of the human eye. As long as the scanning frequency is not less than 24Hz, the human eye will not feel the flicker of the display. The scanning pulse of the system at 24Hz is supplied by the corresponding peripheral circuit. The key to the design of dynamic scan circuit is that the bit selection signal corresponds to the displayed data in time sequence, so the synchronous pulse signal must be provided in the circuit. Here, the octal counter is used to provide the synchronous pulse, and the VHDL program segment is as follows:

CIkl_ Label:PROCESS(scp)

BEGIN

IF scp'vent and scp='1'THEN count<= Count+1;

END IF;

END PROCESS clkl_ Label;

The selection of display data is controlled by a counter, and the VHDL program segment is as follows:

Temp<= Counterl when count="000" else...

Counter4 when count="011" else

Milel when count="100" else...

Mile4 when count="111";

Bit-selected signal time series simulation is shown in Figure 3. From the time series simulation diagram and the above program, it can be seen that the bitwise signal and the data to be displayed are synchronized.

The display of decimal points in the dynamic scan circuit cannot be completed in the decoding circuit. Since the position of the decimal point is fixed, another signal can be generated to control the DP by the synchronization signal provided by the counter. The VHDL program is implemented as follows:

If (count:'101'or count='001') then data (0)< =' 1';

Else data(0)<=' 0';

End if;

The display module (SHOW) is encapsulated in Figure 4. Two processes are applied in this module, one of which triggers the second process.

3 Systems Integration

3.1 Module Debugging

After the design of each function sub-module is completed, each function sub-module (.sym) is connected by the Graphic Editor of MAXPLUS II. Because of the burrs in the MILE module, it is not possible to connect directly to the rear stage. The burrs can be eliminated by delaying the output pulse signal with the gate circuit and then "and" the original signal. The top-level schematic diagram of the system is shown in Figure 4.

Chip pin definitions can be made directly by editing the.Pin file or under Floor-Plan Editor. Select the device after the pin definition (EPM7128SIC84-15), compile and generate.Sof,.Pof, and report file.rpt. View the report file to get the usage of the device pins and the internal resources of the device. Allocate resources by replacing the appropriate devices. The general principle for choosing devices is that the resources used by the system should not exceed 80% of the device resources. If the resources exceed 90%, the power consumption of the system will increase and the operation will be unstable. From the part report of this design device, we know that 16 input and output pins are used respectively, and the utilization rate of chip resources is only 51%, which has a large expansion space.

3.2 Hardware design instructions

The taxi meter count pulse CP in this design comes from the wheel speed sensor (reed), and the pulse is sent to the counter through the internal shaping of the device. The dynamic scan pulse is given by the peripheral circuit. The system is powered by taxi power supply after rectification, filter and voltage reduction. Due to the limited drive capability of CPLD/GA, in order to enhance the brightness of the digital tube and improve the reliability of the system, the current driver ULN2803 and 2SCl015 are added to the LED driver and bit driver respectively.

Field experiments show that the meter can automatically charge according to the prefabricated parameters (the billing amount is 999.9 yuan), and automatically count (the kilometer is 999.9 kilometers). Prefabrication of parameters such as starting price, toll per kilometer, car type and toll mileage can be achieved (e.g. starting price 5.00 yuan; 1.20 yuan per kilometer after 3 kilometers; charging more than 15.00 yuan, 50% of toll per kilometer, etc.) and the preset parameters can be adjusted in a wide range. Due to the use of large-scale programmable logic devices such as CPLD/GA, the whole machine consumes less power, has strong anti-jamming ability, is stable, reliable and easy to upgrade. In addition, according to the actual needs, the system can easily add the following functions: 1) Increase the clock function through the internal programming of the chip (the internal resources of the device are sufficient), which can provide convenience for drivers and passengers, as well as provide reference for the automatic adjustment of toll standards for night driving; 2. The voice chip can be controlled by the output lead of CPLD/GA, which can send greetings to passengers, remind passengers to tell the driver where to arrive, and report the charges that should be collected.




Reference:

[1].CPLDdatasheethttp://www.dzsc.com/datasheet/CPLD_1136600.html.
[2]. EPM7128SLC84-15 Datasheethttp://www.dzsc.com/datasheet/EPM7128SLC84-15_1054460.html.
[3].BCDdatasheethttp://www.dzsc.com/datasheet/BCD_1225719.html.
[4].ULN2803datasheethttp://www.dzsc.com/datasheet/ULN2803_672280.html.


Source:Xiang Xueqin