標(biāo)題:
自動飲品機頁面顯示 單片機程序
[打印本頁]
作者:
dianGad
時間:
2020-4-21 16:00
標(biāo)題:
自動飲品機頁面顯示 單片機程序
利用1602A液晶屏顯示
通過地址變量實現(xiàn)漸入顯示
#include<reg52.h>
#define uchar unsigned char
#define uint unsigned int
sbit lcden=P3^4;
sbit rs=P3^5;
sbit rw=P3^6;
sbit dula=P2^6;
sbit wela=P2^7;
uchar table1[]=" Welcome! ";
uchar table2[]=" which one? ";
void delay(uint x)
{
uint a,b;
for(a=x;a>0;a--)
for(b=10;b>0;b--);
}
void delay1(uint x)
{
uint a,b;
for(a=x;a>0;a--)
for(b=100;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 init()
{
rw=0;
dula=0;
wela=0;
write_com(0x38);
delay(20);
write_com(0x0f);
delay(20);
write_com(0x06);
delay(20);
write_com(0x01);
delay(20);
}
void main()
{
uchar a;
init();
write_com(0x80+17);
delay(20);
for(a=0;a<13;a++)
{
write_date(table1[a]);
delay(20);
}
write_com(0xc0+17);
delay(50);
for(a=0;a<13;a++)
{
write_date(table2[a]);
delay(40);
}
for(a=0;a<16;a++)
{
write_com(0x18)
delay1(600);
}
while(1);
}
······部分改動(非原創(chuàng))········
······分享給大家,可以借鑒·······
作者:
admin
時間:
2020-4-22 02:35
本帖需要重新編輯補全電路原理圖,源碼,詳細說明與圖片即可獲得100+黑幣(帖子下方有編輯按鈕)
歡迎光臨 (http://www.torrancerestoration.com/bbs/)
Powered by Discuz! X3.1