Basic Level     Skills: Not specified    
Author email
Author website


Project tested and working perfectly

Digital Lock Using AT89C2051 with LCD and Keypad - Assembly

A Brief Description:
This project is a rewrite of previously made project "Digital Code Lock using keypad and LCD"
I got many requests from student's side who want this project in Assembly language. So i spent some time making this project.

You will find working of this project same as that of original project. Nothing has been changed as such.

Its a simple project with efficient hacking prevention from Brute Force etc. The basic user lock is of 5 Digits and Master Lock is of 10 digits so its not easy for an intruder to break the lock unless you keep the code simple.
The input is taken from a 4x3 Keypad (please see the schematic for more information) and Display the user input on a 2x16 LCD. A pin is assigned as output for activating and deactivating the lock. For demonstration i have connected an LED to that pin.

User Side working:
The user has two options either he/she can use its own 5 digit code or use the default 5 digit code. If user has to do setup his own code, then he has to enter "12345" and press '#'. After this.. controller will ask for 10 Digit master password which is preprogrammed in the controller. Entering master lock, user can enter the new 5 digit code for the lock and press '#' to save it.

Using the Keypad:
Keypad has 12 keys (4x3) starting from 1,2,3,4,5,6,7,8,9,*,0,# (please see the schematic for layout). Numeric keys are used for entering numbers. '*' is used as the Cancel key and '#' is used as the Enter key.

Download File Information:
LCD.asm - Project Code
LCD.hex - Final Hex file
Digital Code Lock Schematic - PDF file of orcad schematic

If any problem Please post in the forum

17.46 kB





01 Jun 2008: 13:25 PM
My Avast! anti-virus software picked up a trojan when I attempted to download the project file.
۞ TPS ۞
05 Jun 2008: 06:06 AM
what is the password ??
H Maheshwari
26 Jun 2008: 04:08 AM
Sir Can I design this project in my final year B.E. . Plz suggest some projects based on microcontrollers.
01 Jul 2008: 00:38 AM
can anyone have the program in c language of this project
01 Jul 2008: 01:20 AM
Check download section..
07 Aug 2008: 13:29 PM
Please,tell me 10 Digit master password which is preprogrammed in the controller.
08 Aug 2008: 01:04 AM
its there in c file check it (main.c)
08 Aug 2008: 13:38 PM
kindly contact me at ""
23 Aug 2008: 02:11 AM
please tell me where we connect pin 7,8,9,10 of LCD which represent by x-sign.
23 Aug 2008: 02:12 AM
31 Aug 2008: 10:27 AM
I'm sheen I like to do the Digital Lock Using AT89C2051 with LCD and Keypad project, I need Ur help to make the flow chart of this project.
regarding the best frm U SHEEN
11 Sep 2008: 09:40 AM
can i use it as a mtech project
11 Sep 2008: 15:21 PM
well it depends on you, if you feel it is good enough to do it, then you can choose it.
17 Sep 2008: 14:12 PM
hey ajay,
what if i need to modify that 1 led to become 3 led, and 1 5 digit pass to 7x 5 digit pass with each pass leads to different combination of gates that will open, for example pass1/2/3 = gate A/B/C, pass4 = gate A+B pass5 = gate B+C, and etc.
i tried modifying but ended messing everything up. any clues for me?
thanks in advance, =)
17 Sep 2008: 16:00 PM
use forum, might help you out then
narendra rathore
18 Sep 2008: 09:41 AM
how i scan the matrix keyboard with 89c2051 having connection with port p3 for row and column plz send me asm code for that my mail id is
18 Sep 2008: 15:25 PM
please look at keypad tutorial. if any problem use forum, we do not mail anyone
05 Nov 2008: 00:42 AM
i want to interface this circuit with RS232 to get the all the entry on the PC... cn u help me out how to manage that ???
25 Nov 2008: 12:33 PM
in this code also like the previous one the hex code is of size more than 2k
25 Nov 2008: 12:48 PM
ok i got the answer 4 my previous question
26 Nov 2008: 14:46 PM
Its the file of hex file not the code. more information please use help.
10 Dec 2008: 11:57 AM
sir u r project has been good. u please send the brief explanation of the above circuit
11 Dec 2008: 15:56 PM
Ashok Please use forum for any help. I will explain you there.
brijesh patel
11 Jan 2009: 01:10 AM
sir actually i wanted to a pdf file or project report on this project,,

