Difficulty: Intermediate
Use a 4x3 matrix keypad and a 16x2 LCD to create a password-based lock. The AT89C2051 checks the entered code against a stored value and triggers a relay (e.g., for an electric strike or solenoid lock). You can store a default password in code, or add an EEPROM like the 24C02 to make it changeable. at89c2051 projects
Key learning: Matrix scanning, LCD interfacing (4-bit mode saves pins), relay drivers. Difficulty: Intermediate Use a 4x3 matrix keypad and
Rows to P3.0-P3.3 (outputs), Columns to P1.0-P1.3 (inputs with pull-ups). Scan the keypad using the classic row-scan method. Compare two voltages on P1
VCC ──┐ ┌── GND
RST --[10k]--VCC
XTAL1--||--GND (22pF)
XTAL2--||--GND (22pF)
P1.0 ──> LED (+resistor)
P3.0 (RxD) / P3.1 (TxD) for serial
Compare two voltages on P1.0 (AIN0) and P1.1 (AIN1). Output to P3.6.
P1 |= 0x03; // disable digital input on P1.0/P1.1
CMOD = 0x00;
CON = 0x00; // no interrupt
while(1)
if(CON & 0x20) // comparator output
P3_6 = 1;
else
P3_6 = 0;