19264显示驱动程序.docx
- 文档编号:4871371
- 上传时间:2022-12-11
- 格式:DOCX
- 页数:11
- 大小:15.44KB
19264显示驱动程序.docx
《19264显示驱动程序.docx》由会员分享,可在线阅读,更多相关《19264显示驱动程序.docx(11页珍藏版)》请在冰豆网上搜索。
19264显示驱动程序
19264
控制器KS0108
#include
#include
#include"zimo.h"
#defineRSP2_6/*"H"issendorreadthedata;"L"istheinstruction*/
#defineRWP3_6
#defineEP2_5/*Operationenable*/
#defineCS1P2_4
#defineCS2P2_3
#defineCS3P2_2
#defineDATAP0
#defineucharunsignedchar
#defineuintunsignedint
/*----------------------------------------------------------------------------
Delaysometime
------------------------------------------------------------------------------*/
voiddelay10ms(unsignedcharx)
{
unsignedchari,j,k;
for(i=0;i for(j=0;j<10;j++) for(k=0;k<120;k++); } /*---------------------------------------------------------------------------- SendtheinstructiontotheFirstKS0108window ------------------------------------------------------------------------------ --*/ voidOutFI(uchari) { unsignedchardata_sta; do{ E=0;RW=1;RS=0;CS1=0;_nop_(); E=1;_nop_(); data_sta=DATA; E=0;RW=0;CS1=1;E=1; }while(data_sta&0x80); E=0;RW=0;RS=0;CS1=0;_nop_(); E=1;_nop_(); DATA=i; _nop_();E=0;RW=1;CS1=1;E=1; } /*---------------------------------------------------------------------------- SendtheinstructiontotheSecondKS0108window. ------------------------------------------------------------------------------ --*/ voidOutSI(uchari) { unsignedchardata_sta; do{ E=0;RW=1;RS=0;CS2=0;_nop_(); E=1;_nop_(); data_sta=DATA; E=0;RW=0;CS2=1;E=1; }while(data_sta&0x80); E=0;RW=0;RS=0;CS2=0;_nop_(); E=1;_nop_(); DATA=i; _nop_();E=0;RW=1;CS2=1;E=1; } /*---------------------------------------------------------------------------- SendtheinstructiontotheThirdKS0108window ------------------------------------------------------------------------------ --*/ voidOutTI(uchari) { unsignedchardata_sta; do{ E=0;RW=1;RS=0;CS3=0;_nop_(); E=1;_nop_(); data_sta=DATA; E=0;RW=0;CS3=1;E=1; }while(data_sta&0x80); E=0;RW=0;RS=0;CS3=0;_nop_(); E=1;_nop_(); DATA=i; _nop_();E=0;RW=1;CS3=1;E=1; } /*---------------------------------------------------------------------------- SendthedatatotheFirstks0108Window ------------------------------------------------------------------------------ --*/ voidOutFD(uchari) { unsignedchardata_sta; do{ E=0;RW=1;RS=0;CS1=0;_nop_(); E=1;_nop_(); data_sta=DATA; E=0;RW=0;CS1=1;E=1; }while(data_sta&0x80); E=0;RW=0;RS=1;CS1=0;_nop_(); E=1;_nop_(); DATA=i; _nop_();E=0;RW=1;CS1=1;E=1; } /*---------------------------------------------------------------------------- SendthedatatotheSecondks0108Window ------------------------------------------------------------------------------ --*/ voidOutSD(uchari) { unsignedchardata_sta; do{ E=0;RW=1;RS=0;CS2=0;_nop_(); E=1;_nop_(); data_sta=DATA; E=0;RW=0;CS2=1;E=1; }while(data_sta&0x80); E=0;RW=0;RS=1;CS2=0;_nop_(); E=1;_nop_(); DATA=i; _nop_();E=0;RW=1;CS2=1;E=1; } /*---------------------------------------------------------------------------- SendthedatatotheThirdks0108Window ------------------------------------------------------------------------------ --*/ voidOutTD(uchari) { unsignedchardata_sta; do{ E=0;RW=1;RS=0;CS3=0;_nop_(); E=1;_nop_(); data_sta=DATA; E=0;RW=0;CS3=1;E=1; }while(data_sta&0x80); E=0;RW=0;RS=1;CS3=0;_nop_(); E=1;_nop_(); DATA=i; _nop_();E=0;RW=1;CS3=1;E=1; } /*---------------------------------------------------------------------------- ReadthedatatotheFirstks0108Window ------------------------------------------------------------------------------ --*/ /*unsignedcharRD_data_F() { unsignedchardata_sta; do{ E=0;RW=1;RS=0;CS1=0;_nop_(); E=1;_nop_(); data_sta=DATA; E=0;RW=0;CS1=1;E=1; }while(data_sta&0x80); E=0;RW=1;RS=1;CS1=0;_nop_(); E=1;_nop_();_nop_();_nop_(); data_sta=DATA; _nop_();E=0;RW=0;CS1=1;E=1; return(data_sta); } /*---------------------------------------------------------------------------- ReadthedatatotheSecondks0108Window ------------------------------------------------------------------------------ --*/ /*unsignedcharRD_data_S() { unsignedchardata_sta; do{ E=0;RW=1;RS=0;CS2=0;_nop_(); E=1;_nop_();_nop_();_nop_(); data_sta=DATA; E=0;RW=0;CS2=1;E=1; }while(data_sta&0x80); E=0;RW=1;RS=1;CS2=0;_nop_(); E=1;_nop_(); data_sta=DATA; _nop_();E=0;CS2=1;E=1; return(data_sta); } /*---------------------------------------------------------------------------- ReadthedatatotheThirdks0108Window ------------------------------------------------------------------------------ --*/ /*unsignedcharRD_data_T() { unsignedchardata_sta; do{ E=0;RW=1;RS=0;CS3=0;_nop_(); E=1;_nop_();_nop_();_nop_(); data_sta=DATA; E=0;RW=0;CS3=1;E=1; }while(data_sta&0x80); E=0;RW=1;RS=1;CS3=0;_nop_(); E=1;_nop_(); data_sta=DATA; _nop_();E=0;CS3=1;E=1; return(data_sta); } /*------------------------------------------------------------------------------ InitializetheLCD,Thesystemreset,invokeFirsttime -------------------------------------------------------------------------------- -*/ voidInitLCD() { OutFI(0x40);/*SettheYaddress0*/ OutSI(0x40); OutTI(0x40); OutFI(0xb8);/*SetthePage0*/ OutSI(0xb8); OutTI(0xb8); OutFI(0xc0);/*Setthedisplaystartline0*/ OutSI(0xc0); OutTI(0xc0); OutFI(0x3f);/*DisplayON*/ OutSI(0x3f); OutTI(0x3f); } /*------------------------------------------------------------------------------ Clearthethreeks0108'sdisplayram. Clrscrscreen -------------------------------------------------------------------------------- -*/ voidClrscreen() { unsignedchari,j; for(i=0;i<8;i++) { OutFI(0xb8|i); for(j=0;j<64;j++) { OutFI(j|0x40); OutFD(0); } } for(i=0;i<8;i++) { OutSI(0xb8|i); for(j=0;j<64;j++) { OutSI(j|0x40); OutSD(0); } } for(i=0;i<8;i++) { OutTI(0xb8|i); for(j=0;j<64;j++) { OutTI(j|0x40); OutTD(0); } } } /*------------------------------------------------------------------------------ -- DisplayChineseideograph;x_addisthexaddress;Ithas4layers,0,1,2,3; WidthistheChineseideographwidth;bmpisthetable'sname -------------------------------------------------------------------------------- -*/ voidDrawBmp(ucharx_add,ucharlayer,ucharwidth,uchar*bmp) { unsignedcharx; unsignedinti=0; for(x=x_add;x { if(x>127)/*TheThirdKS0108*/ { OutTI((x-128)|0x40);/*Setthexaddress*/ OutTI(layer|0xb8);/*Settheyaddress*/ OutTD(bmp[i]);/*SendthddatatoLCDram*/ OutTI((x-128)|0x40);/*Displaythedownscreen*/ OutTI((layer|0xb8)+1); i++;/*Displayzimotableaddressadd1*/ OutTD(bmp[i]); } elseif(x>63)/*TheSecondks0108*/ { OutSI((x-64)|0x40); OutSI(layer|0xb8); OutSD(bmp[i]); OutSI((x-64)|0x40); OutSI((layer|0xb8)+1); i++; OutSD(bmp[i]); } else/*TheFirstks0108*/ { OutFI(x|0x40); OutFI(layer|0xb8); OutFD(bmp[i]); OutFI(x|0x40); OutFI((layer|0xb8)+1); i++; OutFD(bmp[i]); } i++; } } /*------------------------------------------------------------------------------ -- DisplayChineseideograph;x_addisthexaddress;Ithas4layers,0,1,2,3; WidthistheChineseideographwidth;bmpisthetable'sname. -------------------------------------------------------------------------------- -*/ voidDrawBmp_f(ucharx_add,ucharlayer,ucharwidth,uchar*bmp) { unsignedcharx; unsignedinti=0; for(x=x_add;x { if(x>127) { OutTI((x-128)|0x40); OutTI(layer|0xb8); OutTD(~bmp[i]); OutTI((x-128)|0x40); OutTI((layer|0xb8)+1); i++; OutTD(~bmp[i]); } elseif(x>63) { OutSI((x-64)|0x40); OutSI(layer|0xb8); OutSD(~bmp[i]); OutSI((x-64)|0x40); OutSI((layer|0xb8)+1); i++; OutSD(~bmp[i]); } else { OutFI(x|0x40); OutFI(layer|0xb8); OutFD(~bmp[i]); OutFI(x|0x40); OutFI((layer|0xb8)+1); i++; OutFD(~bmp[i]); } i++; } } /*------------------------------------------------------------------------------ -- Displayindention;x_addisthexaddress;Ithas4layers,0,1,2,3; WidthistheChineseideographwidth -------------------------------------------------------------------------------- -*/ void_DrawBmp_(ucharx_add,ucharlayer,ucharwidth) { unsignedcharx; for(x=x_add;x { if(x>127) { OutTI((x-128)|0x40); OutTI(layer|0xb8); OutTD(0); OutTI((x-128)|0x40); OutTI((layer|0xb8)+1); OutTD(0); } elseif(x>63) { OutSI((x-64)|0x40); OutSI(layer|0xb8); OutSD(0); OutSI((x-64)|0x40); OutSI((layer|0xb8)+1); OutSD(0); } else { OutFI(x|0x40); OutFI(layer|0xb8); OutFD(0); OutFI(x|0x40); OutFI((layer|0xb8)+1); OutFD(0); } } } /*------------------------------------------------------------------------------ -- Displayindention;x_addisthexaddress;Ithas4layers,0,1,2,3; WidthistheChineseideographwidth -------------------------------------------------------------------------------- -*/ void_DrawBmp_black(ucharx_add,ucharlayer,ucharwidth) { unsignedcharx; for(x=x_add;x { if(x>127) { OutTI((x-128)|0x40); OutTI(layer|0xb8); OutTD(0xff); OutTI((x-128)|0x40); OutTI((layer|0xb8)+1); OutTD(0xff); } elseif(x>63) { OutSI((x-64)|0x40); OutSI(layer|0xb8); OutSD(0xff); OutSI((x-64)|0x40); OutSI((layer|0xb8)+1); OutSD(0xff); } else { OutFI(x|0x40); OutFI(layer|0xb8); OutFD(0xff); OutFI(x|0x40); OutFI((layer|0xb8)+1); OutFD(0xff); } } } /*------------------------------------------------------------------------------ -- Displaytheline display_data_graphisthedisplaygraphdata -------------------------------------------------------------------------------- -*/ void_DrawBmp_line(ucharx_add,ucharlayer,ucharwidth,uchardisplay_data_graph) { unsignedcharx; unsignedinti=0; for(x=x_add;x { if(x>127) { OutTI((x-128)|0x40); OutTI(layer|0xb8); OutTD(display_data_graph); } else
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 19264 显示 驱动程序
![提示](https://static.bdocx.com/images/bang_tan.gif)