基于單片機(jī)的12864液晶顯示動(dòng)畫效果設(shè)計(jì)
該設(shè)計(jì)示效果為:12864上半屏顯示靜態(tài)漢字(* * *相信你會(huì)成功的?。?,下半屏顯示動(dòng)畫效果(錘子砸釘子,錘子落下釘子釘入的循環(huán)效果),完整的程序源代碼從這里下載 http://www.51hei.com/f/12864dh.rar ,注意這種是使用的不帶字庫的屏幕.電路按上面的圖,程序已經(jīng)測(cè)試成功。
#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);}}
51單片機(jī)相關(guān)文章:51單片機(jī)教程
單片機(jī)相關(guān)文章:單片機(jī)教程
單片機(jī)相關(guān)文章:單片機(jī)視頻教程
單片機(jī)相關(guān)文章:單片機(jī)工作原理
評(píng)論