12864液晶只能正常显示英文, 汉字和数字均乱码

12864液晶只能正常显示英文, 汉字和数字均乱码,第1张

显示的一个,给你吧

#include<reg52h>

#define Data P0

#define uint unsigned int

#define uchar unsigned char

sbit RS = P2^0;

sbit RW = P2^1;

sbit E = P2^2;

sbit PSB = P1^3;

sbit RET = P1^6;

/////////////////////////////////////////////////////////////////////////

// Bitmap点阵数据表 //

// : C:\桌面\1111bmp,横向取模左高位,数据排列:从左到右从上到下 //

// 尺寸: 128 64 //

/////////////////////////////////////////////////////////////////////////

unsigned char code nBitmapDot[] = // 数据表

{

0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,

0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,

0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,

0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,

0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,

0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,

0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,

0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,

0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,

0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,

0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,

0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,

0xFF,0xBF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,

0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,

0xFF,0xBF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,

0xFF,0xFF,0xF3,0xFF,0xFF,0xFF,0xFF,0xFF,

0xFF,0xBF,0xFF,0xFF,0xFF,0xFE,0x7F,0xFF,

0xFF,0xFF,0xC8,0xFF,0xFF,0xFF,0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,0xFF,0xFB,0xFF,0x9F,0xFE,

0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,

0xFF,0xF9,0xFF,0xFF,0xFD,0x4F,0xE0,0x3F,

0x63,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,

0xFF,0xF9,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,

0x1C,0x3F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,

0xFF,0xFD,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,

0x02,0x9F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,

0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,

0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF

};

void delayUs() ;

void wait();

void writeData(uchar dat)

{

wait();

RS = 1;

RW = 0;

E = 0;

Data = dat;

E = 1;

delayUs();

E = 0;

}

void delayUs()

{uint j,i;

for(i=2;i>0;i--)

for(j = 1; j > 0; j--);

}

void delayMs(uint a)

{

uint i, j;

for(i = a; i > 0; i--)

for(j = 100; j > 0; j--);

}

bit checkBusy()

{

bit busy;

RS = 0;

RW = 1;

E = 1;

delayUs();

busy = (bit)(Data&0x80);

E = 0;

return busy;

}

void wait()

{

while(checkBusy());

}

void writeCmd(uchar cmd)

{

wait();

RS = 0;

RW = 0;

E = 0;

delayUs();

Data = cmd;

delayUs();

E = 1;

delayUs();

E = 0;

}

void init()

{ RET=1;

PSB = 1; //并口方式

writeCmd(0x30); //基本指令, 扩充指令为34H

delayMs(20);

writeCmd(0x0c); //显示开, 关光标

delayMs(20);

writeCmd(0x01); //清屏

delayMs(20);

}

void display(uchar p)

{ uchar x,y;

for(y=0;y<32;y++)

for (x=0;x<8;x++)

{ writeCmd(0x36);

writeCmd(0x80+y);

writeCmd(0x80+x);

writeData(p[2x+16y]); writeData(p[2x+16y+1]); writeCmd(0x30);

}

for(y=0;y<32;y++)

for (x=0;x<8;x++)

{ writeCmd(0x36);

writeCmd(0x80+y);

writeCmd(0x80+x+8);

writeData(p[2x+16y+512]); writeData(p[2x+16y+513]); writeCmd(0x30);

}

}

void main()

{

RET=0;

init();

while(1)

{

display(nBitmapDot); delayMs(100000);

} }

以上就是关于12864液晶只能正常显示英文汉字和数字均乱码全部的内容,包括:12864液晶只能正常显示英文, 汉字和数字均乱码、如何详细的去使用12864液晶模块、求一个STC-89C52RC控制12864液晶显示的程序等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zz/9275522.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-26
下一篇 2023-04-26

发表评论

登录后才能评论

评论列表(0条)

保存