下载
加入VIP
  • 专属下载特权
  • 现金文档折扣购买
  • VIP免费专区
  • 千万文档免费下载

上传资料

关闭

关闭

关闭

封号提示

内容

首页 [考试]12232液晶汉字图形显示程序

[考试]12232液晶汉字图形显示程序.doc

[考试]12232液晶汉字图形显示程序

哎哟哟艾西
2017-10-17 0人阅读 举报 0 0 暂无简介

简介:本文档为《[考试]12232液晶汉字图形显示程序doc》,可适用于职业岗位领域

考试液晶汉字图形显示程序液晶汉字图形显示程序时间:来源:作者:点击:字体大小:【大中小】硬件:TGB(*)模拟口线接线方式连接线图:||DBP|DBP|RWP|AP||DBP|DBP|RSP|V接K电阻到GND||DBP|DBP|EP||DBP|DBP|EP|注:ATx使用M或M晶振,实测使用M或都可以编译平台:KeiluV可能看起来有点乱不过效果还是不错的显示图形总的来说比显示汉字要简单,当然显示汉字也不难。希望此程序能给你一些帮助。=============================================================*#include<ATXH>#defineucharunsignedchar#defineuintunsignedint#defineEP块左边#defineEP块右边#defineRWP#defineAPA为时是数据时为指令数据#defineDATAP数据externunsignedcharcodeBmptexternunsignedcharcodeBmptexternunsignedcharcodeBmptexternunsignedcharcodeBmptexternunsignedcharcodeBmptexternunsignedcharcodeBmptexternunsignedcharcodeBmptexternunsignedcharcodeBmptcexternunsignedcharcodebmpexternunsignedcharcodeBmpexternunsignedcharcodeBmpexternunsignedcharcodeBmpexternunsignedcharcodeBmpexternunsignedcharcodeBmpexternunsignedcharcodeBmpexternunsignedcharcodeBmpexternunsignedcharcodeBmpexternunsignedcharcodeBmpexternunsignedcharcodeBmpexternunsignedcharcodeBmp延时voiddelay(unsignedinti){unsignedchark=while(i>){i}while(k>)k}左页发送数据voidOUTMD(unsignedchari){A=写数据delay()E=delay()DATA=idelay()E=}左页发送命令voidOUTMI(unsignedchari){A=写指令delay()E=delay()DATA=idelay()E=}右页发送数据voidOUTSD(unsignedchari){A=写数据delay()E=delay()DATA=idelay()E=}右页发送命令voidOUTSI(unsignedchari){A=写指令delay()E=delay()DATA=idelay()E=}初始化voidlcdini(void){RW=OUTMI(XE)OUTSI(XE)复位OUTMI(XAE)OUTSI(XAE)POWERSAVEOUTMI(XA)OUTSI(XA)动态驱动OUTMI(XA)OUTSI(XA)占空比OUTMI(XA)OUTSI(XA)时钟线输出OUTMI(XEE)OUTSI(XEE)写模式OUTMI(X)OUTMI(XC)OUTSI(X)OUTSI(XC)OUTMI(XAF)OUTSI(XAF)}*函数说明:同时设置主从显示页为,页。(内函数私有用户不直接调用)*voidSetPage(ucharpage,ucharpage){OUTMI(xB|page)OUTSI(xB|page)}*函数说明:同时设置主从列地址为,。(内函数私有用户不直接调用)*voidSetAddress(ucharaddress,ucharaddress){OUTMI(address)OUTSI(address)}*调用方式:voidPutChar(ucharch)函数说明:在右页当前地址画一个字节个点。(内函数私有用户不直接调用)*voidPutCharR(ucharch){OUTSD(ch)}*调用方式:voidPutChar(ucharch)函数说明:在左页当前地址画一个字节个点。(内函数私有用户不直接调用)*voidPutCharL(ucharch){OUTMD(ch)}*调用方式:voidDrawBmp(bitlayer,ucharwidth,uchar*bmp)函数说明:画一个图,layer表示上下层width是图形的宽高都是bmp是图形指针使用zimo软件纵向取模字节倒序字节*voidDrawBmp(bitlayer,ucharwidth,uchar*bmp){ucharx,address,i=address表示显存的物理地址ucharpage=page表示上下两页bitwindow=window表示左右两页putcharR右边putcharL左边for(x=widthx>x){if(i>){window=address=i}elseaddress=iif(layer==)显示一行八个字{SetPage(,)SetAddress(address,address)if(window==)PutCharR(bmpi)elsePutCharL(bmpi)SetPage(,)SetAddress(address,address)if(window==)PutCharR(bmpiwidth)elsePutCharL(bmpiwidth)}else{显示第二行八个汉字SetPage(,)SetAddress(address,address)if(window==)PutCharR(bmpi)elsePutCharL(bmpi)SetPage(,)SetAddress(address,address)if(window==)PutCharR(bmpiwidth)elsePutCharL(bmpiwidth)}i}}*调用方式:voidclrscr(void)函数说明:清屏*voidclrscr(void){uchariucharpagefor(page=page<page){SetPage(page,page)SetAddress(,)for(i=i<i){PutCharR()PutCharL()}}}图片显示采用字模生成或字模生成的都可以voidDrawBmp(uintxadd,ucharwidth,uchar*bmp){ucharx,address,i=address表示显存的物理地址ucharpage=page表示上下两页bitwindow=window表示左右两页putcharR右边putcharL左边for(x=widthx>x){if(xadd>){window=address=xadd}elseaddress=xaddSetPage(,)SetAddress(address,address)if(window==)PutCharR(bmpi)elsePutCharL(bmpi)SetPage(,)SetAddress(address,address)if(window==)PutCharR(bmpiwidth)elsePutCharL(bmpiwidth)SetPage(,)SetAddress(address,address)if(window==)PutCharR(bmpiwidthwidth)elsePutCharL(bmpiwidthwidth)SetPage(,)SetAddress(address,address)if(window==)PutCharR(bmpiwidthwidthwidth)elsePutCharL(bmpiwidthwidthwidth)ixadd}}采用zimo显示汉字,以汉字的显示方式voidDrawword(uchardwhere,uintxadd,bitlayer,ucharwidth)dwhere表示在码表中第几个汉字xadd横坐标位置,layer显示的层,width显示的宽度。voidDrawword(uchardwhere,uintxadd,bitlayer,ucharwidth){ucharx,i=,addressaddress表示显存的物理地址ucharpage=page表示上下两页bitwindow=window表示左右两页putcharR右边putcharL左边dwhere=dwhere*for(x=widthx>x){if(xadd>){window=address=xadd}elseaddress=xaddif(layer==)显示一行八个字{SetPage(,)SetAddress(address,address)if(window==)PutCharR(bmpdwhere)右边elsePutCharL(bmpdwhere)左边SetPage(,)SetAddress(address,address)if(window==)PutCharR(bmpdwherewidth)elsePutCharL(bmpdwherewidth)}else{显示第二行八个汉字SetPage(,)SetAddress(address,address)if(window==)PutCharR(bmpdwhere)右边elsePutCharL(bmpdwhere)左边SetPage(,)SetAddress(address,address)if(window==)PutCharR(bmpdwherewidth)elsePutCharL(bmpdwherewidth)}xadddwhere}}*字模显示一个汉字纵向取模字节倒序voiddispone(bittoplow,bitwidows,ucharaddress,ucharwidth,uchar*bmp){if(toplow==){SetPage(,)SetAddress(address,address)if(window==)PutCharR(bmpnexti)elsePutCharL(bmpnexti)SetPage(,)SetAddress(address,address)if(window==)PutCharR(bmpnextiwidth)elsePutCharL(bmpnextiwidth)}else{SetPage(,)SetAddress(address,address)if(window==)PutCharR(bmpnexti)elsePutCharL(bmpnexti)SetPage(,)SetAddress(address,address)if(window==)PutCharR(bmpnextiwidth)elsePutCharL(bmpnextiwidth)}}*液晶显示规则M(左)S(右)pagepage||||voiddelays(unsignedchari){while(i>){idelay()}}显示动态的等待图标voidwait(unsignedchari){for(i>i){delays()clrscr()DrawBmp(,,Bmptc)DrawBmp(,,Bmpt)delays()clrscr()DrawBmp(,,Bmptc)DrawBmp(,,Bmpt)delays()clrscr()DrawBmp(,,Bmptc)DrawBmp(,,Bmpt)delays()clrscr()DrawBmp(,,Bmptc)DrawBmp(,,Bmpt)delays()clrscr()DrawBmp(,,Bmptc)DrawBmp(,,Bmpt)delays()clrscr()DrawBmp(,,Bmptc)DrawBmp(,,Bmpt)delays()clrscr()DrawBmp(,,Bmptc)DrawBmp(,,Bmpt)}}演示程序voidmain(){lcdini()resetclrscr()clrDrawword(,,,)Drawword(,,,)Drawword(,,,)Drawword(,,,)Drawword(,,,)Drawword(,,,)Drawword(,,,)DrawBmp(,,Bmp)clrscr()delays()DrawBmp(,,Bmp)LOGOwhile(){delays()clrscr()DrawBmp(,,Bmp)delays()clrscr()wait()DrawBmp(,,Bmp)delays()clrscr()wait()DrawBmp(,,Bmp)超前科技delays()clrscr()wait()clrscr()DrawBmp(,,Bmp)delays()clrscr()wait()clrscr()DrawBmp(,,Bmp)delays()clrscr()wait()clrscr()DrawBmp(,,Bmp)delays()clrscr()wait()clrscr()DrawBmp(,,Bmp)这仿真器真不错,用过都说好wait()}}

用户评价(0)

关闭

新课改视野下建构高中语文教学实验成果报告(32KB)

抱歉,积分不足下载失败,请稍后再试!

提示

试读已结束,如需要继续阅读或者下载,敬请购买!

文档小程序码

使用微信“扫一扫”扫码寻找文档

1

打开微信

2

扫描小程序码

3

发布寻找信息

4

等待寻找结果

我知道了
评分:

/16

[考试]12232液晶汉字图形显示程序

VIP

在线
客服

免费
邮箱

爱问共享资料服务号

扫描关注领取更多福利