so, on witch link or side i get the projet report sir,..

please help me,,sir
19 Feb 2009: 08:48 AM
hi Ajay how are u .hope you will be fine.
i have simulate your lock on 89c51 but its not working. kindly guide me. thanks

best regards

s m yasir
Anuj kumar
06 Mar 2009: 21:57 PM
Respected sir
my keil compiler in not generating the hex codecan you please solve my problem
or please provide me the hex file
please its urgent
13 Mar 2009: 12:23 PM
anyone, can tell me how does this 3x4 keypad works? can give me some data sheet about the operation of this project? i need it urgently...
14 Mar 2009: 04:50 AM
Please use forum if you need any information.
15 Mar 2009: 21:14 PM
Hi.. is there any information about the operation for this keypad..? Can tell me how does this 3x4 keypad works? can give me some data sheet about the operation of this project? i need it urgently...
Thank you
16 Mar 2009: 07:29 AM
check keypad tutorial to know working of keypad.
Anuj kumar
19 Mar 2009: 13:34 PM
sir actualy you have given same project 2 times one in assembly and another in C
m i right sir
Anuj kumar
19 Mar 2009: 13:37 PM
sir in C code
there is many file
also main.c
and also lock.hex

how it works sir
19 Mar 2009: 15:44 PM
hello sir,i hv 1 doubt. as AT89C2051 has 2kb could it store the hex file having size 3kb??
25 Mar 2009: 13:42 PM
Sir i need this program for AT89S52, can i use this program as it is. If not so, please advice me in this regard.
And the circuit diagram is also a bit different then I have.

And i'll be v thankfull to you if u plz tell me a brief difference b/w AT89C51 and AT89C2051 (is they r same)...?

Waiting for ur kind reply.
25 Mar 2009: 13:44 PM
You need to include all these files in single prject directory. Then compile all files. By doing so, the main file will be executed first and will load others in itself.
And a single hex file will be generated by ur compiler..

25 Mar 2009: 19:26 PM
you can use any 8051 compatible controller, keep the I/O port same.. as used in original project. for further help use forum.
Anuj kumar
29 Mar 2009: 07:50 AM
thanks sir for reply
i have in same manner as you suggest
but the hex generated is litted bit different from the hex file provided in project
hex size provided in project is 5.15k

and generated by my keil compiler is 5.09k

please suggest me what is the problem

i also assamble whole circuit at bread bord but is not working
i have check all the connection very very care fully
Anuj kumar
29 Mar 2009: 15:50 PM
its a great project
i have complete this project
its working very good

thanks Ajay sir

u r the best
Anuj kumar
29 Mar 2009: 15:52 PM
its a great project
i have complete this project
its working very good

thanks Ajay sir

u r the best sir
04 Apr 2009: 11:43 AM
can i do this for my mini project?How much time it will take to make it?
05 Apr 2009: 13:58 PM
yes you can do it as your mini project. just make the hardware and burn the hex file as coding is done already.

only time you are going to spend on is soldering. faster you do it, faster you finish your project. so at max u can say it will take a week or something?

