السلام عليكم ورحمه الله وبركاته .
تفضل أخي لك المشروع كامل للتحميل .. وتم التعديل عليه وتغير الميكرو كنترولر..
https://drive.google.com/file/d/0Bxg...ew?usp=sharing
وتم أضافة بعض التعديلات مثال ..
لو تم إدخال باسورد خاطئ أكثر من أربع مرات سيتم غلق النظام لمدة 15 سانية .. وأيضااا سيتم اطلاق انذار أو تشغيل الأنذار لمدة 15 سانيه ..
__________________________________________________ _________________
كود المشروع...
______________
كود:
// <<*** keypadPort _ ON AND OFF LED ****>> //
// ***** ENG / ABDALLA HYGAZY ****** //
// ***** DATA / 2017 / 2 / 17 ***** //
// Lcd pinout settings
#define SHOW inttostr(pot,potstring); Lcd_Out(2, 7,potstring );
sbit LCD_RS at RB5_bit;
sbit LCD_EN at RB4_bit;
sbit LCD_D7 at RB0_bit;
sbit LCD_D6 at RB1_bit;
sbit LCD_D5 at RB2_bit;
sbit LCD_D4 at RB3_bit;
// Pin direction
sbit LCD_RS_Direction at TRISB5_bit;
sbit LCD_EN_Direction at TRISB4_bit;
sbit LCD_D7_Direction at TRISB0_bit;
sbit LCD_D6_Direction at TRISB1_bit;
sbit LCD_D5_Direction at TRISB2_bit;
sbit LCD_D4_Direction at TRISB3_bit;
//***********************************//
char led,goo_out=0,goo_en=0;
int pot=0,X=0,M=0,M1=0;
char potstring[16];
//************************************//
char keypadPort at PORTD;
char password[5];
char i; // Loop variable
//*********************************//
void Move_Delay() { // Function used for text moving
Delay_ms(120); // You can change the moving speed here
}
//**********************************
char get_password()
{
Loop:
Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1, 1, "Enter Password :");
for(i=0;i<4;i++)
{
while (password[i] == 0)
{
password[i] = Keypad_Key_Click();
}
if(password[i]==1) password[i] = '1';
if(password[i]==2) password[i] = '2';
if(password[i]==3) password[i] = '3';
// if(password[i]==4) password[i] = 'A';
if(password[i]==5) password[i] = '4';
if(password[i]==6) password[i] = '5';
if(password[i]==7) password[i] = '6';
// if(password[i]==8) password[i] = 'B';
if(password[i]==9) password[i] = '7';
if(password[i]==10) password[i] = '8';
if(password[i]==11) password[i] = '9';
// if(password[i]==12) password[i] = 'C';
if(password[i]==13) password[i] = '*';
if(password[i]==14) password[i] = '0';
// if(password[i]==15) password[i] = '#';
// if(password[i]==16) password[i] = 'D';
Lcd_Chr(2, i+1, '*');
}
if(strcmp(password,"1234") == 0) {return 1;}
else {
password[0] = 0;
password[1] = 0;
password[2] = 0;
password[3] = 0;
Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1, 4, " Password :");
Lcd_Out(3, 2, "Error");
delay_ms(2000);
Lcd_Cmd(_LCD_CLEAR);
M1++;
if(M1==4){ Lcd_Out(2, 8, "Warning");
Lcd_Out(3, 1, "!!!!!!!!!!!!!!");
Lcd_Out(4, 4, "Alarm");
PORTA.F6=1;
for(M=0; M<20; M++) { // Moving text
for(i=0; i<4; i++) { // Move text to the right 4 times
Lcd_Cmd(_LCD_SHIFT_RIGHT);
Move_Delay();
}
for(i=0; i<4; i++) { // Move text to the left 7 times
Lcd_Cmd(_LCD_SHIFT_LEFT);
Move_Delay();
}
}
}
goto Loop;
}
}
void main() {
Keypad_Init();
Lcd_Init();
TRISB.F6 =0; TRISB.F7 =0; PORTB=0;
TRISC =0; PORTC=0;
TRISA =0; PORTA=0;
TRISE =0; PORTE=0;
// adcon1=0x07;
//************-----------***************//
Lcd_Cmd(_LCD_CLEAR);
Lcd_Cmd(_LCD_CURSOR_OFF);
Lcd_Out(1, 6, " Welcome! ");
Lcd_Out(2, 6, "********** ");
Lcd_Out(3, 2, "********** ");
Lcd_Out(4, 2, " Loading ");
for(M=0; M<3; M++) { // Moving text
for(i=0; i<4; i++) { // Move text to the right 4 times
Lcd_Cmd(_LCD_SHIFT_RIGHT);
Move_Delay();
}
for(i=0; i<4; i++) { // Move text to the left 7 times
Lcd_Cmd(_LCD_SHIFT_LEFT);
Move_Delay();
}
}
delay_ms(1500);
Lcd_Cmd(_LCD_CLEAR);
//************-----------****************//
get_password();
PORTA.F7=1;
Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1,2 , "WELCOME");
// portc.b0 = ~ portc.b0;
delay_ms(1000);
M1=0;
Lcd_Cmd(_LCD_CLEAR);
//****************************************************//
while(goo_out==0){
goo_en=0; pot=0; led=0;
Lcd_Out(1, 1, "function key led");
Lcd_Out(2, 1, "LED ON ( )");
while(!led){led = Keypad_Key_Click();}
switch (led) {
case 1: led = porta=1; portc=0; porte=0; goo_out=1; pot=1; Lcd_Out(3, 1, ">> MOHAMED <<"); Lcd_Out(4, 1, ">> GOOED <<");SHOW break; // 1
case 2: led = porta=2; portc=0; porte=0; goo_out=1; pot=2; Lcd_Out(3, 1, ">> AHMED <<"); SHOW break; // 2
case 3: led = porta=4; portc=0; porte=0; goo_out=1; pot=3; Lcd_Out(3, 1, ">> ALI <<"); SHOW break; // 3
case 4: led = porta=8; portc=0; porte=0; goo_out=1; pot=4; Lcd_Out(3, 1, ">> ABDALLA <<"); SHOW break; // A
case 5: led = porta=32; portc=0; porte=0; goo_out=1; pot=5; Lcd_Out(3, 1, ">> MOHMOD <<"); SHOW break; // 4
case 6: led = porte=1; portc=0; porta=0; goo_out=1; pot=6; Lcd_Out(3, 1, ">> MHMOWD <<"); SHOW break; // 5
case 7: led = porte=2; portc=0; porta=0; goo_out=1; pot=7; Lcd_Out(3, 1, ">> EMAN <<"); SHOW break; // 6
case 8: led = porte=4; portc=0; porta=0; goo_out=1; pot=8; Lcd_Out(3, 1, ">> AMER <<"); SHOW break; // B
case 9: led = portc=1; porta=0; porte=0; goo_out=1; pot=9; Lcd_Out(3, 1, ">> MOSTFA <<"); SHOW break; // 7
case 10: led = portc=2; porta=0; porte=0; goo_out=1; pot=10;Lcd_Out(3, 1, ">> AED <<"); SHOW break; // 8
case 11: led = portc=4; porta=0; porte=0; goo_out=1; pot=11;Lcd_Out(3, 1, ">> WAAEL <<"); SHOW break; // 9
case 12: led = portc=8; porta=0; porte=0; goo_out=1; pot=12; SHOW break; // C
case 13: led = portc=16; porta=0; porte=0; goo_out=1; pot=13; SHOW break; // *
//case 14: led = portc=32; porta=0; porte=0; goo_out=1; pot=14; SHOW break; // 0
case 15: led = portc=64; porta=0; porte=0; goo_out=1; pot=15; SHOW break; // #
case 16: led = portc=128; porta=0; porte=0; goo_out=1; pot=16; SHOW break; // D
}
//***************************************************************//
while(goo_en==0){ led=0;
while(!led){led = Keypad_Key_Click();}
switch (led) {
case 14: led = portc=0; portb=0; porta=0; porte=0;
goo_en=1; goo_out=0; Lcd_Cmd(_LCD_CLEAR); break; // 0
}
}
//*****************************************************************//
}
}
__________________________________________________ _____________
تحياتي لك ..
ولا تخجل لو محتاج أي اضافة أو تعديل انا متابع معاك ..
بالتوفيق يا غالي ..
اللهم أجعله في ميزان حسنات واليدي العزيز رحمة الله علية اللهم أمين ...