新聞中心

EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計應(yīng)用 > 51單片機的LCD1602液晶密碼鎖C語言程序

51單片機的LCD1602液晶密碼鎖C語言程序

作者: 時間:2016-11-28 來源:網(wǎng)絡(luò) 收藏
void t0(void) interrupt 1 using 0
{ tcount++;
if(tcount==20)
{second++;
tcount=0;
if(second==30)
{second=0;
gg=0;
display3();
}
}
}
void display(void)
{
switch(kk)
{case 1:
write_order(0x91);
write_date(0xa3);
write_date(0xaa);
break;
case 2:
write_order(0x92);
write_date(0xa3);
write_date(0xaa);
break;
case 3:
write_order(0x93);
write_date(0xa3);
write_date(0xaa);
break;
case 4:
write_order(0x94);
write_date(0xa3);
write_date(0xaa);
break;
case 5:
write_order(0x95);
write_date(0xa3);
write_date(0xaa);
break;
case 6:
write_order(0x96);
write_date(0xa3);
write_date(0xaa);
break;
}
}
void display0(void)
{
write_order(0x80);
write_date(0xc7);
write_date(0xeb);
write_date(0xca);
write_date(0xe4);
write_date(0xc8);
write_date(0xeb);
write_date(0xc3);
write_date(0xdc);
write_date(0xc2);
write_date(0xeb);
}
void display1(void)
{
write_order(0x8a);
write_date(0xc3);
write_date(0xdc);
write_date(0xc2);
write_date(0xeb);
write_date(0xd5);
write_date(0xfd);
write_date(0xc8);
write_date(0xb7);
write_date(0xa3);
write_date(0xa1);
}
void display2(void)
{
write_order(0x8a);
write_date(0xc3);
write_date(0xdc);
write_date(0xc2);
write_date(0xeb);
write_date(0xb4);
write_date(0xed);
write_date(0xce);
write_date(0xf3);
write_date(0xa3);
write_date(0xa1);
}
void display3(void)
{
write_order(0x98);
write_date(0xca);
write_date(0xe4);
write_date(0xc8);
write_date(0xeb);
write_date(0xc3);
write_date(0xdc);
write_date(0xc2);
write_date(0xeb);
write_date(0xca);
write_date(0xb1);
write_date(0xbc);
write_date(0xe4);
write_date(0xd2);
write_date(0xd1);
write_date(0xb5);
write_date(0xb9);
}
void lcd_int(void)
{ret=0;
delay(10);
ret=1;
_nop_();
psb=1;
_nop_();
}
void functionset(void)
{
write_order(0x34);
write_order(0x30);
write_order(0x01);
write_order(0x06);
write_order(0x0c);
}
void clear_lcd(void)
{
write_order(0x01);
write_order(0x34);
write_order(0x30);
}
void write_order(uchar command)
{
delay(100);
rs=0;
rw=0;
P0=command;
en=1;
_nop_();
_nop_();
en=0;
}
void write_date(uchar date)
{
delay(100);
rs=1;
rw=0;
P0=date;
en=1;
_nop_();
_nop_();
en=0;
}

上一頁 1 2 下一頁

關(guān)鍵詞: 51單片機LCD1602液晶密碼

評論


相關(guān)推薦

技術(shù)專區(qū)

關(guān)閉