https://static.assets-stash.eet-china.com/album/old-resources/2009/5/14/84d982fa-6d51-4b26-be19-7bd232f408e3.rar# include <reg51.h>
# include <intrins.h>
typedef unsigned char BYTE;
typedef unsigned int WORD;
typedef bit BOOL;
sbit rs="P2"^0;
sbit rw="P2"^1;
sbit ep="P2"^2;
BYTE code dis1 []={"www.xiangfan.com"};
BYTE code dis2 []={"0710-3995204"};
void delay (int m)
{
unsigned char i,j;
for (i=0;i<m;i++)
for (j=0;j<253;j++);
}
BOOL lcd_bz()
{
BOOL result;
rs="0"; // 读忙信号
rw="1";
ep="1";
_nop_();
_nop_();
_nop_();
_nop_();
result = (BOOL)(P0&0x80);
ep="0";
result ;
}
lcd_wcmd (BYTE cmd)
{
while (lcd_bz());
rs="0";
rw="0";
ep="0";
_nop_();
_nop_();
P0=cmd ;
_nop_();
_nop_();
_nop_();
_nop_();
ep="1";
_nop_();
_nop_();
_nop_();
_nop_();
ep="0";
}
lcd_pos (BYTE pos)
{
lcd_wcmd (pos|0x80);
}
lcd_wdat (BYTE dat)
{
while (lcd_bz());
rs="1";
rw="0";
ep="0";
_nop_();
_nop_();
P0=dat ;
_nop_();
_nop_();
_nop_();
_nop_();
ep="1";
_nop_();
_nop_();
_nop_();
_nop_();
ep="0";
}
lcd_init ()
{
lcd_wcmd (0x38);
delay (1);
lcd_wcmd (0x0c);
delay (1);
lcd_wcmd (0x06);
delay (1);
lcd_wcmd (0x01);
delay (1);
}
main ()
{
BYTE i;
lcd_init ();
delay (10);
lcd_pos (0);
i="0";
while (dis1 !='\0')
{
lcd_wdat (dis1 );
i++;
}
lcd_pos (0x41);
i="0";
while (dis2 !='\0')
{
lcd_wdat (dis2 );
i++;
}
while (1);
}
文章评论(0条评论)
登录后参与讨论