用KEIL编写的C显示汉字,请高手帮忙看看
时间:10-02
整理:3721RD
点击:
#include<reg51.h>
#include<intrins.h>
sbit rs = P3^5;
sbit rw = P3^6;
sbit ep = P3^7;
unsigned char code dis1[] ={0x00,0xF0,0x0F,0x10,0x08,0x10,0x0F,0xA0,0x08,0x20,0x07,0xC0,0x00,0x00,0x01,0xF8,
0x1E,0x08,0x10,0xC8,0x1F,0x08,0x10,0x08,0x0F,0xD0,0x00,0x30,0x00,0x10,0x00,0x00,
0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0xFC,0x7F,0x00,0x01,0x00,0x01,0xF0,
0x0F,0x00,0x00,0x00,0x03,0xF0,0x0C,0x10,0x08,0x20,0x07,0xE0,0x04,0x00,0x00,0x00,
0x00,0x20,0x12,0x20,0x09,0x20,0x00,0x40,0x23,0xFC,0x3C,0x08,0x63,0xC0,0x44,0x80,
0x01,0x00,0x01,0xF8,0x7E,0x80,0x00,0x80,0x00,0x80,0x02,0x80,0x01,0x00,0x00,0x00,
0x00,0x00,0x00,0x80,0x78,0x40,0x4A,0xF8,0x53,0x08,0x54,0x60,0x69,0x80,0x58,0x70,
0x43,0xC0,0x41,0x40,0x42,0x44,0x44,0x44,0x48,0x44,0x50,0x38,0x00,0x00,0x00,0x00 };
unsigned char code dis2[] ={"www.adu0228.com"};
void delay(unsigned char ms)
{
unsigned char i;
while(ms--)
{
for(i=0; i<250; i++)
{
_nop_();
_nop_();
_nop_();
_nop_();
}
}
}
bit lcd_bz()
{
bit result;
rs = 1;
rw = 0;
ep = 1;
_nop_();
_nop_();
_nop_();
_nop_();
result = (bit)(P1 & 0x80);
ep = 0;
return result;
}
void lcd_wcmd(unsigned char cmd)
{
while(lcd_bz()); //判断LCD是否忙碌
rs = 0;
rw = 0;
ep = 0;
_nop_();
_nop_();
P1 = cmd;
_nop_();
_nop_();
// _nop_();
// _nop_();
ep = 1;
_nop_();
_nop_();
// _nop_();
// _nop_();
ep = 0;
}
void lcd_pos(unsigned char pos)
{
lcd_wcmd(pos | 0x80);
}
void lcd_wdat(unsigned char dat)
{
while(lcd_bz());//判断LCD是否忙碌
rs = 1;
rw = 0;
ep = 0;
P1 = dat;
_nop_();
_nop_();
// _nop_();
// _nop_();
ep = 1;
_nop_();
_nop_();
// _nop_();
// _nop_();
ep = 0;
}
void lcd_init()
{
lcd_wcmd(0x38);
delay(1);
lcd_wcmd(0x0c);
delay(1);
lcd_wcmd(0x06);
delay(1);
lcd_wcmd(0x01);
delay(1);
}
void main(void)
{
unsigned char i;
lcd_init();//初始化LCD
delay(10);
while(1)
{
lcd_pos(0x01);//设置显示位置
i = 0;
while(dis1[i] != '\0')
{
lcd_wdat(dis1[i]);//显示字符
i++;
}
lcd_pos(0x42);//设置显示位置
i =0;
while(dis2[i] != '\0')
{
lcd_wdat(dis2[i]);//显示字符
i++;
}
}
}
这个程序怎么改
#include<intrins.h>
sbit rs = P3^5;
sbit rw = P3^6;
sbit ep = P3^7;
unsigned char code dis1[] ={0x00,0xF0,0x0F,0x10,0x08,0x10,0x0F,0xA0,0x08,0x20,0x07,0xC0,0x00,0x00,0x01,0xF8,
0x1E,0x08,0x10,0xC8,0x1F,0x08,0x10,0x08,0x0F,0xD0,0x00,0x30,0x00,0x10,0x00,0x00,
0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0xFC,0x7F,0x00,0x01,0x00,0x01,0xF0,
0x0F,0x00,0x00,0x00,0x03,0xF0,0x0C,0x10,0x08,0x20,0x07,0xE0,0x04,0x00,0x00,0x00,
0x00,0x20,0x12,0x20,0x09,0x20,0x00,0x40,0x23,0xFC,0x3C,0x08,0x63,0xC0,0x44,0x80,
0x01,0x00,0x01,0xF8,0x7E,0x80,0x00,0x80,0x00,0x80,0x02,0x80,0x01,0x00,0x00,0x00,
0x00,0x00,0x00,0x80,0x78,0x40,0x4A,0xF8,0x53,0x08,0x54,0x60,0x69,0x80,0x58,0x70,
0x43,0xC0,0x41,0x40,0x42,0x44,0x44,0x44,0x48,0x44,0x50,0x38,0x00,0x00,0x00,0x00 };
unsigned char code dis2[] ={"www.adu0228.com"};
void delay(unsigned char ms)
{
unsigned char i;
while(ms--)
{
for(i=0; i<250; i++)
{
_nop_();
_nop_();
_nop_();
_nop_();
}
}
}
bit lcd_bz()
{
bit result;
rs = 1;
rw = 0;
ep = 1;
_nop_();
_nop_();
_nop_();
_nop_();
result = (bit)(P1 & 0x80);
ep = 0;
return result;
}
void lcd_wcmd(unsigned char cmd)
{
while(lcd_bz()); //判断LCD是否忙碌
rs = 0;
rw = 0;
ep = 0;
_nop_();
_nop_();
P1 = cmd;
_nop_();
_nop_();
// _nop_();
// _nop_();
ep = 1;
_nop_();
_nop_();
// _nop_();
// _nop_();
ep = 0;
}
void lcd_pos(unsigned char pos)
{
lcd_wcmd(pos | 0x80);
}
void lcd_wdat(unsigned char dat)
{
while(lcd_bz());//判断LCD是否忙碌
rs = 1;
rw = 0;
ep = 0;
P1 = dat;
_nop_();
_nop_();
// _nop_();
// _nop_();
ep = 1;
_nop_();
_nop_();
// _nop_();
// _nop_();
ep = 0;
}
void lcd_init()
{
lcd_wcmd(0x38);
delay(1);
lcd_wcmd(0x0c);
delay(1);
lcd_wcmd(0x06);
delay(1);
lcd_wcmd(0x01);
delay(1);
}
void main(void)
{
unsigned char i;
lcd_init();//初始化LCD
delay(10);
while(1)
{
lcd_pos(0x01);//设置显示位置
i = 0;
while(dis1[i] != '\0')
{
lcd_wdat(dis1[i]);//显示字符
i++;
}
lcd_pos(0x42);//设置显示位置
i =0;
while(dis2[i] != '\0')
{
lcd_wdat(dis2[i]);//显示字符
i++;
}
}
}
这个程序怎么改
没明白你要干什么
这也太不具体了吧,你起码截个图,错误什么样的描述一下啊
我要它显示我要显示的汉字如新年快乐,可是我在编译没有错误,Proteus不显示汉字,我把 unsigned char code dis1[] ={这写入字母显示}
如何把我写的字模写人LM016L的显示屏中,怎么修改它
高手谁有用AT89C51和LM016L做的显示汉字的C程序,我想修改一下别人的程序来显示汉字,可是不显示,怎么显然CGROM中,在我上面的程序怎么修改,程序编译没有错误,用原来的程序在PROTEUS试验可以显示正常。请各位大仙大侠帮忙看看,怎么修改
原来可以显示四个汉字+www.adu0228.com?
是啊,可是这是字母,我要显示汉字,应该吧字模写入CGRAM中得,不知道应该改哪个位置,显示www.adu0228.com
我试了。可以显示,就是把它改成显示汉字的不对
刚才查了一下LM016L,它只能显示字符,不能显示汉字