<?xml version="1.0" encoding="utf-8" ?>
				<!-- generator="e107" -->
				<!-- content type="Forum / topic" -->
				<rdf:RDF xmlns="http://purl.org/rss/1.0/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
				<channel rdf:about="http://www.8051projects.net/">
				<title>8051 Microcontroller Projects AVR PIC Projects Tutorials Ebooks Libraries codes : Forum / topic</title>
				<link>http://www.8051projects.net/</link>
				<description>Learn to make simple microcontroller projects, pic, 8051, avr and arm projects. download 8051 projects, tutorials, libraries, sample codes. join the microcontroller discussion forum and ask doubts regarding electronics. the best source for 8051 over internet.</description>
				<dc:language>en-gb</dc:language>
				<dc:date>2009-01-08T05:50:57-08:00</dc:date>
				<dc:creator>contact@nospam.com</dc:creator>
				<admin:generatorAgent rdf:resource="http://e107.org" />
				<admin:errorReportsTo rdf:resource="mailto:contact@nospam.com" />
				<sy:updatePeriod>hourly</sy:updatePeriod>
				<sy:updateFrequency>1</sy:updateFrequency>
				<sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>
				<items>
				<rdf:Seq>
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t2880.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t2880.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t2880.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t2880.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t2880.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t2880.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t2880.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t2880.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t2880.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t2880.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t2880.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t2880.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t2880.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t2880.html" />
						<rdf:li rdf:resource="http://www.8051projects.net/forum-t2880.html" />
				</rdf:Seq>
				</items>
				</channel>
						<item rdf:about="http://www.8051projects.net/forum-t2880.html">
						<title>Need Help on Pic16f628A Combination Lock C Code wih LCD and 3*4 Keypad</title>
						<link>http://www.8051projects.net/forum-t2880.html</link>
						<dc:date>2009-01-08T05:50:57-08:00</dc:date>
						<dc:creator></dc:creator>
						<dc:subject></dc:subject>
						<description>Any One Here Can You Please Read Through My C Code and Correct It...My programming is really worse....I really appreciate any inputs from you guys.            /*******************************************Keypad and LCD lock on Pic16f628A with 3*4 keypadProject name: Combination Lock (Demonstration of the Keypad Library routines)LCD Display in 4-bit mode on PORTAKeypad on PORTBDoor1 = 05Door2 = 28Alarm off = 99Three Attempts before Alarm*****************************************/#define door1_low 6#define door1_upper 14#define door2_low 10#define door2_upper 2char var1, var2, kp, attempts;char state = 1;//start from state 1int cnt=0;void main(void) {char          text[] = "Combination Lock" ;//message text  CMCON = 0x07                     ;//PORTA to digital mode  LCD_Config(&amp;PORTA,7,6,5,3,2,1,0) ;//Pin assignment                                   ;//RS,E,RW,D7,D6,D5,D4  LCD_Cmd(LCD_CLEAR)               ;//Clear display  LCD_Cmd(LCD_CURSOR_OFF)          ;//Turn cursor off  LCD_Cmd(LCD_SECOND_ROW)          ;//Move to ROW2 for rest of program  //Seup Keypad on PORTB  Keypad_Init(&amp;PORTB)              ;// Initialize Keypad on PORTB   LCD_OUT(1,1,text)                ;//Print welcome message  while(1) {   //while ever loop               switch(state){ //check the current statecase 1:               while(!keypad_Read()){}   //wait for key1 press               kp = Keypad_Released()   ;//wait for release               var1=kp; //store var1 into kp               Delay_ms(10)             ;//debounce time               state = 2;               break;case 2:               if(kp==15) state=1; //go back state 1 when kp = # (enter key)               if(kp==13) state=1;//go back state 1 when kp = * (clear key)               else               state = 3;//go to state 3 get key2               break;case 3:               while(!keypad_Read()){}   //wait for key2 press               kp = Keypad_Released()   ;//wait for release               var2=kp;//store var2 into kp               Delay_ms(10)             ;//debounce time               break;               if(kp==15) state=1;//enter key goes back state 1               if(kp==13) state=1;//clear key goes back state 1               else               state = 4;//continue goes to state 4               break; case 4:               while(!keypad_Read()){}   //wait for enter key press               kp = Keypad_Released()   ;//wait for release               Delay_ms(10)             ;//debounce time               break;               if(kp==13)               state =1; //clear goes back to s1               if(kp==15)               state = 5;//enter key goes to state 5               else state = 4;               break;case 5:         //compare enter values with password values stored               if(var1==door1_upper &amp;&amp; var2 == door1_low)               state = 8;//goes to state 8 door1 open               LCD_OUT(2,1,"Door1 Opened");               Delay_ms(5000) ;//delay door1 open 5secs               if(var1==door2_upper &amp;&amp; var2 == door2_low)               state = 9;//goes to state 9 for door 2               else               LCD_OUT(2,1,"Bad Code");               Delay_ms(2000);               cnt++;               state=6;case 6:              if(var1==3 &amp;&amp; var2 == 3) //both doors open              state = 10;              else              LCD_OUT(2,1,"Bad Code");              Delay_ms(2000) ;              cnt++;case 7://enter key 99 for alarm off              if(var1==9 &amp;&amp; var2 == 9)              LCD_OUT(2,1,"Alarm Off");    //turns alarm off              attempts=0;              state=1;              break;case 8://open door1 for 5secs              PORTA.F4=1;              Delay_ms(5000);              state=1;              cnt=0;              break;case 9: //open door2 for 5secs              PORTA.F5=1;              Delay_ms(5000);              state=1;              cnt=0;              break;case 10: //open both doors              PORTA.F5=1;              PORTA.F4=1;              Delay_ms(5000);              state=1;              cnt=0;              break;default:// must be a bad attempts              attempts++;              if(attempts ==3)              state = 11;              LCD_OUT(2,1,"Alarm ON");              break;                       }                         }     }</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t2880.html">
						<title>Re: Need Help on Pic16f628A Combination Lock C Code wih LCD and 3*4 Keypad</title>
						<link>http://www.8051projects.net/forum-t2880.html</link>
						<dc:date>2009-01-08T05:50:57-08:00</dc:date>
						<dc:creator>DAT</dc:creator>
						<dc:subject></dc:subject>
						<description>Hello Ajay, the did the simulations and it is running without errors.  The programming is working fine except the case 11 "3 attempts" before turn alarm on ... i could not get the display ALARM ON at the default case....</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t2880.html">
						<title>Re: Need Help on Pic16f628A Combination Lock C Code wih LCD and 3*4 Keypad</title>
						<link>http://www.8051projects.net/forum-t2880.html</link>
						<dc:date>2009-01-08T05:50:57-08:00</dc:date>
						<dc:creator>Ajay</dc:creator>
						<dc:subject></dc:subject>
						<description>ok one thing you need to change is... in all the cases wherever you are checking for if(kp==13) and if(kp==15)make it else if for the second check... i.e.if(kp==13)....else if(kp==15)...else....reason is...lets say if key is 13.. then it will go to first if statement.. checks it.. and finds its true as Kp is 13.. so execute the if condition loop... then it comes to second check.. as kp != 15 so it goes to else statement and will execute it.. so there could be your problem.. make the changes and tell me..</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t2880.html">
						<title>Re: Need Help on Pic16f628A Combination Lock C Code wih LCD and 3*4 Keypad</title>
						<link>http://www.8051projects.net/forum-t2880.html</link>
						<dc:date>2009-01-08T05:50:57-08:00</dc:date>
						<dc:creator>DAT</dc:creator>
						<dc:subject></dc:subject>
						<description>Here is the attachment of combination lock  flowchart and hardware circuit simulation using Proteus and combination_lock.c</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t2880.html">
						<title>Re: Need Help on Pic16f628A Combination Lock C Code wih LCD and 3*4 Keypad</title>
						<link>http://www.8051projects.net/forum-t2880.html</link>
						<dc:date>2009-01-08T05:50:57-08:00</dc:date>
						<dc:creator>Ajay</dc:creator>
						<dc:subject></dc:subject>
						<description>did you check your code in compiler? are you able to compile it with no error? if yes then try it with hardware of as you seems to have proteus. So try to run it on proteus.Also its better to zip the files and then upload it again.</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t2880.html">
						<title>Re: Need Help on Pic16f628A Combination Lock C Code wih LCD and 3*4 Keypad</title>
						<link>http://www.8051projects.net/forum-t2880.html</link>
						<dc:date>2009-01-08T05:50:57-08:00</dc:date>
						<dc:creator>DAT</dc:creator>
						<dc:subject></dc:subject>
						<description>Here is the attachment of combination lock flowchart and hardware circuit simulation using Proteus and combination_lock.c 1191963892_4066_FT2880_combination_lock.zip</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t2880.html">
						<title>Re: Need Help on Pic16f628A Combination Lock C Code wih LCD and 3*4 Keypad</title>
						<link>http://www.8051projects.net/forum-t2880.html</link>
						<dc:date>2009-01-08T05:50:57-08:00</dc:date>
						<dc:creator>DAT</dc:creator>
						<dc:subject></dc:subject>
						<description>Ajay,  i did corrected the error" if to else if " you have mentioned b4. To get the programming working smoothly i also have to expand the case statement as i have modified the previous version below:Now I have another problem to face that  i could not display message "Alarm" on LCD after 3 attempted incorrect password....Can you please Help Me In this One Sir, Ajay../*******************************************Keypad and LCD lock on Pic16f628A with 3*4 keypadProject name: Combination Lock (Demonstration of the Keypad Library routines)LCD Display in 4-bit mode on PORTAKeypad on PORTBDoor1 = 05Door2 = 28Door1 &amp; 2 = 33Alarm off = 99Three Attempts before Alarm*****************************************/char var1, var2, kp;char attempts=1;//int cnt=0;char state = 1;//start from state 1//int cnt=0;char          text[] = "Combination Lock" ;//message textvoid main(void) {  CMCON = 0x07                     ;//PORTA to digital mode  LCD_Config(&amp;PORTA,7,6,5,3,2,1,0) ;//Pin assignment                                   ;//RS,E,RW,D7,D6,D5,D4  LCD_Cmd(LCD_CLEAR)               ;//Clear display  LCD_Cmd(LCD_CURSOR_OFF)          ;//Turn cursor off  LCD_Cmd(LCD_SECOND_ROW)          ;//Move to ROW2 for rest of program  //Seup Keypad on PORTB  Keypad_Init(&amp;PORTB)              ;// Initialize Keypad on PORTB   LCD_OUT(1,1,text)                ;//Print welcome message  while(1) {   //while ever loop               switch(state){ //check the current statecase 1:               LCD_out(1,1,"Combination Lock");               //LCD_Cmd(LCD_CLEAR)         ;               while(!keypad_Read()){}   //wait for key1 press               Delay_ms(10)             ;//debounce time               kp = Keypad_Released()   ;//wait for release               var1=kp; //store var1 into kp               state = 2;               break;case 2:               if(kp==15) state=1; //go back state 1 when kp = # (enter key)               else if(kp==13) state=1;//go back state 1 when kp = * (clear ke               else               state = 3;//go to state 3 get key2               break;case 3:               while(!keypad_Read()){}   //wait for key2 press               Delay_ms(10)             ;//debounce time               kp = Keypad_Released()   ;//wait for release               var2=kp;//store var2 into kp               state=4;               break;case 4:               if(kp==15) state=1;//enter key goes back state 1               else if(kp==13) state=1;//clear key goes back state 1               else               state = 5;//continue goes to state 4               break; case 5:               while(!keypad_Read()){}   //wait for enter key press               Delay_ms(10)             ;//debounce time               kp = Keypad_Released()   ;//wait for release               state = 6;               break;case 6:               if(kp==13)               state =1; //clear goes back to s1               else if(kp==15)               state = 7;//enter key goes to state 7               else state = 5;               break;case 7:               if (var1==14 &amp;&amp; var2==6)//comparing for door1                state = 12;  //goes state 11 open door1               else state =8;               break;case 8:               if (var1==2 &amp;&amp; var2 == 10)//comparing for door2               state = 13;//goes to state 9 for door 2               else state=9;               break;case 9:               if (var1==3 &amp;&amp; var2 == 3)               state = 14;//goes to state 13 for door1 &amp; 2               else               state =10;               break;case 10:               if(var1==11 &amp;&amp; var2==11)               state = 15;//goes to state 14 Alarm Off               else               state =11;               break;case 11:               LCD_OUT(2,1,"Invalid") ;               while(!keypad_Read()){}   //wait for enter key press               Delay_ms(10)             ;//debounce time               keypad_Read()++;                keypad_Read()+=attempts;                if(attempts==3)                 state =16;               kp = Keypad_Released()   ;//wait for release              LCD_Cmd(LCD_CLEAR)         ;               if(kp==13)               state =1;               break;case 12://open door1 for 5secs              PORTA.F5=1;              //Delay_ms(5000);              state=1;             Lcd_out(2,1,"D1 Opened") ;              while(!keypad_Read()){}   //wait for enter key press               Delay_ms(10)             ;//debounce time               kp = Keypad_Released()   ;//wait for release              if(kp==13)              LCD_Cmd(LCD_CLEAR)         ;              state=1;              break;case 13: //open door2 for 5secs              LCD_OUT(2,1,"D2 Opened");              //PORTB.F4=1;              //Delay_ms(5000);              while(!keypad_Read()){}   //wait for enter key press               Delay_ms(10)             ;//debounce time               kp = Keypad_Released()   ;//wait for release              if(kp==13)             LCD_Cmd(LCD_CLEAR)         ;              state=1;              break;case 14: //open both doors              LCD_OUT(2,1,"D1&amp;2 Opened");              //PORTA.F5=1;              //PORTB.F4=1;              //Delay_ms(5000);              while(!keypad_Read()){}   //wait for enter key press               Delay_ms(10)             ;//debounce time               kp = Keypad_Released()   ;//wait for release              if(kp==13)             LCD_Cmd(LCD_CLEAR)         ;              state=1;              break;case 15:              LCD_OUT(2,1,"*Alarm OFF*");              Delay_ms(5000);              LCD_Cmd(LCD_CLEAR)         ;              state=1;              break;default:// must be a bad attempts               //attempts++;              //if(attempts==3)              LCD_OUT(2,1,"Alarm ON");              Delay_ms(5000);              //attempts=0;              state = 1;              break;                       }                         }  }</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t2880.html">
						<title>Re: Need Help on Pic16f628A Combination Lock C Code wih LCD and 3*4 Keypad</title>
						<link>http://www.8051projects.net/forum-t2880.html</link>
						<dc:date>2009-01-08T05:50:57-08:00</dc:date>
						<dc:creator>DAT</dc:creator>
						<dc:subject></dc:subject>
						<description>Ajay, This is the file in .c  so you can download and easy to check...</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t2880.html">
						<title>Re: Need Help on Pic16f628A Combination Lock C Code wih LCD and 3*4 Keypad</title>
						<link>http://www.8051projects.net/forum-t2880.html</link>
						<dc:date>2009-01-08T05:50:57-08:00</dc:date>
						<dc:creator>DAT</dc:creator>
						<dc:subject></dc:subject>
						<description>DAT wrote ...Ajay, This is the file in .c  so you can download and easy to check... 1192055616_4066_FT2880_combination_lock.zip</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t2880.html">
						<title>Re: Need Help on Pic16f628A Combination Lock C Code wih LCD and 3*4 Keypad</title>
						<link>http://www.8051projects.net/forum-t2880.html</link>
						<dc:date>2009-01-08T05:50:57-08:00</dc:date>
						<dc:creator>Ajay</dc:creator>
						<dc:subject></dc:subject>
						<description>Hi DAT, you can call me Ajay only.. no need of sir!  Ii checked your code again... I am really not sure what the problem is.. as i need to see the working of project to know more about the problem. Also i do not have any compiler for PIC so cannot compile program and simulate it.. but i can give you some suggestions..In the case of invalid code..case 11:LCD_OUT(2,1,"Invalid") ;while(!keypad_Read()){} //wait for enter key pressDelay_ms(10) ;//debounce time//this doesn't seems to be ok to me..keypad_Read()++; //instead you could have directly incremented//attempts//use attempt++;keypad_Read()+=attempts;if(attempts==3)state =16;kp = Keypad_Released() ;//wait for releaseLCD_Cmd(LCD_CLEAR) ;if(kp==13)state =1;break;Although default has to work, but i want you to try with "case 16" also.. as i see there is no problem in the program.. could be some kind of logical error.. try if you can simulate it on the debugger... step by step execution... and see what could be the problem..</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t2880.html">
						<title>Re: Need Help on Pic16f628A Combination Lock C Code wih LCD and 3*4 Keypad</title>
						<link>http://www.8051projects.net/forum-t2880.html</link>
						<dc:date>2009-01-08T05:50:57-08:00</dc:date>
						<dc:creator>Ajay</dc:creator>
						<dc:subject></dc:subject>
						<description>i didnt get why are you doingkeypad_Read()++; (this)andkeypad_Read()+=attempts; (this)explain me because i don't know how the value is being stored or incremented in attempts variable..</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t2880.html">
						<title>Re: Need Help on Pic16f628A Combination Lock C Code wih LCD and 3*4 Keypad</title>
						<link>http://www.8051projects.net/forum-t2880.html</link>
						<dc:date>2009-01-08T05:50:57-08:00</dc:date>
						<dc:creator>DAT</dc:creator>
						<dc:subject></dc:subject>
						<description>Ajay, Thanks you very much for replies my questions. Finally I solved the problem.At case 11 each time enter invalid pass we increment attempts by 1 as we passed through release button value stored and when three attempts entered go to state 16 "default"  for output display message and next go to state 1 waiting for enter alarm off numbers..case 11:               LCD_OUT(2,1,"Invalid") ;               while(!keypad_Read()){}   //wait for enter key press               Delay_ms(10)             ;//debounce time               kp = Keypad_Released()   ;//wait for release               LCD_Cmd(LCD_CLEAR)         ;               if(kp==13)               state =1;               attempts++; //increment attempts               kp+=attempts;//attempts = kp + attempts               if(attempts==3)  //attempts equal 3 times               state =16;     //goes next state 16               break;</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t2880.html">
						<title>Re: Need Help on Pic16f628A Combination Lock C Code wih LCD and 3*4 Keypad</title>
						<link>http://www.8051projects.net/forum-t2880.html</link>
						<dc:date>2009-01-08T05:50:57-08:00</dc:date>
						<dc:creator>Ajay</dc:creator>
						<dc:subject></dc:subject>
						<description>yeah that is what i told you.. coz you were not incrementing attempts rather you were doing something else...try this too...remove this statementkp+=attempts;//attempts = kp + attemptsas its not what you think its.. kp = kp + attemps;so you don't need this statement in the case 11 code...happy that it worked... do you want to post this project on my site?</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t2880.html">
						<title>Re: Need Help on Pic16f628A Combination Lock C Code wih LCD and 3*4 Keypad</title>
						<link>http://www.8051projects.net/forum-t2880.html</link>
						<dc:date>2009-01-08T05:50:57-08:00</dc:date>
						<dc:creator>DAT</dc:creator>
						<dc:subject></dc:subject>
						<description>Ajay, my project is not completed.  I need add diodes hardware  for door1 and door2 at output pic and a little modification  the program again and after that  i tidy up the project into one zip folder then i will  post to on your websiteSee you again!!</description>
						</item>
						<item rdf:about="http://www.8051projects.net/forum-t2880.html">
						<title>Re: Need Help on Pic16f628A Combination Lock C Code wih LCD and 3*4 Keypad</title>
						<link>http://www.8051projects.net/forum-t2880.html</link>
						<dc:date>2009-01-08T05:50:57-08:00</dc:date>
						<dc:creator>Ajay</dc:creator>
						<dc:subject></dc:subject>
						<description>sure.. i was just asking if you want to post or not.. i will wait for the files.. please include a small description too..   Many people are waiting for PIC based projects..</description>
						</item>
				</rdf:RDF>