Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Could any one help me with my project please which is an Electronic Lock.

Status
Not open for further replies.

ROOH ALGHALA

Newbie level 3
Joined
Oct 23, 2013
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
30
Hello everyone.. Does any one have codes for electonic lock by using micro c program for PIC (PIC16F887) I need that because I tried many times typing codes but the result cannot achieve:-( I hope find help here..
 

I think one simple way could be using the eeprom_read(address); and eeprom_write(address, value); The password can be stored in the eeprom using the eeprom_write(address, value); and when there's a match, a switch can be triggered. The eeprom address ranges from 0x00h to 0xFFh. Even I'm a newbie, so I've very less experience in programming, so please bear with me :)
 

Thank you richardlaishram about your answer. yes I used that eeprom_read(address); and eeprom_write(address, value); in my program but I have not seen write in EEPROM editor. so I have to put number in EEPROM EDITOR or not. for example if I want my password is 1234 I have to put them in eeprom editor or it is emiditaly written when I press. ((sorry about my explain not more good in english grammer.))

- - - Updated - - -

Hello matheshbe ok I will send my codes

- - - Updated - - -

Code:
unsigned short kp, cnt, oldstate = 0;
char txt[6];
char pass[3] ={1, 2, 3};
int i;
unsigned short user[1];
// Keypad module connections
char  keypadPort at PORTD;
// End Keypad module connections

// LCD module connections
sbit LCD_RS at RB4_bit;
sbit LCD_EN at RB5_bit;
sbit LCD_D4 at RB0_bit;
sbit LCD_D5 at RB1_bit;
sbit LCD_D6 at RB2_bit;
sbit LCD_D7 at RB3_bit;

sbit LCD_RS_Direction at TRISB4_bit;
sbit LCD_EN_Direction at TRISB5_bit;
sbit LCD_D4_Direction at TRISB0_bit;
sbit LCD_D5_Direction at TRISB1_bit;
sbit LCD_D6_Direction at TRISB2_bit;
sbit LCD_D7_Direction at TRISB3_bit;
// End LCD module connections

void main() {
  cnt = 0;                                 // Reset counter
  Keypad_Init();                           // Initialize Keypad
  ANSEL  = 0;                              // Configure AN pins as digital I/O
  ANSELH = 0;
  Lcd_Init();                              // Initialize LCD
  Lcd_Cmd(_LCD_CLEAR);                     // Clear display
  Lcd_Cmd(_LCD_CURSOR_OFF);                // Cursor off
  Lcd_Out(1, 1, "Enter:");                 // Write message text on LCD

  for (i =0; i<3; i++){


    kp = 0;                                // Reset key code variable

    // Wait for key to be pressed and released
    do
      // kp = Keypad_Key_Press();          // Store key code in kp variable
      kp = Keypad_Key_Click();             // Store key code in kp variable
    while (!kp);
   // Prepare value for output, transform key to it's ASCII value
    switch (kp) {


      case  1: kp = 49; break; // 1        // Uncomment this block for keypad4x4
      case  2: kp = 50; break; // 2
      case  3: kp = 51; break; // 3
      case  4: kp = 65; break; // A
      case  5: kp = 52; break; // 4
      case  6: kp = 53; break; // 5
      case  7: kp = 54; break; // 6
      case  8: kp = 66; break; // B
      case  9: kp = 55; break; // 7
      case 10: kp = 56; break; // 8
      case 11: kp = 57; break; // 9
      case 12: kp = 67; break; // C
      case 13: kp = 42; break; // *
      case 14: kp = 48; break; // 0
      case 15: kp = 35; break; // #
      case 16: kp = 68; break; // D

    }
   pass[i] = kp;
lcd_Chr(2, i+1, pass[i]);


      EEPROM_Write(0x00,kp); //Write some data at address 00
       delay_ms(20);
      



       user[1]=EEPROM_Read(0x00); //read data from address0
      delay_ms(20);



   }
}

this is my code see if all correct or not. also I want commands for number matching .or can the eeprom do matching number how??
 

Zip and post mikroC project files and Proteus file so that it can be fixed. I just don't have time to create a new project for the code you have posted. If simulating in Proteus have to create a .bin file for eeprom.
 

Do you mean you want project what I have done ?? and about proteuse I have not used because I have easy PIC6 board
 

Yes. Zip and post mikroC project files. I will test it in EasyPIC v7 board.


Edit:

Code C - [expand]
1
while(1)

is missing.


You should display password characters as '*' on LCD.


Edit2: Try attached file.

Read readme.txt file in the rar file.
 

Attachments

  • Lock.rar
    51 KB · Views: 65
  • lock2.rar
    23.8 KB · Views: 66
Last edited:

Hello jayanth. I dont use while(1) because if I use for loop it count 3 times then stop but with while(1) dont stop that way I delet it. thank you for your file but how can I use them. here is my files
 

Attachments

  • ZipMeNow-Files (2).zip
    2.5 KB · Views: 56

Without while(1) your system will never work as needed. It is needed to keep the micro running all the time. Even if your code works then it will execute once and either stops are resets the micro. For a better solution explain in detail how the system should work. Provide a circuit in Proteus, image or .pdf format. You can't use my files because it is slightly different from what you need. You can install demo version of Proteus 8 and import the .dsn file and simulate it to see the working.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top