資源簡介
用的是1602液晶顯示,IO口接線位置已經(jīng)注明

代碼片段和文件信息
#include
#define?uchar?unsigned?char
#define?uint?unsigned?int
sbit?dula=P2^6;
sbit?wela=P2^7;
sbit?rs=P3^5;
sbit?lcden=P3^4;
void?delay(uint?x)
{
uint?ab;
for(a=x;a>0;a--)
for(b=10;b>0;b--);?
}
void?write_com(uchar?com)
{
P0=com;
rs=0;
lcden=0;
delay(10);
lcden=1;
delay(10);
lcden=0;
}
void?write_date(uchar?date)
{
P0=date;
rs=1;
lcden=0;
delay(10);
lcden=1;
delay(10);
lcden=0;
}
void?initLCD()
{
dula=0;
wela=0;
write_com(0x38);
delay(20);
write_com(0x0f);
delay(20);
write_com(0x06);
delay(20);
write_com(0x01);
delay(20);
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2016-05-28?10:28??ZM2.1?超聲波測距?-?副本\
?????文件?????????632??2013-11-23?13:25??ZM2.1?超聲波測距?-?副本\LCD.c
?????文件????????2438??2015-08-27?17:58??ZM2.1?超聲波測距?-?副本\LCD.LST
?????文件????????3323??2015-08-27?17:58??ZM2.1?超聲波測距?-?副本\LCD.OBJ
?????文件????????2798??2016-05-28?10:28??ZM2.1?超聲波測距?-?副本\main.c
?????文件????????6897??2015-08-27?17:58??ZM2.1?超聲波測距?-?副本\main.LST
?????文件???????11021??2015-08-27?17:58??ZM2.1?超聲波測距?-?副本\main.OBJ
?????文件????????6376??2009-10-13?13:40??ZM2.1?超聲波測距?-?副本\STARTUP.A51
?????文件???????14048??2015-08-27?17:58??ZM2.1?超聲波測距?-?副本\STARTUP.LST
?????文件?????????758??2015-08-27?17:58??ZM2.1?超聲波測距?-?副本\STARTUP.OBJ
?????文件???????13498??2015-08-27?17:58??ZM2.1?超聲波測距?-?副本\supersonic
?????文件????????4336??2015-08-27?17:58??ZM2.1?超聲波測距?-?副本\supersonic.hex
?????文件??????????74??2015-08-27?17:58??ZM2.1?超聲波測距?-?副本\supersonic.lnp
?????文件???????18732??2015-08-27?17:58??ZM2.1?超聲波測距?-?副本\supersonic.M51
?????文件????????1814??2013-11-23?13:47??ZM2.1?超聲波測距?-?副本\supersonic.opt.bak
?????文件?????????211??2016-05-28?10:28??ZM2.1?超聲波測距?-?副本\supersonic.plg
?????文件????????2206??2013-09-20?20:44??ZM2.1?超聲波測距?-?副本\supersonic.Uv2.bak
?????文件???????59130??2016-05-28?10:28??ZM2.1?超聲波測距?-?副本\supersonic.uvopt
?????文件???????13550??2015-08-28?12:20??ZM2.1?超聲波測距?-?副本\supersonic.uvproj
?????文件????????1817??2013-11-23?13:32??ZM2.1?超聲波測距?-?副本\supersonic_Opt.Bak
?????文件????????2173??2009-09-08?18:17??ZM2.1?超聲波測距?-?副本\supersonic_Uv2.Bak
?????文件???????59138??2016-04-17?10:46??ZM2.1?超聲波測距?-?副本\supersonic_uvopt.bak
?????文件????????3468??2009-05-24?14:45??ZM2.1?超聲波測距?-?副本\超聲波.LST
?????文件????????4455??2009-05-24?14:45??ZM2.1?超聲波測距?-?副本\超聲波.OBJ
評論
共有 條評論