基于单片机的12864液晶显示动画效果设计
时间:08-10
来源:互联网
点击:
该设计示效果为:12864上半屏显示静态汉字(* * *相信你会成功的!),下半屏显示动画效果(锤子砸钉子,锤子落下钉子钉入的循环效果),完整的程序源代码从这里下载 http://www.51hei.com/f/12864dh.rar ,注意这种是使用的不带字库的屏幕.电路按上面的图,程序已经测试成功。
#include reg52.h>#define uchar unsigned char#define uint unsigned intsbit lcdcs1=P3^7;sbit lcdcs2=P3^6;sbit rs=P3^5;sbit rw=P3^4;sbit lcden=P3^3;uint unm,mcu,unm1,unm2,unm3,uum;uchar code table[]={0x00,0x00,0x08,0x88,0x88,0x9E,0xE4,0x44,0x5C,0x47,0x44,0xC4,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x90,0x50,0x30,0xFF,0x28,0x48,0x88,0x88,0x00,0x00,0x00,0x00,0x00,0x80,0x40,0xF0,0x08,0x06,0x10,0x50,0x50,0xFF,0xA8,0xA8,0x88,0x80,0x00,0x00,0x00,0x20,0x20,0xA0,0xFF,0x90,0x10,0x00,0xF0,0x48,0x48,0x48,0x08,0xF8,0x00,0x00,0x00,0x00,0x00,0x3F,0x04,0x02,0x01,0x01,0x02,0x04,0x20,0x7F,0x00,0x00,0x00,0x00,0x00,0x20,0x1A,0x01,0x08,0x10,0x00,0x03,0x08,0x10,0x00,0x09,0x11,0x31,0x00,0x00,0x01,0x00,0x00,0x3F,0x00,0x01,0x01,0x01,0x01,0x7F,0x00,0x04,0x08,0x07,0x00,0x00,0x08,0x04,0x03,0x00,0x7F,0x00,0x01,0x00,0x1F,0x09,0x09,0x09,0x30,0x1F,0x00,0x00,0x80,0x40,0x20,0xF8,0x06,0x10,0x10,0x50,0x50,0x4A,0xAC,0xA8,0x08,0x08,0x08,0x00,0x00,0x80,0x40,0xF0,0x0E,0x00,0x40,0x30,0x2E,0xA0,0x10,0x50,0x30,0x00,0x00,0x00,0x00,0x80,0x40,0x20,0x50,0x4C,0x43,0x24,0x28,0x10,0x20,0x40,0xC0,0x80,0x80,0x00,0x00,0x00,0x00,0xE0,0x20,0x20,0x27,0x78,0x90,0x10,0x12,0xC4,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x1D,0x15,0x15,0x12,0x1E,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x3F,0x00,0x08,0x06,0x10,0x20,0x3F,0x00,0x02,0x04,0x0C,0x00,0x00,0x01,0x00,0x02,0x32,0x2A,0x26,0x22,0x11,0x15,0x19,0x31,0x00,0x00,0x00,0x00,0x00,0x20,0x10,0x0C,0x03,0x09,0x11,0x0F,0x10,0x09,0x06,0x09,0x10,0x20,0x40,0x78,0x00,0x00,0x00,0x20,0x20,0xF0,0x10,0x10,0x40,0x40,0xC0,0x3E,0x20,0x20,0xE0,0x00,0x00,0x00,0xC0,0x60,0x50,0x2C,0xE0,0x80,0x40,0xA0,0x38,0x26,0x10,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x02,0x02,0x02,0x21,0x11,0x09,0x04,0x03,0x10,0x20,0x10,0x0E,0x01,0x00,0x00,0x00,0x07,0x19,0x09,0x08,0x1F,0x00,0x00,0x00,0x03,0x10,0x20,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x19,0x19,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x1C,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xDC,0xC8,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xE0,0xF0,0xF0,0xF0,0xF0,0xE0,0xE0,0xF8,0xFC,0xFE,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xFE,0xFC,0xF8,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x38,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x3B,0x13,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x07,0x0F,0x0F,0x0F,0x0F,0x07,0x03,0x0F,0x1F,0x3F,0x3F,0x7F,0x7F,0x7F,0x7F,0x7F,0x3F,0x3F,0x1F,0x0F,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0xF8,0xFC,0xFE,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xFE,0xFC,0xF8,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0xF8,0xFC,0xFE,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xFE,0xFC,0xF8,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x0F,0x1F,0x3F,0x3F,0x7F,0x7F,0x7F,0x7F,0x7F,0x3F,0x3F,0x1F,0x0F,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x0F,0x1F,0x3F,0x3F,0x7F,0x7F,0x7F,0x7F,0x7F,0x3F,0x3F,0x1F,0x0F,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x18,0x18,0x1C,0x1C,0xFE,0xFE,0xFE,0xFE,0xFE,0x1C,0x1C,0x18,0x18,0x10,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,0x0F,0x3F,0xFF,0x3F,0x0F,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,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,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,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,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,0x08,0x1C,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xDC,0xC8,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xE0,0xF0,0xF0,0xF0,0xF0,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0xF8,0xFC,0xFE,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xFE,0xFC,0xF8,0xE0,0x00,0x00,0x10,0x38,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x3B,0x13,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x07,0x0F,0x0F,0x0F,0x0F,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x0F,0x1F,0x3F,0x3F,0x7F,0x7F,0x7F,0x7F,0x7F,0x3F,0x3F,0x1F,0x0F,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0xF8,0xFC,0xFE,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xFE,0xFC,0xF8,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0xF8,0xFC,0xFE,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xFE,0xFC,0xF8,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x0F,0x1F,0x3F,0x3F,0x7F,0x7F,0x7F,0x7F,0x7F,0x3F,0x3F,0x1F,0x0F,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x0F,0x1F,0x3F,0x3F,0x7F,0x7F,0x7F,0x7F,0x7F,0x3F,0x3F,0x1F,0x0F,0x03,0x00,};void delay(int z){int x,y;for(x=z;x>0;x--)for(y=0;y>0;y--);}void writen_com(uchar com){lcden=0;delay(1);rs=0;lcden=1;P0=com;delay(1);lcden=0;rs=1;}void writen_dat(uchar dat){lcden=0;delay(1);rs=1;lcden=1;P0=dat;lcden=0;delay(1);rs=0;}void init(){mcu=0;lcden=1;rw=0;writen_com(0x3f);writen_com(0xc0);writen_com(0xb8);writen_com(0x40);lcdcs1=1;lcdcs2=0;}void main(){init();for(unm1=0;unm13;unm1++){for(unm=mcu;unmmcu+128;unm++){writen_dat(table[unm]);delay(1);}lcdcs1=!lcdcs1;lcdcs2=!lcdcs2;mcu=mcu+128;uum=mcu;}while(1){ mcu=uum;lcdcs1=1;lcdcs2=0;for(unm2=0;unm21;unm2++){writen_com(0xc0);writen_com(0xbc);writen_com(0x40);for(unm=mcu;unmmcu+128;unm++){writen_dat(table[unm]);delay(1);}lcdcs1=!lcdcs1;lcdcs2=!lcdcs2;mcu=mcu+128;}for(unm2=0;unm21;unm2++){writen_com(0xc0);writen_com(0xbc);writen_com(0x40);for(unm=mcu;unmmcu+128;unm++){writen_dat(table[unm]);}lcdcs1=!lcdcs1;lcdcs2=!lcdcs2;mcu=mcu+128;}for(unm3=0;unm31;unm3++){writen_com(0xc0);writen_com(0xbe);writen_com(0x40);lcdcs1=1;lcdcs2=0;for(unm=mcu;unmmcu+128;unm++){writen_dat(table[unm]);}lcdcs1=!lcdcs1;lcdcs2=!lcdcs2;mcu=mcu+128;}for(unm3=0;unm31;unm3++){writen_com(0xc0);writen_com(0xbe);writen_com(0x40);for(unm=mcu;unmmcu+128;unm++){writen_dat(table[unm]);delay(1);}lcdcs1=!lcdcs1;lcdcs2=!lcdcs2;mcu=mcu+128;}lcdcs1=1;lcdcs2=0;delay(335556);for(unm2=0;unm21;unm2++){writen_com(0xc0);writen_com(0xbc);writen_com(0x40);for(unm=mcu;unmmcu+128;unm++){writen_dat(table[unm]);delay(1);}lcdcs1=!lcdcs1;lcdcs2=!lcdcs2;mcu=mcu+128;}for(unm2=0;unm21;unm2++){writen_com(0xc0);writen_com(0xbc);writen_com(0x40);for(unm=mcu;unmmcu+128;unm++){writen_dat(table[unm]);delay(1);}lcdcs1=!lcdcs1;lcdcs2=!lcdcs2;mcu=mcu+128;}for(unm3=0;unm31;unm3++){writen_com(0xc0);writen_com(0xbe);writen_com(0x40);lcdcs1=1;lcdcs2=0;for(unm=mcu;unmmcu+128;unm++){writen_dat(table[unm]);}lcdcs1=!lcdcs1;lcdcs2=!lcdcs2;mcu=mcu+128;}for(unm3=0;unm31;unm3++){writen_com(0xc0);writen_com(0xbe);writen_com(0x40); for(unm=mcu;unmmcu+128;unm++){writen_dat(table[unm]);delay(1);}lcdcs1=!lcdcs1;lcdcs2=!lcdcs2;mcu=mcu+128;}delay(335556);}}
- FPGA的DSP性能揭秘(06-16)
- 基于单片机通用引脚的软件UART设计(10-16)
- 分时操作系统思想在单片机中的具体应用 (10-30)
- 基于AT89C51+DSP的双CPU伺服运动控制器的研究(05-26)
- 关于RTX51 TINY的分析与探讨(05-30)
- 基于MC9S12DGl28单片机的智能寻迹车设计(04-03)