您好,欢迎访问三七文档
当前位置:首页 > 行业资料 > 酒店餐饮 > 深圳秋田微电子LCD显示器产品技术及相关程序
VersionNo.A00ReferenceProgramforLCDModulesTypeCOGRemark16x2(COG)characterdotmatrixseries,withST7032orcompatibleIC1.InterfaceXTAL1XTAL212MVDDVSSVSSVDDLEDKLEDAVDDVSSAT89S5216x2SCLSDARESP1.6P1.7P3.42.InstructionCodeRemark:Forthedetailinstructionforthecontrolfunction,pleaserefertotherelatedmanualdatabookforcontrollerIC.3.ReferenceProgram//======89S52MCU,12MOscillator===========#includereg51.h#includeintrins.h#includestdio.h#includestdlib.h#includestring.h#includemath.h#defineuintunsignedint#defineucharunsignedchar#definexcharunsignedcharcodesbitCS=P3^0;sbitSCLK=P3^1;sbitDATA=P3^2;xcharsend1[8]={0x0e,0x04,0x0e,0x15,0x15,0x0e,0x04,0x0e};xcharsend2[8]={0x11,0x11,0x11,0x1f,0x11,0x11,0x11,0x00};xcharsend3[8]={0x0a,0x0a,0x1f,0x0a,0x1f,0x0a,0x0a,0x00};uchartempdat;//---------------------------------------------voiddelayms(uintv){while(v!=0)v--;}//---------------------------------------------voiddelay(uintnn){uintmm;while(nn--0)for(mm=0;mm1000;mm++){};}//---------------------------------------------voidstart(){//I2cstartSDA=1;delayms(1);SCL=1;delayms(1);SDA=0;delayms(3);}//---------------------------------------------voidstop(){//I2cstopSCL=0;delayms(1);SDA=0;delayms(1);SCL=1;delayms(1);SDA=1;delayms(3);}//---------------------------------------------voidwcomd(ucharcdat){uinti;for(i=0;i8;i++){SCL=0;cdat=1;SDA=CY;_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();SCL=1;_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();}SCL=0;delayms(3);SDA=1;SCL=1;}//---------------------------------------------voidshow(ucharcdat1,ucharcdat2){unsignedchardatan;start();wcomd(0x7c);wcomd(0x80);wcomd(0x28);wcomd(0x80);wcomd(0x80);wcomd(0x40);for(n=0;n16;n++){wcomd(cdat1);}stop();start();wcomd(0x7c);wcomd(0x80);wcomd(0x28);wcomd(0x80);wcomd(0xc0);wcomd(0x40);for(n=0;n16;n++){wcomd(cdat2);}stop();}//---------------------------------------------voidshowicon(uchardat){unsignedchardatan;start();wcomd(0x7c);wcomd(0x80);wcomd(0x39);wcomd(0x80);wcomd(0x40);wcomd(0x40);for(n=0;n16;n++){wcomd(dat);}stop();}//---------------------------------------------voidshowcgram(uchar*send){unsignedchardatan;start();wcomd(0x7c);wcomd(0x80);wcomd(0x28);wcomd(0x80);wcomd(0x40);wcomd(0x40);for(n=0;n32;n++){wcomd(send[n]);}stop();}//---------------------------------------------voidinitial(){start();wcomd(0x7c);//SETADDRESSwcomd(0x80);//controlbytewcomd(0x38);//funtionset,is=0wcomd(0x80);//controlbytewcomd(0x06);//entrymodesetwcomd(0x80);//controlbytewcomd(0x0c);//displayonwcomd(0x80);//controlbytewcomd(0x01);//displaycleardelay(5);wcomd(0x80);//controlbytewcomd(0x39);//funtionset,is=1wcomd(0x80);//controlbytewcomd(0x14);//internaloscfrequency,1/5biaswcomd(0x80);//controlbytewcomd(0x5f);//seticonon,boosteron,contrastset:D0-D1wcomd(0x80);//controlbytewcomd(0x6b);//setfollowercircuiton,setRa/Rb:D0-D3wcomd(0x80);//controlbytewcomd(0x70);//contrastset:D0-D3wcomd(0x80);//controlbytestop();}//---------------------------------------------///////////////MAIN///////////////////////////////////////////////////////////////////////voidmain(){uchari,j;RES=0;delay(10);RES=1;delay(2);initial();i=0;j=0;while(1){//ROMshowicon(0xff);show(0x1c,0x1c);delay(70);show(0x48,0x48);delay(70);show(0x23,0x23);delay(70);//RAMshowicon(0x00);showcgram(send1);show(0x00,0x00);delay(70);showcgram(send2);show(0x00,0x00);delay(70);showcgram(send3);show(0x00,0x00);delay(70);}}
本文标题:深圳秋田微电子LCD显示器产品技术及相关程序
链接地址:https://www.777doc.com/doc-368008 .html