st7920 12864x显示乱码
时间:10-02
整理:3721RD
点击:
st7920 12864 显示乱码。
下面是我的程序,附一张按地址显示图片。加不加延时都显示如图的字符。求助!
void delay(uint ms){
uint t;
while(ms>0){
ms--;
for(t=0;t<MAX_TIME;t++);
}
}
void command(uchar command){
rs=0;
rw=0;
P1=command;
delay(LONG_DELAY);
e=1;
delay(LONG_DELAY);
e=0;
}
void myData(uchar myData){
rs=1;
rw=0;
P1=myData;
delay(LONG_DELAY);
e=1;
delay(LONG_DELAY);
e=0;
}
void init(){
delay(LONG_DELAY);
command(0x30);//功能设定
delay(LONG_DELAY);
command(0x0f);//显示全开
delay(LONG_DELAY);
command(0x01);//清屏
}
void display(){
uint i;
uchar addr=0x10;
delay(LONG_DELAY);
for(i=0;i<64;i++){
myData(addr);
addr++;
delay(SHORT_DELAY);
}
}
void main(){
init();
display();
while(1);
}
下面是我的程序,附一张按地址显示图片。加不加延时都显示如图的字符。求助!
void delay(uint ms){
uint t;
while(ms>0){
ms--;
for(t=0;t<MAX_TIME;t++);
}
}
void command(uchar command){
rs=0;
rw=0;
P1=command;
delay(LONG_DELAY);
e=1;
delay(LONG_DELAY);
e=0;
}
void myData(uchar myData){
rs=1;
rw=0;
P1=myData;
delay(LONG_DELAY);
e=1;
delay(LONG_DELAY);
e=0;
}
void init(){
delay(LONG_DELAY);
command(0x30);//功能设定
delay(LONG_DELAY);
command(0x0f);//显示全开
delay(LONG_DELAY);
command(0x01);//清屏
}
void display(){
uint i;
uchar addr=0x10;
delay(LONG_DELAY);
for(i=0;i<64;i++){
myData(addr);
addr++;
delay(SHORT_DELAY);
}
}
void main(){
init();
display();
while(1);
}