Motor vehicle tail number restriction reminder

Publisher:Aq123456258Latest update time:2011-02-21 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

The number of the motor vehicle "restriction by the last digit" makes many car owners with poor memory confused about the restriction date. Especially for those who have more than one car at home, it is easy to say but difficult to do to remember the restriction date of two cars and the number of the two cars. This article introduces a motor vehicle restriction controller with the last digit, which can solve the above troubles of drivers.

1. Circuit composition and principle

The controller circuit is shown in Figure 1. It consists of an input circuit, a date generation circuit, an LCD display circuit, an output control circuit, a single-chip microcomputer, and a power supply. The tail number of the license plate is input into the DS1302 chip through the DIP switch S1. When the driver starts the car, the controller will automatically compare it with the restricted license plate number. If the day is a restricted day, a prompt message will be displayed on the LCD screen, and the starter motor switch line will be cut off to prevent the car from starting; if the day is not a restricted day, the car can be used normally.

1. Input circuit

Since the license plate number, date and time do not need to be input frequently, the input circuit uses a DIP switch S1 and four 10kΩ resistors to form a keyboard circuit. The DIP switch is shown in Figure 2. Its advantages are small size and high reliability. Switch 1 in S1 is a restriction selection switch. When it is in the OFF position, the restriction control is cancelled and the controller does not work. Only when it is in the ON position, the motor vehicle tail number restriction controller will work. Switch 2 is a function selection switch, which can select different input functions. Switch 3 is a digital "plus" key, and switch 4 is a digital "minus" key. By using switches 2, 3, and 4 in combination, the initial year, month, day, hour, minute, second and the tail number of your own license plate can be set for the controller.

Figure 1 Motor vehicle license plate restriction controller circuit

Figure 2 DIP switch

2. Date generation circuit

The chip model of the date generation circuit is DS1302, and its pin diagram is shown in Figure 3. It is a high-performance, low-power clock chip, including a real-time clock/calendar and a 31-byte static RAM, which can count seconds, minutes, hours, days, weeks, months, and leap years in real time. The 31-byte high-speed RAM can store data for a long time through an external rechargeable battery. During normal operation, the DS1302 chip can also charge the battery slowly. It can work reliably under a 2.5-5.5V power supply, and consumes less than 300nA at 2.5V. When the main power is turned off, the clock can keep running continuously. The DS1302 chip has 8 pins, and pins 2 and 3 X1 and X2 are crystal pins, and the frequency of the crystal is 32.768kHz. Pin 1 is the main power pin VCC2, and pin 8 is the backup power pin VCC1. When VCC2 is less than 0.2V of VCC1 voltage, VCC1 supplies power to the DS1302 chip. Pin 5 is the reset pin, and RST is valid at low level. Pin 7 is the serial clock pin SCLK. Pin 6 is the serial data input/output pin I/O, which works with SCLK to exchange data with the microcontroller. Pin 4 is the power ground.

Figure 3 DS1302 pin diagram

Figure 4 Power supply circuit

3. LCD display circuit

The LCD display circuit uses 12232F, which has 8192 16×16 dot Chinese characters and 128 16×8 dot ASCII character sets built in. It is mainly composed of row driver/column driver and 128×32 full dot matrix LCD display. It can complete graphic display and can also display 7.5×2 (16×16 dot matrix) Chinese characters. It exchanges data with the microcontroller in serial mode. 1 2 2 3 2 F has 8 pins, pin 1 is the power ground VSS. Pin 2 is the power positive VDD (3.0~5.5V). Pin 3 is the contrast adjustment V lcd. Pin 4 is the serial synchronous clock input pin CLK, and the SID data is read on the rising edge. Pin 5 is the serial data input pin SID. Pin 6 is the chip select pin, which is valid at high level. Pin 7 is the backlight positive BL+. Pin 8 is the backlight negative BL-.

4. Output control circuit

The output control circuit is composed of R2, VT1, VD1, and K1. VD1 is a protective tube to prevent the induction voltage generated by K1 from damaging VT1 when VT1 is turned off. When the control system determines that the car with the tail number is restricted today, P1.3 of IC2 outputs a high level to saturate VT1, K1 coil is energized, the normally closed contact is disconnected, and the motor vehicle start switch line is disconnected, so that the motor vehicle cannot start. At the same time, the LCD screen displays the message "Cannot drive today" to remind the driver to pay attention.

5. MCU and power supply

In order to facilitate everyone's production, this controller uses AT89C2051 as the control core. Since its internal program memory is Flash, it is very convenient and quick to modify the internal program, as long as you are equipped with a programmer that can program 89C2051. The debugger can use the method of repeated cycles of program editing, compiling, solidification and inserting into the circuit board for testing. For most people, this debugging method is not difficult. AT89C2051 is a 20-pin 8-bit high-performance microcontroller compatible with 8051. In Figure 1, C1, C2, crystal and the internal circuit of the microcontroller form a clock circuit. C3 and R3 form a power-on reset circuit. The power supply of this controller is taken from the Acc line of the car, and a stable 5V power supply voltage is provided through the 7805 voltage regulator. The power supply circuit is shown in Figure 4, where C1, C2 and C3 are filter capacitors.

2. Program Structure and Principles

The program is written in C language, and its program structure includes parameter input module, display module and control output module. In the parameter input module of the program, the programming of DS1302 clock chip is mainly involved. Through the input module program, the initial value of year, month, day and time is set for DS1302, and then the tail number of the license plate is entered.

The program first checks the P3.1 pin connected to switch 2 of S1. Every time a pulse is detected, the value of the "Function Selection" variable increases by 1. The specific parameters to be input are determined by the value of the variable "Function Selection", see the attached table.

Figure 5 Program flow chart

Appendix Function Key Description

Then check the P3.2 pin connected to switch 3 of S1. Every time a pulse is detected, add 1 to the corresponding variable. For example, the "Function Selection" variable = 7, which means that the license plate number should be entered. Every time the P3.2 pin receives a pulse, the license plate number variable is increased by 1. Every time a pulse is input to the P3.3 pin connected to switch 3 of S1, subtract 1 from the corresponding variable.

The display module mainly involves programming the 12232F chip, including liquid

The LCD initialization part program and the program that writes commands and data to the 12232F chip. The LCD initialization part program is placed in the initialization part of the total program. Since the 12232F chip itself has a built-in 8192 16×16 dot Chinese character library and 128 16×8 dot ASCII character set graphic dot matrix library, its programming is relatively simple.

In the control output module program, first detect the P3.0 pin, which is connected to the switch 1 of S1. When P3.0=0, it means that the restriction is cancelled, so that the P1.3 pin outputs "0", the transistor VT1 is cut off, the relay K1 does not work, the normally closed contact of K1 is in a closed state, the car starter switch line is connected, and the driver can start the car. When P3.0=1, it means that the restriction is to be carried out. At this time, the program takes out the date of the day from the DS1302 chip, calculates the restricted number of the day, and compares it with the tail number of the car. If they are the same, P1.3=1, the transistor VT1 is saturated and turned on, the relay K1 is energized, the normally closed contact of K1 is disconnected, the motor vehicle starter switch line is disconnected, the driver cannot start the car, and the LCD screen displays the message "You cannot drive today" to remind the driver.

If they are different, P1.3=0, transistor VT1 is cut off, relay K1 does not work, the normally closed contact of K1 is in a closed state, the car start switch line is connected, and the driver can start the car.

Reference address:Motor vehicle tail number restriction reminder

Previous article:Common methods and countermeasures for MCU cracking (I)
Next article:Trial Notes on PIC12F675 Microcontroller

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号