The electronic code lock is an electronic device that controls a circuit or microchip through password input, thereby managing the operation of a mechanical switch to complete the locking and unlocking process. It comes in various forms, ranging from simple circuit-based products to more advanced chip-based systems with high cost-performance ratios. The most commonly used electronic code locks are typically implemented using a microcontroller as the core component.
**Design Implementation Features**
- **Enter Password:**
(1) At the start, each digit of the digital display shows "meter," and the first digit of the password entry displays "meter." Pressing a number key allows you to select a digit.
(2) After pressing the "Confirm" button, the system moves to the next digit, repeating the same process.
(3) Once all four digits are selected, press the "Confirm Input" button to display the entered password.
(4) Press the "Unlock" button; if the password is correct, the screen will show "*YES" and the lock will open.
(5) If the password is incorrect, "ERRO" will be displayed, and the lock cannot be opened. Press the "Enter Password" button to re-enter the password.
- **Change Password:**
(1) When "*YES" is displayed, press the "Change Password" button and enter a new four-digit password.
(2) Press the "Confirm Input" button to display the new password, then press the "Confirm" button to set it.
- **Error Alert:**
If an incorrect password is entered more than five times, the system will automatically trigger an alarm. The alarm will only stop once the correct password is entered again.
**Hardware Circuit Design**
**Related Chip Introduction**
**1. 8255**
- First 8255:
The A, B, and C ports are set to output mode. The A and B ports control the input of the digital tube, corresponding to specific segment codes for display. The C port's PC0 and PC1 are connected to a 2-to-4 decoder to activate the four channels of the digital tube. The system cycles through 00, 01, 10, and 11 to achieve dynamic display.
- Second 8255:
All A, B, and C ports are set to input mode, detecting the status of buttons and enabling corresponding functions based on the program.
**2. 8253**
- This chip uses channel 0 in mode 3 to divide the input signal continuously. If the password is entered incorrectly more than five times, the 8253 is reset, and an alarm is triggered. When the correct password is entered, channel 1 is activated to provide an audio alert.
**3. 2-to-4 Decoder**
- Due to the fast speed of the 8086, the digital tube may not display properly. The 2-to-4 decoder is used to buffer the signals from PC0 and PC1, ensuring stable activation of the digital tube.
**4. 16-Digit Digital Tube**
- The 16-digit digital tube is controlled by 16 pins, with active-low configuration. AH controls the outer ring, while KM controls the inner * symbol. S1–S4 are channel control lines, which are active high.
**Simulation Circuit Overall Design**
- The experimental design includes the 8086 CPU, the programmable parallel interface 8255A, along with components such as the 74LS373 latch, 74LS245 buffer, and 74LS138 decoder. These components work together to implement the electronic lock.
**Switch Function**
- Port A’s PA0–PA7 connects to the digital tube via a latch for outer ring display, while PB0–PB7 connects to the internal “meter†character display through the 74LS373 latch.
**Software Programming**
- The software involves scanning for key inputs, comparing data to determine the correct digit to display, and automatically moving to the next digit after selection. Once all four digits are entered, the system checks the password accuracy and displays either "*YES" or "ERRO."
**Button Control**
- The control word for the 8255A input port is defined to manage the system's behavior during password entry and modification.
**Dynamic Character Display**
- After entering the password, the system displays the four digits, checks their validity, and outputs the result. Changing the password follows a similar process, with the system prompting for the new password and confirming the change.
**System Implementation**
- The Proteus simulation diagram shows the full setup, including one 8086 CPU, one 74LS245, one 8255A, three 74LS273 latches, one 74LS138 decoder, one digital tube, two NAND gates, eight switches, and eight resistors. This setup enables the successful simulation of the electronic code lock system.
Bang 3000 Puffs Vape
Longhua Manxueling Trading Company , https://www.mxlvape.com