If you need any help regarding project use forum.
chin vui
06 Apr 2009: 10:55 AM
Hi.. anyone can help me? i am doing a final project using at80s52. we are doing automatic door lock, including matrix keypad(3x4), electromagnetic lock, LCD display(2x16) and buzzer. anyone can help me to find any information about this? such as the assembler or programming for it...?
07 Apr 2009: 05:56 AM
just download this project for reference. If you need help use forum.
07 Apr 2009: 06:21 AM
hello sir i have done this project bt for preparing its report which contents should i include?plz reply fast sir
08 Apr 2009: 05:06 AM
Hi.. now i only need the assembly, C file and HEX file for the matrix keypad(3x4). anyone can help me? please send to my email at If there is any matrix keypad(3x4) C program work with the magnetic lock(output) will be better. Thanks
08 Apr 2009: 05:07 AM
Ajay..can u show me which forum category will be more suitable with my problem? thanks
14 Apr 2009: 05:24 AM
hi sir......thank u for ur excellent job......i need a ppt of this project sir.......please send me at
07 Jul 2009: 22:04 PM
i think the pins 7,8,9,10 are connected parallel to the pin 8 of the IC
07 Jul 2009: 22:13 PM
hi sir,
can u suggest a software where i could program and write the code to AT89C2051 coz im using the latest version of winpic software but the AT89C2051 is not in the list of microcontroller
08 Jul 2009: 09:40 AM
winpic is for PIC microcontrollers.

you need a special parallel programmer for programming AT89C2051. Please use forum for more help and explanation.
11 Aug 2009: 09:22 AM
What kind of load can be connected at output other than an LED. Can A.C devices be connected like a computer or only device that word on 5Volts D.C supply.
12 Sep 2009: 07:01 AM
hi r sir can youu please send me the ppt of this project
12 Sep 2009: 07:04 AM
hi sir,
can u please tell me why this ic is selected for the project,
can we use any another micro controller,i need them urgently,i have a ppt this monday .
14 Sep 2009: 17:04 PM
anil its better to use forum for any doubts. will surely help.
04 Dec 2009: 14:04 PM
Ajay Bhargav where exactly in the download section is the code in C language. When I check it, it leads back to this place and cant see any .c files in the zip file
07 Dec 2009: 15:15 PM
Thank you! I've downloaded it and will check it out
26 Feb 2010: 22:41 PM
hey ajay....
its a wonderful project no doubt.....
but can you please tell me that what is the rating of potentiometer in the block diagram and also what is y1 given in the circuit???
as i am new to this so please guide me....thanks in advance
27 Feb 2010: 15:38 PM
a simple 10K pot.
07 Mar 2010: 02:25 AM
hey ajay thnx.....
actually i completed to build the circuit but i am having a bit problem ...
when i turn on the circuit the lcd shows "enter code lock"...but when i try to enter the code it does not appear....and the circuit does that a code problem or a problem with my circuit???please help....
08 Mar 2010: 08:03 AM
circuit probably.
use forum for better help with your problem.
16 Mar 2010: 08:21 AM
Can u pls tel me what is d use of crystal in this proj??
16 Mar 2010: 10:53 AM
and i also wud like to knw the use of potentiometer...
16 Mar 2010: 13:15 PM
please use forum, i would be happy to clear your doubts with better explanation.
19 Mar 2010: 10:54 AM
Do i need to register to use forum? if so,how shud i do? pls help...
22 Mar 2010: 08:03 AM
yeah you have to register. to use forum dont worry we do not charge anything

you can find the registration link in right side near login box.
27 Apr 2010: 10:09 AM
hey ajay thnx 4 that wonderful project .........
i have assembeled it on board......
but i think there is some problem with the keypad interfacing.....
i mean i integrated the same circuit and it runs but whenever i press 1 then a 3 appears n 3 instead of 1 ......the middle numbers r working fine......what can be the problem????
28 Apr 2010: 14:32 PM
interchange columns and try again.. use forum incase more help needed.
03 May 2010: 21:12 PM
Sir,many thanks for lock projects,i make it n work proparly. now i need help ur,i need ADDING BUZER this ckt p1.4.

i want some devlp,thats..
1. any key press buzer 1 beep
2. wrong code buzer 2 beep alart
3. Blocked buzer beep continiasly

