Design of multi-user password lock based on AT89C52 single chip microcomputer

Publisher:心若清泉Latest update time:2011-08-25 Keywords:AT89C52 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Security and anti-theft have become a social issue. Locks have been the iron generals guarding the door since ancient times. People have high requirements for them. They must be safe and reliable against theft and easy to use. This has also been the theme of lock makers' research for a long time.

The electronic combination lock designed in this article is similar to the AB lock sold on the market, but the main difference is that the owner of this combination lock decides the password for guests to enter, and there is no need to change the lock to prevent people who have used the lock from entering again, and only the owner has the right to modify the password.

1 Design Idea

The multi-user password lock in this article has an administrator user who has the right to modify the password. There are also two guest users who can unlock the lock according to the password provided by the administrator, but they cannot modify the password at will. When changing residents, only the administrator needs to change the password, which avoids the trouble of changing the lock and saves costs.

The design of the password lock is made of a universal board, so it involves the arrangement and routing of components. Since there is an administrator user (master user), he can modify the passwords of himself and two guest users, and the two guest users' right to modify the passwords must be restricted. Therefore, the password modification procedure needs to be carefully handled. There are two conditions when entering the password modification procedure. First, the system is entered by the master user; second, the password modification button is pressed. Special attention should also be paid to the password input procedure to distinguish and confirm which user enters the current system, that is, the user name and password must be matched, which is also the key to the design.

2 System Structure and Principle

2.1 System Structure

The multi-user password lock circuit design is divided into 6 parts: power supply, user display unit, crystal oscillator circuit, keyboard circuit, programming control part, and function display unit. Through typesetting and layout, these 6 parts are combined to form a complete multi-user password lock control circuit, as shown in Figure 1.

Multi-user password lock circuit design www.elecfans.com

2.2 System Principle

First, a crystal oscillator circuit is required to generate a working clock and send it to each component inside the microcontroller to make it work normally. Secondly, the parallel port P1 of AT89C5l is used to connect a 4×4 matrix keyboard, with P1.0~P1.3 as output lines and P1.4~P1.7 as input lines. The row and column lines of the matrix communicate with the CPU through two parallel interfaces respectively. The combination of row and column values ​​obtained by scanning is used to identify the code of the pressed key to complete the input of the password, the input and switching of the user name, as well as the input of the confirmation, cancel command, password modification command, user switching command and lock command. Furthermore, the microcontroller transmits the data signal to be displayed to the digital tube through the P2 port, directly controls the display of the digital tube, thereby lighting up the digital tube and displaying the current user. The entire system realizes the realization of various signal prompt functions.

3 Circuit design of each functional module

3.1 Keyboard Circuit

To enter the password of the password lock, you must use the keyboard. The keyboard is designed to be 4×4. In addition to the 10 numeric keys from 0 to 9, there are also "OK", "Cancel", "Password Modification", "Lock", "User Switch", and "Display Switch". The 4×4 matrix arrangement can effectively save port resources and avoid the use of port expansion modules. When the keyboard is installed, the keys are arranged in a matrix in a 4×4 format. Connect pull-up resistors to the P1.4~P1.7 output lines so that the ports can be accurately set high and low. The other end of the pull-up resistor is connected together to a 5 V power supply. The circuit is shown in Figure 2.

3.2 Display Circuit

The circuit mainly uses seven-segment digital tubes. The single-chip microcomputer transmits the data signal to be displayed to the digital tube through the P2 port, directly controls the display of the digital tube, and thus lights up the digital tube. Since the clock frequency of the single-chip microcomputer reaches 12 MHz, it is not possible to see the data being transmitted one by one. From the perspective of human vision, it is as if all digital tubes are displayed at the same time. The single-chip microcomputer controls the digital tube to display 1 to 3, representing 3 users respectively. The hardware circuit is mainly that the a to g of the 7-segment display decoder is connected to the P2.0 to P2.6 of the single-chip microcomputer, and the value to be displayed is obtained by looking up the table. The circuit is shown in Figure 3.

4 Software Design

4.1 Software Design Concept

The whole system is designed to distinguish the entry of three users. Only the main user can modify his or her own and the guest user's passwords after entering. Other users cannot modify their passwords after entering.

The program design mainly includes the password modification program, password input program, alarm program, key scanning program, numeric key conversion program and function key conversion program. During the operation of the entire program, the key scanning program is placed in the interrupt service subroutine and scans every 150ms. In the design of the password modification program, each user has been marked when entering the system to ensure that when the password is modified, it can be accurately identified which user modified the password and whether the user has the right to modify the password.

4.2 Design of the main program

First determine whether the password is entered. If the password is entered, enter the password into the password input buffer. After the password is entered, perform a password comparison to distinguish which user enters the password lock system. After the comparison is successful, use the flag to distinguish the master user from the guest user. In the password modification program. First, determine whether it is the master user. Secondly, determine whether there is a password modification requirement. If the above two conditions are met, enter the password modification program. If the two new passwords are the same, it means that the password modification is successful. Next is the alarm subroutine, which uses the register to accumulate the number of consecutive incorrect passwords entered. If it reaches 3 times, an alarm signal is generated. Finally, there is a display subroutine to display the current user entering the system. The main program flow chart is shown in Figure 4.

5 Conclusion

The password lock designed in this paper can ensure that the password can be modified by the authorized user, and also restrict the user from modifying his or others' passwords. Taking the AT89C52 single-chip microcomputer chip as the core, the overall system design, hardware module circuit and software design are given.

Keywords:AT89C52 Reference address:Design of multi-user password lock based on AT89C52 single chip microcomputer

Previous article:Car temperature control system based on single chip microcomputer and CDMA
Next article:Development of Short Message Terminal Phone Based on 80C31

Recommended ReadingLatest update time:2024-11-16 21:40

Practical USB interface design based on CH371
Universal Serial Bus (USB) is a new generation bus interface standard jointly launched by seven world-renowned computer and communication companies, including Intel, Compaq, Digital, IBM, Microsoft, NEC, and Nerthern Telecom. As a high-speed communication interface between PCs and peripherals, USB has the advantages
[Microcontroller]
Practical USB interface design based on CH371
Knob-type keyboard and its interface technology with AT89C52
Introduction Nowadays, single-chip microcomputer technology is developing rapidly, and single-chip microcomputer systems have been widely used in various fields of the national economy. Many single-chip microcomputer application systems require input devices, and the typical input device is the key
[Microcontroller]
Knob-type keyboard and its interface technology with AT89C52
Design of interface between 51 single chip microcomputer and ARINC429 aviation bus
1 Main functions of DEI1016 DEI1016 is a serial receiving and transmitting device produced by Device Engineering Instrumented that supports the ARINC429 aviation bus protocol. The main functions of this device are as follows: ●Serial data word length is 32 or 25 bits; ●Serial data rate is 100k
[Microcontroller]
Design of interface between 51 single chip microcomputer and ARINC429 aviation bus
Schematic diagram of infrared remote control transmitter circuit of remote control fan system
    As shown in the figure, this is the infrared remote control transmitter circuit diagram.     In the figure, the single-chip microcomputer uses AT89C52, which is the main chip of the remote control circuit. The AT89C52 single-chip microcomputer produced by ATMEL uses a high-performance static 80C51 design and is ma
[Microcontroller]
Schematic diagram of infrared remote control transmitter circuit of remote control fan system
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号