DSP2812直接驱动LCD12864显示.doc_第1页
DSP2812直接驱动LCD12864显示.doc_第2页
DSP2812直接驱动LCD12864显示.doc_第3页
DSP2812直接驱动LCD12864显示.doc_第4页
DSP2812直接驱动LCD12864显示.doc_第5页
已阅读5页,还剩4页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

GPIO配置#include DSP28_Device.hvoid InitGpio(void) EALLOW; GpioMuxRegs.GPAMUX.all=0x00;/设置GPIOA为普通I/O口 GpioMuxRegs.GPADIR.all=0x00FF;/设置为输出 GpioDataRegs.GPASET.bit.GPIOA3=0;/LCD是串口通信,PSB置为高电平/ GpioMuxRegs.GPBDIR.bit.GPIOB3=1;/ GpioMuxRegs.GPBDIR.bit.GPIOB3=1; EDIS;主函数#include DSP28_Device.h/*/*LCD12864程序:*/*GPIOB0-GPIOB7作为LCD12864的数据接口*/*RS-GPIOA0RW-GPIOA1EN-GPIOA2PSB-GPIOA3RST-GPIOA4*/*/#define RS_CS0 GpioDataRegs.GPACLEAR.bit.GPIOA0=1 /片选信号RS 模组片选端,高电平有效#define RS_CS1 GpioDataRegs.GPASET.bit.GPIOA0=1#define RW_SID0 GpioDataRegs.GPACLEAR.bit.GPIOA1=1 /串行数据输入端#define RW_SID1 GpioDataRegs.GPASET.bit.GPIOA1=1#define EN_CLK0 GpioDataRegs.GPACLEAR.bit.GPIOA2=1 /串行同步时钟:上升沿时读取SID数据#define EN_CLK1 GpioDataRegs.GPASET.bit.GPIOA2=1/#define PSBGpioDataRegs.GPADAT.bit.GPIOA3 /H:8位或4位并口方式;L:串口方式,在初始化中置1,设定为并口#define RST GpioDataRegs.GPADAT.bit.GPIOA4 /复位端,低电平有效#define comm 0 /指令0#define data 1 /数据1#define x1 0x80#define x2 0x88#define y 0x80#define uchar unsigned char /*宏定义*/#define uint unsigned intunsigned char table=0,1,2,3,4,5,6,7,8,9;void delayns(unsigned int ns);void delayus(unsigned int us);void WriteLcd(unsigned char st);void DataComWrite(uchar data_comm,uchar text);void ChinDisp(uchar *chin);void clcscreen();void InitLcd();void LatDisp(uchar dat1,uchar dat2);void ImgDisp(uchar *imge);void ChkBusy();void PreRead();void PrepWrite();/*- 调入了一幅图像:宽度x高度=128x32 可以使用点阵图形生成器产生数据-*/uchar tab1=0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xFF,0xFF,0xFF,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xFF,0xFF,0xFF,0x80,0x01,0xFF,0xFF,0xFF,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xFF,0xFF,0xFF,0x80,0x01,0xFF,0xFF,0xFF,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xFF,0xFF,0xFF,0x80,0x01,0xFF,0xFF,0xFF,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xFF,0xFF,0xFF,0x80,0x01,0xFF,0xFF,0xFF,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xFF,0xFF,0xFF,0x80,0x01,0xFF,0xFF,0xFF,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xFA,0xAB,0xFF,0x80,0x01,0xFF,0xFF,0xFF,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xFF,0xFE,0xFF,0x80,0x01,0xFF,0xFF,0xFF,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xEF,0xFF,0xBF,0x80,0x01,0xFF,0xFF,0xFF,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xFF,0xFF,0xEF,0x80,0x01,0xFF,0xFF,0xFF,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xBF,0xFF,0xFB,0x80,0x01,0xFF,0xFF,0xFF,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xFF,0xFF,0xFE,0x80,0x01,0xFF,0xFF,0xFF,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0xFF,0xFF,0xFF,0x80,0x01,0xFF,0xFF,0xFF,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xFF,0xFF,0xFF,0xC0,0x01,0xFF,0xFF,0xFF,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xFF,0xFF,0xFF,0xF0,0x01,0xFF,0xFF,0xFF,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xFF,0xFF,0xFF,0xFC,0x01,0xFF,0xFF,0xFF,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xFF,0xFF,0xFF,0xFF,0x01,0xFF,0xFF,0xFF,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xFF,0xFF,0xFF,0xFF,0xC1,0xFF,0xFF,0xFF,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xFF,0xFF,0xFF,0xFF,0xF1,0xFF,0xFF,0xFF,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFD,0xFF,0xFF,0xFF,0xE0,0x00,0x00,0x00,0x00,0x00,0x01,0xFD,0xFF,0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xFF,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x7F,0xFF,0xFF,0xFF,0xFF,0xBF,0xFF,0xFF,0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C,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xFF,0xFF,0xFF,0x83,0xFF,0xFF,0xFF,0xFF,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xFF,0xFF,0xFF,0x80,0xFF,0xFF,0xFF,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xFF,0xFF,0xFF,0x80,0x3F,0xFF,0xFF,0xFF,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xFF,0xFF,0xFF,0x80,0x0F,0xFF,0xFF,0xFF,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xFF,0xFF,0xFF,0x80,0x03,0xFF,0xFF,0xFF,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xFF,0xFF,0xFF,0x80,0x01,0x7F,0xFF,0xFF,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xFF,0xFF,0xFF,0x80,0x01,0xDF,0xFF,0xFD,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xFF,0xFF,0xFF,0x80,0x01,0xF7,0xFF,0xFF,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xFF,0xFF,0xFF,0x80,0x01,0xFD,0xFF,0xF7,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xFF,0xFF,0xFF,0x80,0x01,0xFF,0x7F,0xFF,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xFF,0xFF,0xFF,0x80,0x01,0xFF,0xD5,0x5F,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xFF,0xFF,0xFF,0x80,0x01,0xFF,0xFF,0xFF,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xFF,0xFF,0xFF,0x80,0x01,0xFF,0xFF,0xFF,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xFF,0xFF,0xFF,0x80,0x01,0xFF,0xFF,0xFF,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xFF,0xFF,0xFF,0x80,0x01,0xFF,0xFF,0xFF,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xFF,0xFF,0xFF,0x80,0x01,0xFF,0xFF,0xFF,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xFF,0xFF,0xFF,0x80,0x01,0xFF,0xFF,0xFF,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00;uchar tab2=尊敬的用户: 们的产品! 希望您 欢迎您使用我使用愉快! ;/*- 延时函数-*/void delayns(unsigned int tns) while(tns0) tns-; void delayus(unsigned int tus) int i,j;for(j=0;jtus;j+) for(i=0;i=0) str0=+; else str0=-; figure=-figure; if(int)figure)/10=0) str1=table(int)figure)%10; str2=.; str3=table(int)(figure*10)%10; str4=0; str5=0; else str1=table(int)figure)/10; str2=table(int)figure)%10; str3=.; str4=table(int)(figure*10)%10; str5=0; ia=0; while(stria!=0) DataComWrite(data,stria); ia+; /*-显示汉字程序-*/void ChinDisp(uchar *chn) uchar i,j; DataComWrite(comm,0x30); DataComWrite(comm,0x80); for (j=0;j4;j+) for (i=0;i16;i+) DataComWrite(data,chnj*16+i); /*-LCD清屏函数-*/void clcscreen() delayus(200); DataComWrite(comm,0x30); delayus(200); DataComWrite(comm,0x01); delayus(200); void ChkBusy() DataComWrite(data,0xFF); RS_CS0; RW_SID1; EN_CLK1; EALLOW;GpioMuxRegs.GPBDIR.bit.GPIOB7=0;/配置I/O为输入 EDIS; while(GpioDataRegs.GPBDAT.bit.GPIOB7=1); EN_CLK0;/*-LCD初始化函数-*/void InitLcd() RST=0;/低电平复位 delayus(100); RST=1; delayus(500); DataComWrite(comm,0x30);/30-基本指令动作 delayus(100); DataComWrite(comm,0x30); delayus(100); DataComWrite(comm,0x0c); /开显示,关游标 delayus(100); DataComWrite(comm,0x01); / 清屏,地址指针指向00H delayus(500); DataComWrite(comm,0x06); /光标的移动方向 delayus(500); /*-LCD显示图像函数-*/void ImgDisp(uchar *img) int i; int j; for(j=0;j32;j+) for(i=0;i8;i+) DataComWrite(comm,0x34); DataComWrite(comm,y+j); DataComWrite(comm,x1+i); DataComWrite(comm,0x30); delayns(200); DataComWrite(data,imgj*16+i*2); DataComWrite(data,imgj*16+i*2+1); for(j=32;j64;j+) for(i=0;i8;i+) DataComWrite(comm,0x34); DataComWrite(comm,y+j-32); DataComWrite(comm,x2+i); DataComWrite(comm,0x30); delayns(200); DataComWrite(data,imgj*16+i*2); DataComWrite(d

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

最新文档

评论

0/150

提交评论