Discussion in "Project Addition or Changes" started by    romel_emperado    Oct 3, 2010.
Sun Oct 03 2010, 02:17 pm
#1
hello all, pls help me how to edit this code of ajay's project the door lock system. I have a little understanding on c language but I am afraid to touch this code which i do not understand very well.. pls help me....

What i wish to do is to cancel the LCD thing in the code.

everytine i press a key, P3.0 is high fo somewhat 1sec ( will be use for beep sound).

when the password is correct P3.1 is high(indicating password is correct) and P1.3 will be high for the door lock to open.

if clocked because of three atempts then P3.2 will show a blinking operation.
then the rest is as is as what in the original code..


thanks all...






this is from ajay's post:

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.

Schematic:






source code:
http://www.8051projects.net/request206.html


[ Edited Fri Dec 10 2010, 03:02 pm ]
Sun Oct 03 2010, 05:18 pm
#2
dear romel_emperado
why u dont try it urself then when u get a problem post here everyone will help u
if someone built a code for u then u learn nothing
if still u want then i agree to do it but there is better u do it urself
 romel_emperado like this.
Sun Oct 03 2010, 07:21 pm
#3
hi majoka, i know i can do that in my own but threre's a big problem. I can compile the codes of ajay and threre's no error but i don know how to run it because i have no idea how to have a keypad interface in KEIL..


its more easy to me to edit the codes if i can run it to test the result but to have a keypad interface on keil is my big big problem.. help..


if you dont min pls buzz me up in Yahoo and teach me how to have a keypad interface in keil.. thanks buddy

here's my email:
[email protected]
Sun Oct 03 2010, 11:13 pm
#4
ok i give u some samples codes in asm for keypad
see this tutorial for learning and tell me where u get problem in understanding
http://www.8051projects.net/keypad-interfacing/
 romel_emperado like this.
Sun Oct 03 2010, 11:30 pm
#5
if you want to take out LCD, then look for code that call the LCD routines.. just comment them.

you need to edit the get_key function for add that beep stuff.

i will see if i can make a simplified version of this project but dont trust on my saying ok.. coz i am too busy.

you start your work. if you finish first then i will put your contribution on site thanks in advance if you do
 romel_emperado like this.
Mon Oct 04 2010, 12:55 am
#6
helo again.

now i want to make my own simple code for keypad just for learning purposes using AT89c2051 pls. help me to correct if there is an error of what i am doing..


this is just an example code i just want to know if my concept of understanding in assigning the ports is correct.

this program monitors the low signal evrytime the keys are pressed



#include <REG51.H>



void main()
{	
char x;
P1=0xff; //input from keypad   i dont know if this initialization of P1 will work on keypad.
P3=0x00;  //my output

while(1)
{
x=P1 & 0x0ff;
switch(x)	   //this code is not complete so assume that it should enter in the switch function.
{

/* when #1 is pressed column1 row1*/
case 237: P3= //i will write outputs later when i finalize the code



 /* when #2 is pressed column2 row1*/
case 235: P3=  //i will write outputs later when i finalize the code



/* when #3 is pressed colum3 row1 */
case 231: P3=  //i will write outputs later when i finalize the code



/*when #4 is pressed column1 row2*/
case 221: P3=



/*when #5 is pressed column2 row2*/
case 219: P3=


/*when #6 is pressed column3 row2*/
case 215: P3=


/*when #7 is pressed column1 row3*/
case 189: P3=

/*when #8 is pressed column2 row3*/
case 187: P3=


/*when #9 is pressed column3 row3*/
case 183: P3=

/*when * is pressed column1 row4*/
case 125: P3=


/*when 0 is pressed column2 row4*/
case 123: P3=


 /*when # is pressed column3 row4*/
case 119: P3=

}
}








this is where i base my code in the table below.. tel me if i will possibly interface a keypad on P1 of At89c2051 with that kind of code.

how can i make the inputs low everytime i press the corresponding keys? my program monitors the low signal evrytime the keys are pressed





[ Edited Mon Oct 04 2010, 01:10 am ]
Mon Oct 04 2010, 01:05 am
#7


if you want to take out LCD, then look for code that call the LCD routines.. just comment them.

you need to edit the get_key function for add that beep stuff.

i will see if i can make a simplified version of this project but dont trust on my saying ok.. coz i am too busy.

you start your work. if you finish first then i will put your contribution on site thanks in advance if you do

Ajay Bhargav




hi sir ajay..


yes i want to take out the LCD portion i think i can do that if i know how to run your code in KEIL with keypad interface.. i can not imagine what i am doing in your code if i cant see the output during editing..

my question is, is there a keypad peripheral in KEIL compiler sir? id yes then pls give me some links where i can study the tutrorial...
Mon Oct 04 2010, 01:16 am
#8
keypad has two components, row and columns. Row is always the driving part and column is sensing part.

row and column cannot become 0 unless you make the driving part 0. so you need to modify your switch case loop so that, you first drive the row and then sense the column. i am giving a pseudo code structure..

Row1 = low, Row2= Row3 = high; //driving row 1
x = P1; // read port status
switch (x){
    case Col1: //if col1 is 0
       key = ...;
    break;
    case Col2: // and so on..
    // ...
}
Row2 = low, Row1= Row3 = high; //driving row 2
x = P1; // read port status
switch (x){
    case Col1: //if col1 is 0
       key = ...;
    break;
    case Col2: // and so on..
    // ...
}
// and so on.. for other rows..
//hope you get the idea now :)


well you cannot test code on keil. you have to have a hardware or a good simulator software like proteus to check your code while modifying.
 romel_emperado like this.
Mon Oct 04 2010, 05:00 am
#9


keypad has two components, row and columns. Row is always the driving part and column is sensing part.

row and column cannot become 0 unless you make the driving part 0. so you need to modify your switch case loop so that, you first drive the row and then sense the column. i am giving a pseudo code structure..

Row1 = low, Row2= Row3 = high; //driving row 1
x = P1; // read port status
switch (x){
    case Col1: //if col1 is 0
       key = ...;
    break;
    case Col2: // and so on..
    // ...
}
Row2 = low, Row1= Row3 = high; //driving row 2
x = P1; // read port status
switch (x){
    case Col1: //if col1 is 0
       key = ...;
    break;
    case Col2: // and so on..
    // ...
}
// and so on.. for other rows..
//hope you get the idea now :)


well you cannot test code on keil. you have to have a hardware or a good simulator software like proteus to check your code while modifying.

Ajay Bhargav




sir IM new in programming sorry.. can you give a one example code how to drive the row to zero or just give the first 3 equivalent switch case value when i press #1,2,3 ?? after you give that value I'll be the one to analyze how to finish my code.. thanks sir..
Mon Oct 04 2010, 06:47 am
#10
Sir thanks for that code it's a big help to my understanding. I will update this thread as soon as i have the code. Thank you very much sir.

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

Lewisuhakeply
Thu Apr 18 2024, 06:00 pm
Darrellciz
Thu Apr 18 2024, 11:07 am
Charlessber
Thu Apr 18 2024, 09:29 am
BartonSem
Thu Apr 18 2024, 04:56 am
DonaldKnown
Thu Apr 18 2024, 12:24 am
utaletxcyw
Wed Apr 17 2024, 10:21 am
Anthonyvab
Wed Apr 17 2024, 08:48 am
RobertCix
Wed Apr 17 2024, 06:46 am