so,need Assmably code devolap but i culdnt,
sir kindly help me And give me assambly code Buzzer working.
04 May 2010: 09:19 AM
use forum.
31 May 2010: 02:29 AM
hi dear, pls how do I use PIC microcontrollers to achieve this
01 Jun 2010: 10:42 AM
you have to write code for PIC. use forum for help.
digendra chand
07 Aug 2010: 18:23 PM
can any one give code in c
09 Aug 2010: 16:37 PM
check download section, there is similar project written in C language.
18 Aug 2010: 09:49 AM
why when i run the asm file using Fet89c5x it show 1 error at line 555 which is illegal constant for the "icons"?Can you teach me how to fix it?Thanks.
18 Aug 2010: 13:15 PM
use forum for doubts.
21 Aug 2010: 10:19 AM
when i try in edsim 51... nothing appear.. how can i run this in edsim 51... thanks
pink bambina
21 Aug 2010: 23:40 PM
hello i need to download it but it has torjan virus wat can i do?
23 Aug 2010: 08:03 AM
It was a long time back.. this file is clean i checked it with Kaspersky antivirus.
12 Nov 2010: 15:31 PM
wht u hav done when ur circuit is not in workin? kindlye tell me same problam occuring with em so tensed
12 Nov 2010: 15:36 PM
ow it wil became in working
when i connect my circuit with 5 vlot battery its just light on at back and nothing just blank .
wht should i do ?
i have assembld my circuit 2 times qnd checkd it 7 times circuit assembling is f9 .
tell me the solution aap ka circuit kaixey workibng main aaya?
21 Jan 2011: 04:39 AM
Where is your asm code?
21 Jan 2011: 11:04 AM
download the zip file asm code is there...
28 Apr 2011: 10:57 AM
I simulate the circuit in "proteus 7 professional", i included that HEX file, but is not working. Have someone the proteus simulation for sharing?

Thank you!
28 Apr 2011: 11:42 AM
ask in forum. This project is working.
17 Sep 2011: 00:48 AM
i ve always had problem downloading anytin from dis site using dis means. Can u pls attach d file to my inbox? Thk u.
17 Sep 2011: 13:27 PM
Please mention the problem you're facing. I will surely try to solve it. You can email me your issues at contact [at] rickeyworld [dot] info
28 Nov 2011: 08:09 AM
dear you use c language or assembly
23 Dec 2011: 23:35 PM
C:\PINNACLE\AFFI.ASM(519): Error [E2012]: Syntax error: cjne

cjne status,#RETRY,set_upass_l2
sjmp set_upass_l4

how i remove this error??? plzzz help!!!
21 Jan 2012: 02:20 AM
sir i need assembly code for this project.....pls send on my e
03 Feb 2012: 19:21 PM
I need the assembly language program code of this
code lock in 8085 micro processor can I find any link
related or the code it self in 8085 or fully described flow chart ?
Thanks in advance
03 Feb 2012: 19:23 PM
please contact me with ""
10 Feb 2012: 15:12 PM
i am not able to understand these program please, enplane or give me detail info, on my email , forum system is difficult to me ,
please also give me code.
11 Feb 2012: 02:25 AM
you can ask your doubts in forum. we are all here to help you
11 Feb 2012: 08:36 AM
what do the cross mark indicate of lcd , if no connection then on protus while running it shows error.
11 Feb 2012: 09:16 AM
Sir please give me component list for home security by using AT89c2051 microcontroller with lock code
13 Feb 2012: 13:44 PM
what is the role of 10k resistr capacitor100nf ? can i remove that or not ,why?
13 Feb 2012: 14:40 PM
what is the code both 5 digit & 10 digit, how to give new password ,
reply fast to all questions,please.
28 Feb 2012: 02:10 AM
please tell me about lock activator?which activator should i use?
30 Mar 2012: 11:36 AM
[blocked by admin]
23 Apr 2012: 12:56 PM
i need this digilockckt
23 Apr 2012: 12:58 PM
i need this digilockckt how to work
patel nisha
02 Aug 2012: 08:22 AM
can u pls tell me the value of potentiometer which is used in this project
02 Aug 2012: 11:25 AM
its a 10K potentiometer. You can also use 1K constant resistor to ground.
24 Aug 2012: 16:32 PM
it is a nice project.....................
24 Aug 2012: 16:33 PM
aa project masti no 6e
24 Mar 2013: 12:39 PM
also having the same problem.
06 Aug 2013: 19:40 PM
this assembly code can use on PIC or not sir??
07 Aug 2013: 01:09 AM
You cannot use it on PIC.
19 Aug 2013: 15:18 PM
can i use for different 8051 IC wihtout change the program code??
13 Sep 2013: 22:16 PM
any one who download this file plz send it to me plz help downloading from this site ...plz send it on
07 Dec 2013: 04:00 AM
What do I need to embed ?, the HEX file only ? , and I'm using an LCD with 16 pins is it ok ?
15 Dec 2013: 17:38 PM
@Hassan, Yes just the hex file need to be programmed. And 16 Pin LCD is fine.
25 Dec 2013: 11:01 AM
if any one have pcb ley -out ? then give me a link of it,,
sami ullah
25 Dec 2013: 16:57 PM
when i press one of the key then error occur "logic contiention detacded on net 00002."
and the terminal from colum also stop working light from the spot dis appere

