您好,欢迎光临本网站![请登录][注册会员]  
文件名称: proteus 中液晶模块
  所属分类: C
  开发工具:
  文件大小: 118kb
  下载次数: 0
  上传时间: 2011-02-23
  提 供 者: wangwei_*********
 详细说明: 12864 C程序设计 #include __CONFIG(0x1832); //芯片配置字,看门狗关,上电延时开,掉电检测关,低压编程关,加密,4M晶体HS振荡 #define rs RA5 //命令/数据选择 #define rw RA4 //读/写选择 #define e RA3 //使能 #define psb RA2 //8位/4位并口选择 #define rst RA0 //复位 #define nop() asm("nop") const unsigned char TAB1[ ]={ //定义显示图片的数据表 0X1F,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XC0,0X00,0X00, 0X18,0XFC,0XB7,0X80,0X00,0X00,0X00,0X00,0X00,0X00,0X03,0XFF,0XFF,0XE0,0X00,0X00, 0X1E,0X7F,0X0C,0X00,0X00,0X07,0XFF,0XFF,0X80,0X00,0X0F,0XF8,0X7F,0XE0,0X03,0XC0, 0X1F,0XE7,0X80,0X00,0X00,0X7F,0XFF,0XFF,0XC0,0X00,0X7F,0XE1,0XFF,0XE0,0X0C,0X60, 0X1F,0X9B,0XE0,0X00,0X01,0XFF,0XFF,0XFF,0XF0,0X01,0X80,0X07,0XFF,0XE0,0X0C,0X60, 0X1F,0XCF,0XE0,0X00,0X1F,0XFF,0XFF,0XFF,0XF8,0X01,0X00,0X1F,0XFF,0XE0,0X0C,0X60, 0X13,0XE4,0XF0,0X00,0X7F,0XFF,0XFF,0XFF,0XFE,0X00,0X00,0XFF,0X0E,0X20,0X0C,0X60, 0X10,0XF0,0XF0,0X00,0XFF,0XFE,0XFF,0XFF,0XFF,0X00,0X00,0XF8,0X0E,0X20,0X0C,0X60, 0X1C,0X7C,0X38,0X01,0XEF,0XF4,0X0F,0XFF,0XFF,0X80,0X00,0X00,0X7F,0XE0,0X0C,0X60, 0X1F,0X1E,0X08,0X03,0X9F,0XC0,0X00,0XFE,0XFF,0XC0,0X00,0X07,0XFF,0XE0,0X0D,0X60, 0X1F,0X03,0X80,0X07,0X27,0X80,0X00,0X3F,0X3F,0XE0,0X00,0X7F,0XFF,0XE0,0X0D,0XE0, 0X1E,0XE0,0XC0,0X06,0X4F,0X00,0X00,0X3F,0XBF,0XF0,0X00,0XFE,0X1C,0X20,0X07,0XC0, 0X1F,0XF0,0X20,0X0E,0X4E,0X00,0X00,0X1F,0XCF,0XF8,0X00,0X00,0X7F,0XA0,0X00,0XC0, 0X1F,0XFE,0X00,0X0C,0X9C,0X00,0X00,0X0F,0XFF,0XF8,0X00,0X00,0X7F,0XE0,0X00,0XE0, 0X1F,0XFF,0X80,0X1D,0XF8,0X00,0X00,0X0F,0XF3,0XFC,0X00,0X3F,0X8E,0XE0,0X00,0X00, 0X1E,0X03,0X00,0X1F,0X78,0X00,0X00,0X07,0XC7,0XFC,0X00,0X0F,0X7F,0XA0,0X00,0X00, 0X1F,0X80,0X00,0X1B,0XF0,0X00,0X00,0X09,0XCF,0XFC,0X00,0X00,0X0F,0XE0,0X0F,0X00, 0X1F,0XFE,0X00,0X19,0XF0,0X00,0X00,0X07,0XC9,0XFE,0X00,0X07,0X1F,0XE0,0X06,0X00, 0X1F,0XFF,0XC0,0X0F,0XE0,0X00,0X00,0X03,0XC1,0XFE,0X00,0XFF,0XFF,0XE0,0X06,0X00, 0X1F,0XC0,0X40,0X0F,0XC0,0X00,0X00,0X03,0XE7,0XFE,0X00,0X9F,0XFF,0X20,0X06,0X00, 0X1F,0X00,0X00,0X0F,0XC0,0X00,0X00,0X07,0XE7,0XFC,0X00,0X0B,0XCF,0X20,0X06,0X00, 0X1F,0X78,0X00,0X0F,0XC0,0X00,0X00,0X07,0XE7,0XFC,0X00,0X00,0X0F,0XE0,0X06,0X00, 0X1F,0XFF,0X80,0X07,0XF0,0X00,0X00,0X03,0XEF,0XFC,0X00,0X00,0X3F,0XE0,0X06,0X00, 0X13,0XFF,0XE0,0X07,0XFE,0X01,0XE0,0X01,0XCF,0XFC,0X00,0X00,0X3F,0XE0,0X06,0X60, 0X1F,0XFC,0X00,0X07,0XE3,0X03,0XF8,0X06,0XDF,0XFC,0X00,0X1F,0XFE,0X60,0X06,0X60, 0X1F,0X80,0X00,0X03,0X80,0X80,0XC0,0X01,0XFF,0XF8,0X00,0X0F,0X3F,0XE0,0X0F,0XE0, 0X1C,0X00,0X00,0X01,0X80,0X41,0XC0,0X06,0XFF,0XF8,0X00,0X00,0XF3,0XE0,0X00,0X00, 0X13,0XFC,0X00,0X03,0XFC,0X41,0XFC,0X03,0X7F,0XF0,0X00,0X00,0X0F,0XE0,0X00,0X00, 0X1F,0XFF,0X00,0X03,0XFE,0X40,0XFF,0X00,0XFF,0XF0,0X00,0X07,0XFF,0XE0,0X07,0XC0, 0X1F,0XC0,0X00,0X02,0XF0,0X40,0XE1,0X00,0X78,0XF0,0X00,0X3C,0XFC,0X20,0X0C,0X60, 0X1E,0X00,0X00,0X02,0XC0,0XC0,0X60,0X00,0XF3,0X70,0X00,0X03,0XFF,0XE0,0X00,0X60, 0X10,0X00,0X00,0X02,0X00,0X80,0X60,0X00,0X67,0X30,0X00,0X00,0X7F,0XE0,0X00,0XC0, 0X17,0XFF,0X00,0X03,0X01,0X80,0X30,0X00,0XFC,0XB0,0X00,0X3F,0XCF,0XE0,0X01,0X80, 0X1F,0XFA,0X00,0X03,0X03,0X80,0X18,0X01,0XFC,0X70,0X00,0X3C,0X8F,0XE0,0X03,0X00, 0X1F,0XB0,0X00,0X03,0X0F,0X00,0X0C,0X02,0XFE,0X30,0X00,0X0D,0X3F,0X60,0X06,0X00, 0X1F,0X00,0X00,0X03,0X0F,0X00,0X04,0X05,0XEE,0X30,0X00,0X03,0XDF,0X20,0X0C,0X00, 0X1C,0X00,0X00,0X02,0X01,0X06,0X00,0X07,0XE3,0X30,0X01,0X00,0XDF,0XE0,0X0C,0X60, 0X10,0X1E,0X00,0X03,0X03,0X03,0X80,0X07,0XF1,0X30,0X00,0XE0,0X33,0XE0,0X0F,0XE0, 0X1F,0XEC,0X00,0X02,0X03,0X01,0XE0,0X09,0XF0,0X60,0X00,0X3C,0X8E,0X60,0X00,0X00, 0X1F,0X30,0X00,0X03,0X03,0X9D,0X30,0X13,0XFC,0X60,0X00,0X1F,0X3F,0XA0,0X00,0X00, 0X1F,0XC1,0X8C,0X02,0X81,0XF3,0X10,0X0F,0XF0,0XC0,0X03,0X87,0XC7,0XE0,0X03,0X80, 0X1A,0X06,0X30,0X03,0X03,0X80,0X08,0X13,0XE0,0XC0,0X00,0XE3,0XF1,0XE0,0X06,0XC0, 0X1C,0X1C,0X40,0X01,0X82,0X00,0X04,0X0F,0XE1,0X80,0X00,0X78,0XFE,0X60,0X0C,0X60, 0X13,0XF8,0X80,0X01,0X46,0X00,0X00,0X07,0XE3,0X00,0X00,0X3E,0X7F,0XE0,0X0C,0X60, 0X1F,0X63,0X00,0X01,0X8C,0X00,0X00,0X07,0XFE,0X00,0X00,0X0F,0X9F,0XE0,0X0D,0X60, 0X1F,0X8E,0X04,0X01,0X47,0XEE,0X00,0X07,0XFE,0X00,0X00,0X87,0XEF,0XE0,0X0D,0X60, 0X1E,0X3C,0X1C,0X00,0XA7,0XFF,0X8C,0X03,0XF8,0X00,0X00,0XC1,0XFF,0XE0,0X0C,0X60, 0X1F,0X78,0X38,0X00,0XC3,0X93,0X8E,0X07,0XF0,0X00,0X00,0X78,0X7F,0XE0,0X0C,0X60, 0X1F,0XF1,0X60,0X00,0XE3,0X80,0X06,0X07,0XF0,0X00,0X00,0X3A,0X1F,0XE0,0X06,0XC0, 0X1F,0XE1,0X40,0X00,0X13,0XC8,0X00,0X0B,0XF0,0X00,0X00,0X1E,0X13,0XE0,0X03,0X80, 0X17,0X8F,0X84,0X00,0X61,0XF8,0X00,0X17,0XF0,0X00,0X00,0X0F,0XB0,0XE0,0X00,0X00, 0X1F,0X1E,0X29,0X80,0X33,0X00,0X00,0X0F,0XFC,0X00,0X00,0X43,0XFD,0X60,0X00,0X00, 0X1E,0X7C,0X73,0X00,0X3A,0X10,0X00,0X0F,0XF4,0X00,0X00,0X21,0XFF,0XA0,0X03,0X80, 0X15,0XF8,0XE3,0X00,0X1E,0X18,0X00,0X1F,0XF6,0X00,0X00,0X18,0XFF,0XE0,0X06,0XC0, 0X1B,0XE1,0X86,0X00,0X1E,0X00,0X00,0X3F,0XE6,0X00,0X03,0X0E,0X7F,0XE0,0X0C,0X60, 0X1F,0XC7,0X8C,0X00,0X1E,0X00,0X00,0X7F,0XE7,0X00,0X03,0X85,0X1B,0XE0,0X0C,0X60, 0X1F,0X0F,0X39,0X20,0X07,0X00,0X01,0XFF,0XCF,0X00,0X01,0XC3,0XCD,0XE0,0X0D,0X60, 0X1E,0X3E,0X73,0X40,0X03,0X80,0X0F,0XFF,0X9F,0X80,0X00,0XF1,0XF0,0X60,0X0D,0X60, 0X18,0X7C,0XF6,0X20,0X01,0XE0,0X3F,0XFE,0X3F,0XE0,0X00,0X78,0XFE,0X60,0X0C,0X60, 0X11,0XFB,0XE6,0X40,0X01,0XFF,0XFF,0XFC,0X7F,0XFC,0X08,0X3C,0X7F,0XE0,0X0C,0X60, 0X1F,0XF7,0XFE,0X40,0X02,0XFF,0XFF,0XF9,0XFF,0XFF,0X00,0X0F,0X3F,0XE0,0X06,0XC0, 0X1F,0XFF,0XFC,0X88,0X06,0XFF,0XFD,0XF3,0XFF,0XFF,0XC1,0X8F,0X9F,0XE0,0X03,0X80, 0X1F,0XFF,0XB9,0X38,0X0E,0XFE,0X71,0XE7,0XFF,0XFF,0XE8,0XC3,0XEF,0XE0,0X00,0X00, 0X0F,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XC0,0X00,0X00, }; unsigned int lcd_x; //X地址 unsigned int lcd_y; //Y地址 bit busy; //忙标志位 void init(); //系统初始函数 void lcd_init(); //LCD初始函数 void clear_p(); //清屏函数 void han_wr2a(); //写函数 void wr_zb(); //写准备函数 void qushu(); //查表函数 void send_d(unsigned char x); //写一字节数据函数 void send_i(unsigned char x); //写一字节命令函数 void chk_busy(); //查LCD忙函数 void delay(); //------------------------------------------- void main() { init(); //系统初始化 lcd_init(); //LCD初始化 clear_p(); //清除显示 han_wr2a(); //写数据到LCD显示 while(1); //停机 } //------------------------------------------- void init() { TRISA=0X00; //设置A口为输出 TRISD=0X00; //设置D口为输出 ADCON1=0X06; //设置A口为普通IO口 } //------------------------------------------- void lcd_init() { rst=0; //复位LCD delay(); rst=1; //LCD正常工作 nop(); psb=1; //8位并行通信 send_i(0x30); //基本操作指令 send_i(0x01); //关显示 send_i(0x06); //指定在写入或读取时,光标的移动方向 send_i(0x0c); //开显示,关光标,不闪烁 } //------------------------------------------- void han_wr2a() { qushu(); //查表取数送显示 } //------------------------------------------- void wr_zb() { send_i(0x34); //扩展操作指令 send_i(lcd_y); //设置Y地址 send_i(lcd_x); //设置X地址 send_i(0x30); //基本操作指令 } //------------------------------------------- void clear_p() { send_i(0x1); //清除显示 send_i(0x34); //扩展操作指令 send_i(0x30); //基本操作指令 } //------------------------------------------ void qushu() { int i,j,k,temp,temp1; //定义临时变量 temp=0; //查表偏移地址 lcd_x=0x80; //上半屏X地址80H for(i=2;i>0;i--) //共两屏 { lcd_y=0x80; //每一行的Y地址80H(即顶格显示) for(j=0x20;j>0;j--) //每半屏共20H行 { wr_zb(); //写准备(设置X地址和Y地址) for(k=0x10;k>0;k--) //每一行16字节(因为顶格写) { temp1=TAB1[temp]; //查表获取显示数字 send_d(temp1); //送LCD显示 temp++; //查表偏移地址+1 } lcd_y++; //送下一行数据 send_i(0x36); //扩展指令操作:图形显示开 send_i(0x30); //基本指令操作 } // send_i(0x36); // send_i(0x30); lcd_x=0X88; //下半屏X地址 } } //------------------------------------------- void send_d(unsigned char x) { chk_busy(); //判断LCD是否忙 rs=1; //总线上是数据 rw=0; //写操作 PORTD=x; //数据送总线 e=1; //使能 nop(); nop(); nop(); e=0; } //-------------------------------------------- void send_i(unsigned char x) { chk_busy(); //判断忙信号 rs=0; //总线上是命令 rw=0; //写操作 PORTD=x; //数据送总线 e=1; //使能 nop(); nop(); nop(); e=0; } //------------------------------------------- void chk_busy() { busy=1; //先置忙信号 TRISD=0XFF; //更改总线方向为输入 rs=0; //总线上为命令 rw=1; //读操作 while(busy) { nop(); nop(); nop(); e=1; nop(); nop(); nop(); if(!RD7) busy=0; //RD7为0表示LCD空闲 nop(); nop(); nop(); e=0; } e=0; TRISD=0X00; //总线还原为输出 } //------------------------------------------- void delay() { int i; for(i=0;i<5000;i++) {;} } ...展开收缩
(系统自动生成,下载前可以参看下载内容)

下载文件列表

相关说明

  • 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
  • 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度
  • 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
  • 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
  • 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
  • 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.
 相关搜索: LCD12864
 输入关键字,在本站1000多万海量源码库中尽情搜索: