怎么在单片机80c51输出hello world

用C语言输出

这个是用1602写的程序,已经调试。用其他的液晶无法显示,只能用1602。
希望对你有帮助。

#include<reg52.h>
#define uchar unsigned char
#define uint unsigned int
sbit rs=P3^5;
sbit lcden=P3^4;
sbit dula=P2^6;
sbit wela=P2^7;
sbit rw=P3^6;
uchar table1[]="hello world";
uchar table2[]="hello world";
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;
rw = 0;
lcden=0;
delay(10);
lcden=1;
delay(10);
lcden=0;

}

void write_date(uchar date)
{
P0=date;
rs=1;
rw = 0;
lcden=0;
delay(10);
lcden=1;
delay(10);
lcden=0;

}

void init()
{
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<9;a++)
{
write_date(table1[a]);
delay(20);
}

write_com(0xc0+17);
delay(50);
for(a=0;a<11;a++)
{
write_date(table2[a]);
delay(40);
}

for(a=0;a<11;a++)
{
write_com(0x18);
delay1(200);
}
while(1);
}
温馨提示:内容为网友见解,仅供参考
第1个回答  2010-10-29
printf("hello world");
第2个回答  2010-10-25
用什么点阵输出还是液晶呀