plz any one help

ajay ?
11 Feb 2014: 20:19 PM
when i connect it on bread board on LCD switch on no data displays from micro controller .please help me.i have dumped lock.hex file. it works in software ,but not in practcally.give me some sugession
30 Mar 2014: 02:11 AM
how to run the programs given in the zip file do i have to assemble the whole programs to one or what next i am not able to understand anything.
sir can u please explain in detail what to do after downloading the zip file.. please sir waiting for your rply..
thank you
31 Mar 2014: 03:29 AM
@saheel, you need to burn the hex file in controller and build circuit as provided in pdf. you do not have to assemble the program unless you want to change something in source.
(Required; Min length 5)
(Required; will not be displayed)



Wed Apr 16 2014, 07:32 AM
Tue Apr 15 2014, 04:12 PM
Tue Apr 15 2014, 11:21 AM
Mon Apr 14 2014, 10:00 PM
Sun Apr 13 2014, 02:59 PM
Sun Apr 13 2014, 12:41 PM
Sun Apr 13 2014, 09:00 AM
Sun Apr 13 2014, 01:54 AM


Thu Apr 17 2014, 12:27 AM
like the forum and wish to participate
Wed Apr 16 2014, 04:45 PM should read my comment just before your post
Wed Apr 16 2014, 01:43 PM
I'm doing a drive system with SIM900D modem and microcontroller AT89S52 via sms. I'm having trouble can not generate the. Hex to send to the microcontroller, whenever I compile the error, I'm using MCU 8051 IDE, what should I do so that my system receive sms and perform my task?
Mon Apr 14 2014, 01:00 PM
@Haranadh,bipin chandra etc. Create threads for your questions.
Sun Apr 13 2014, 04:05 AM
we bought HC 06 Bluetooth modem instead of Module ,Can any one help me of using it as bluetooth module since i am doing this project?
Sun Apr 13 2014, 03:58 AM
Hi,Actually we bought Bluetooth modem instead of Bluetooth Module
Sat Apr 12 2014, 02:55 PM
Please use forum if you want to ask a question.
Sat Apr 12 2014, 01:06 PM
Hi Ahana,I can Help you on this
Sat Apr 12 2014, 03:51 AM
bipin chandra
can anybody help me. we are making a project to control the position of dc motor. so there we need to interface lcd screen and the 4X3 memberane keypad and a dc motor driver chip. can anybody please give me the complete circuit diagram connection of these components with the 8051.and alse help in the programming. my email id is
Fri Apr 11 2014, 01:10 PM
will anybody tell me why do we need comma positions to be considered to know about latitude and longitude from gps?
  Choose Skin