標(biāo)題:
請教 12864液晶顯示字符問題
[打印本頁]
作者:
xl49462870
時(shí)間:
2010-1-25 12:32
標(biāo)題:
請教 12864液晶顯示字符問題
fyd12864-0204b
液晶
st7920
控制器
程序
燒進(jìn)去 ,本來輸入的是 “ 床前明月光,疑是地上霜。舉頭望明月,低頭思故鄉(xiāng)。” 可是卻顯示 “ 黨潛明彰廣一 由飼蒂上雙。摳頭望明彰一 低頭私顧?quán)l(xiāng)。”我剛學(xué)
單片機(jī)
,在此
請教
大家了。以下是我用的程序,字?jǐn)?shù)對,位置也對,就是字錯(cuò)。
#include<reg52.h>
#include<intrins.h>
//#include<stdlib.h> //rand();
#define uint unsigned int
#define uchar unsigned char
#define LCD_data P0;
sbit LCD_RS =P2^6;
sbit LCD_RW =P2^5;
sbit LCD_EN =P2^7;
sbit LCD_PSB = P3^2;
sbit wela =P1^2;
sbit dula=P1^3;
//uchar dis1[10];
uchar code dis1[]={"床前明月光,"};
uchar code dis2[]={"疑是地上霜。"};
uchar code dis3[]={"舉頭望明月,"};
uchar code dis4[]={"低頭思故鄉(xiāng)。"};
void delay_1ms(uint x)
{
uint i,j;
for(j=0;j<x;j++)
for(i=0;i<110;i++);
}
void write_cmd(uchar cmd)
{
LCD_RS=0;
LCD_RW=0;
LCD_EN=0;
P0=cmd;
delay_1ms(5);
LCD_EN = 1;
delay_1ms(5);
LCD_EN= 0;
}
void write_dat(uchar dat)
{
LCD_RS = 1;
LCD_RW= 0;
LCD_EN= 0;
P0=dat;
delay_1ms(5);
LCD_EN= 1;
delay_1ms(5);
LCD_EN= 0;
}
void lcd_pos(uchar X,uchar Y)
{
uchar pos;
if(X==0)
{X=0x80;}
else if(X==1)
{X=0x90;}
else if(X==2)
{X=0x88;}
else if(X==3)
{X=0x98;}
pos= X+Y;
write_cmd(pos);
}
void lcd_init()
{
LCD_PSB=1;
write_cmd(0x30);
delay_1ms(5);
write_cmd(0x0c);
delay_1ms(5);
write_cmd(0x01);
delay_1ms(5);
}
void main()
{
uchar i;
wela=0;
dula=0;
delay_1ms(5);
lcd_init();
while(1)
{
lcd_pos(0,0);
i=0;
while(dis1
!='\0')
{
write_dat(dis1
);
i++;
}
lcd_pos(1,0);
i=0;
while(dis2
!='\0')
{
write_dat(dis2
);
i++;
}
delay_1ms(10);
lcd_pos(2,0);
i=0;
while(dis3
!='\0')
{
write_dat(dis3
);
i++;
}
delay_1ms(10);
lcd_pos(3,0);
i=0;
while(dis4
!='\0')
{
write_dat(dis4
);
i++;
}
delay_1ms(10);
}
//delay_1ms(10);
}
作者:
renmin
時(shí)間:
2010-1-25 13:05
現(xiàn)在沒有時(shí)間,回家找時(shí)間板你看看,
作者:
ccc
時(shí)間:
2010-1-26 03:23
你這個(gè)問題比較怪,你把標(biāo)點(diǎn)符號去掉看看,或者換一個(gè)keil版本
作者:
chenguangyou
時(shí)間:
2015-6-9 11:06
原因可能是:12864本身自帶的中文字庫是不全的,有些中文字顯示不了。這里不能顯示這么多漢字,不大可能是這個(gè)原因。,
作者:
ahshmj
時(shí)間:
2015-6-9 21:26
標(biāo)點(diǎn)符號也要用全角字符才行。
歡迎光臨 (http://www.torrancerestoration.com/bbs/)
Powered by Discuz! X3.1