منتديات الهندسة الكهربية والإلكترونية والميكاترونكس والكومبيوتر
هل تريد التفاعل مع هذه المساهمة؟ كل ما عليك هو إنشاء حساب جديد ببضع خطوات أو تسجيل الدخول للمتابعة.

مشروع قفل إلكترونى بسيط باستخدام ذاكرة EEPROM بالميكروكونترولر ولوحة مفاتيح وشاشة LCD :

اذهب الى الأسفل

مشروع قفل إلكترونى بسيط باستخدام ذاكرة EEPROM بالميكروكونترولر ولوحة مفاتيح وشاشة LCD : Empty مشروع قفل إلكترونى بسيط باستخدام ذاكرة EEPROM بالميكروكونترولر ولوحة مفاتيح وشاشة LCD :

مُساهمة من طرف Admin الأحد مايو 03, 2015 12:30 am

مشروع قفل إلكترونى بسيط باستخدام ذاكرة EEPROM بالميكروكونترولر ولوحة مفاتيح وشاشة LCD :
الأدوات المستخدمة فى برنامج المحاكاة ISIS : PIC16F877A , KEYPAD , RES , BD135 , CELL , RELAY .
الدائرة الكهربية :

مشروع قفل إلكترونى بسيط باستخدام ذاكرة EEPROM بالميكروكونترولر ولوحة مفاتيح وشاشة LCD : 512

البرنامج :

الكود:


#include <16F877a.h>
#use delay(clock= 4000000)
//#use standard_io(a)
#define use_portb_kbd TRUE
#define use_portb_lcd TRUE
#include <lcd.c>
#include <kbd.c>
//#include <stdlib.h>

#rom 0x2100={'7','2','3'}  // Save data 7 , 2 , 3 in position 0,1 and 2 of the EEPROM respectively
                         
void main() {
  char k;
  int i;
  char data[3], key[3];  //Storage arrays for data and key

  lcd_init();
  kbd_init();
  port_b_pullups(TRUE);

  while (TRUE) {
  i=0;            //array index position

  printf(lcd_putc,"\fPress Key 1\n");  //clear screen , print Press Key 1 , go to a new line

  while(i<=2){                //Three data
      k=kbd_getc();            //Read keypad
      if (k!=0)                //If any key is Pressed
        {data[i]=k;          //It is stored in the corresponding position
          i++;                //of the array
          printf(lcd_putc,"\fPress Key %u\n",i+1);  //Next item
        }
    }

  for (i=0;i<=2;i++) {            //EEPROM passes data to the key array
    key[i]=read_eeprom(i);}

  if ((data[0]==key[0])&&(data[1]==key[1])&&(data[2]==key[2]))
      { printf(lcd_putc,"\fDoor Open"); //Compares the data with the key
        output_high(PIN_A0);                //If equal gives pulse to relay
        delay_ms(2000);
        output_low(PIN_A0);}
  else printf(lcd_putc,"\fDoor Closed");  //key error
  delay_ms(1000);
  }
}


Admin
Admin

عدد المساهمات : 1194
تاريخ التسجيل : 28/01/2014

https://fathallaabdelaziz.forumarabia.com

الرجوع الى أعلى الصفحة اذهب الى الأسفل

الرجوع الى أعلى الصفحة

- مواضيع مماثلة

 
صلاحيات هذا المنتدى:
لاتستطيع الرد على المواضيع في هذا المنتدى