12864绘图12864c.docx
《12864绘图12864c.docx》由会员分享,可在线阅读,更多相关《12864绘图12864c.docx(19页珍藏版)》请在三一办公上搜索。
1、12864绘图12864c#include 12864.hvoid delayms(unsigned int n)unsigned char i;for(;n>0;n-)for(i=0;i<100;i+);void checkBusy(void)rs=0;rw=1;en=1;dataPort=0xff;while(dataPort & 0x80);en=0;void writeCommand(unsigned char cmd)checkBusy;rs=0;rw=0;en=1;dataPort=cmd;_nop_;en=0;void writeData(unsigned char ad
2、ata)checkBusy;rs=1;rw=0;en=1;dataPort=adata;_nop_;en=0; unsigned char readData(void)unsigned char RData;dataPort=0xff;checkBusy;rs=1;rw=1;en=0;en=1;RData=dataPort;en=0;return RData;void ClrGDRAM(void)unsigned char x,y;for(y=0;y<64;y+)for(x=0;x<16;x+)writeCommand(0x34);writeCommand(y+0x80); /行地址
3、writeCommand(x+0x80); /列地址 writeCommand(0x30);writeData(0x00);writeData(0x00);/writeCommand(0x30); void LcmInit(void) writeCommand(0x30);delayms(50);writeCommand(0x01);delayms(50);writeCommand(0x06);delayms(50);writeCommand(0x0c);ClrGDRAM;psb=1;/在坐标(x,y)处显示字符串void LcmPrint(unsigned char x,unsigned c
4、har y,unsigned char *adata)unsigned char address;unsigned char i=0;switch (y)case 0:address=0x80+x;break;case 1:address=0x90+x;break;case 2:address=0x88+x;break;case 3:address=0x98+x;break;default:break;writeCommand(address);while(*(adata+i)writeData(*(adata+i);i+;/*函数名: disp_picture函数说明: 显示一幅128*64
5、的图画传入参数:图形指针*img传出参数:无返回值: 无*/void disp_picture(unsigned char *img)unsigned char i,j;for(j=0;j<32;j+)for(i=0;i<8;i+)writeCommand(0x34);writeCommand(0x80+j);writeCommand(0x80+i);writeCommand(0x30);writeData(imgj*16+i*2);writeData(imgj*16+i*2+1);for(j=32;j<64;j+)for(i=0;i<8;i+)writeCommand(0x3
6、4);writeCommand(0x80+j-32);writeCommand(0x80+(i+8);writeCommand(0x30);writeData(imgj*16+i*2);writeData(imgj*16+i*2+1);writeCommand(0x36);/*函数名: dispU_picture函数说明: 上半屏显示一幅128*32的图画传入参数:图形指针*img传出参数:无返回值: 无*/void dispU_picture(unsigned char *img)unsigned char i,j;for(j=0;j<32;j+)for(i=0;i<8;i+)wri
7、teCommand(0x34);writeCommand(0x80+j);writeCommand(0x80+i);writeCommand(0x30);writeData(imgj*16+i*2);writeData(imgj*16+i*2+1);writeCommand(0x36);/*函数名: dispD_picture函数说明: 下半屏显示一幅128*32的图画传入参数:图形指针*img传出参数:无返回值: 无*/void dispD_picture(unsigned char *img)unsigned char i,j;for(j=0;j<32;j+)for(i=0;i<8
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 12864 绘图
链接地址:https://www.31ppt.com/p-3141352.html