void main()
{
unsigned char password[]={1,2,3,4};
unsigned char input[4];
unsigned char keypad[]={0,1,2,3,0,
4,5,6,0,
7,8,9,0,
0,0,0,0};
unsigned int kp,i;
TRISC=0;
TRISD=0xFF;
Lcd_Init(&PORTC);
Keypad_Init(&PORTD);
Lcd_Cmd(LCD_CURSOR_OFF);
RETURN:Lcd_Cmd(LCD_CLEAR);
Lcd_Out(1,1,"ENTER PASSWORD");
for(i=0;i<4;i++)
{
while(!Keypad_Read());
kp=Keypad_Read();
input[i]=keypad[kp];
Lcd_Chr(2,i+1,input[i]+48);
while(Keypad_Read());
}
while(Keypad_Read()!=15);
if(input[0]==password[0]&&input[1]==password[1]&&input[2]==password[2]&&input[3]==password[3])
{
Lcd_Cmd(LCD_CLEAR);
Lcd_Out(1,1,"CORRECT PASSWORD");
}
else
{
Lcd_Cmd(LCD_CLEAR);
Lcd_Out(1,1,"WRONG PASSWORD");
delay_ms(1000);
goto RETURN;
}
}
วันจันทร์ที่ 24 ธันวาคม พ.ศ. 2561
สมัครสมาชิก:
ส่งความคิดเห็น (Atom)
Internet of Things (IoT)
Internet of Things หรือ IoT Internet of Things (IoT) คือ การที่อุปกรณ์อิเล็กทรอนิกส์ต่างๆ สามารถเชื่อมโยงหรือส่งข้อมูลถึงกันได้ด้วยอิ...
-
Calculator with Pic 16f877 microcontroller is a comprehensive project. Comprehensive in the w...
-
Internet of Things หรือ IoT Internet of Things (IoT) คือ การที่อุปกรณ์อิเล็กทรอนิกส์ต่างๆ สามารถเชื่อมโยงหรือส่งข้อมูลถึงกันได้ด้วยอิ...
-
#include <LiquidCrystal_I2C.h> LiquidCrystal_I2C lcd(0x27,16,2); int PIRpin = 8; void setup() { lcd.begin(); pinMode(PIRpin,...

ไม่มีความคิดเห็น:
แสดงความคิดเห็น