资源描述:
《12864模块ST7565R串口画点画线测试程序.pdf》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、新建文本文档(2).txt/********************************************************model:12864**Controller:ST7565R**VDD:3.3V**Logic:**seg1...seg128**com32-
2、-------
3、-**
4、
5、**com31-
6、-------
7、-**notes:page--com32~com63,com0~com31**col--sge1~seg128****************************************
8、****************************Ver:V1.0Finaldate:2016/06********************************************************************/#include#include#include"ASCII_5X8_12864.h"#defineUcharunsignedchar#defineUintunsignedint#defineDispXpixel32#defineDispYpixel1
9、6sbitCSS=P3^5;sbitRES=P3^4;sbitRSS=P3^3;sbitSCK=P1^6;//d6sbitSDA=P1^7;//d7/*-----因89C52内存较小,此处定义64个字节的缓存,-------------正常情况下应该定义为128*4个字节,才够存放整屏的数据,-----------主要是方式方法,不必纠结显示不完整。-----------*/unsignedcharDotRAM[DispYpixel/8][DispXpixel];UcharcodePageTable[]={0,1,2,3,4,5,
10、6,7};//----------------------------------------------------------voidDelay(Uinttimes)//延时{while(times--);}//----------------------------------------------------------voidM_Delay(UintNOs)//延时{while(NOs){Delay(200);NOs--;}}//---------------------------------------------
11、-------------voidWriteData(UcharWdata,bitdi)//写数据和写命令{Uchari;CSS=0;RSS=di;第1页新建文本文档(2).txtfor(i=0;i<8;i++){SDA=Wdata&0x80;SCK=0;SCK=1;Wdata<<=1;}CSS=1;}//----------------------------------------------------------voidInit_lcd(void)//初始化{RES=1;Delay(200);RES=0;Delay(200
12、);Delay(500);Delay(200);RES=1;Delay(200);WriteData(0xe2,0);//commandresetWriteData(0xC8,0);//COM63---COM0WriteData(0xa0,0);//ADCsetS0--S131WriteData(0xa2,0);//1/64duty,a2=1/9bias,a3=1/7biasWriteData(0xa6,0);//Normaldisplay(orreversedisplay)WriteData(0xa4,0);//Entiredi
13、splaydisableWriteData(0x2c,0);WriteData(0x2e,0);WriteData(0x2f,0);//voltagefollowON,regulatorON,boosterONDelay(100);WriteData(0x25,0);//V0voltageregulatorinternalresistorsetWriteData(0x81,0);//SetEVWriteData(0x21,0);//EVelectronicvolumesetWriteData(0x60,0);//Startline
14、addressWriteData(0xaf,0);//displayon}//----------------------------------------------------------voidClearALL()//清屏{Ucharx,y