此程序硬件為兩片164控制行,兩片595控制列.//***************************作者:Undertaker QQ:1205946980*********************//#include#include#define uchar unsigned char#define uint unsigned intcode uchar TAB[9][32]={{0x00,0x80,0x00,0x80,0xFC,0x80,0x05,0xFE,0x85,0x04,0x4A,0x48,0x28,0x40,0x10,0x40,0x18,0x40,0x18,0x60,0x24,0xA0,0x24,0x90,0x41,0x18,0x86,0x0E,0x38,0x04,0x00,0x00},//歡{0x40,0x00,0x21,0x80,0x36,0x7C,0x24,0x44,0x04,0x44,0x04,0x44,0xE4,0x44,0x24,0x44,0x25,0x44,0x26,0x54,0x24,0x48,0x20,0x40,0x20,0x40,0x50,0x00,0x8F,0xFE,0x00,0x00}, //迎{ 0x01,0x00,0x01,0x00,0x3F,0xFC,0x01,0x00,0x09,0x30,0x05,0x20,0x03,0x40,0x7F,0xFE,0x01,0x80,0x03,0x40,0x05,0x20,0x09,0x18,0x31,0x0E,0xC1,0x04,0x01,0x00,0x01,0x00}, //來{0x00,0x04,0x7F,0x84,0x08,0x04,0x12,0x24,0x21,0x24,0x7F,0xA4,0x25,0x24,0x04,0x24,0x04,0x24,0x7F,0xA4,0x04,0x24,0x04,0x24,0x05,0x84,0x0E,0x04,0x70,0x14,0x20,0x08,}, //到{0x08,0x20,0x06,0x30,0x04,0x40,0x3F,0xF8,0x21,0x08,0x3F,0xF8,0x21,0x08,0x21,0x08,0x3F,0xF8,0x21,0x08,0x01,0x00,0xFF,0xFE,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00}, // 單{0x00,0x40,0x10,0x40,0x10,0x40,0x10,0x44,0x1F,0xFE,0x10,0x00,0x10,0x00,0x10,0x00,0x1F,0xF0,0x10,0x10,0x10,0x10,0x10,0x10,0x20,0x10,0x20,0x10,0x40,0x10,0x80,0x10}, //片{0x10,0x00,0x10,0xF8,0x10,0x88,0xFE,0x88,0x10,0x88,0x10,0x88,0x38,0x88,0x34,0x88,0x54,0x88,0x50,0x88,0x91,0x08,0x11,0x0A,0x12,0x0A,0x12,0x0A,0x14,0x06,0x10,0x00},//機{0x00,0x00,0x12,0x10,0x12,0x10,0x12,0x10,0x12,0x10,0xFF,0xFE,0x12,0x10,0x12,0x10,0x12,0x10,0x13,0xF0,0x12,0x10,0x10,0x00,0x10,0x08,0x1F,0xFC,0x00,0x00,0x00,0x00},//世{0x1F,0xF8,0x11,0x08,0x11,0x08,0x1F,0xF8,0x11,0x08,0x11,0x08,0x1F,0xF8,0x11,0x88,0x02,0x40,0x04,0x30,0x1A,0x4E,0x62,0x44,0x02,0x40,0x04,0x40,0x08,0x40,0x10,0x40,} //界};void delay(uint z){uint x,y;for(x=z;x>0;x--)for(y=125;y>0;y--);}//************************顯示程序**************************************************//sbit SCK=P3^2;sbit AB =P3^3;sbit ST =P3^5;sbit SH=P3^6;sbit DS=P3^7;uchar m=0,n;void xianshi(){uchar i;uchar j;uchar a;uchar dat;AB=0;for(j=0;j<16;j++){SCK=0;ST=0;for(a=2;a>0;){a--;dat=TAB[m][2*j+a];for(i=0;i<8;i++){SH=0;if(dat&0x01==0x01){DS=0;}else{DS=1;}SH=1;dat>>=1;}}P3|=0x24;delay(1);AB=1;}AB=1;SCK=0;SCK=1;SCK=0;}interrupt_hs() interrupt 1{TL0=(65536-50000)%256;TH0=(65536-50000)/256;n++;if(n==30){n=0;m++;if(m==9){m=0;}}}void main(){TMOD=0x01;TL0=(65536-50000)%256;TH0=(65536-50000)/256;ET0=1;EA=1;TR0=1;while(1){xianshi();}}//*此程序為16*16LED點陣交替顯示以上漢字!注重理解595 164芯片的功能及應(yīng)用及LED點陣的工作原理!此程序由Undertaker獨立編寫完成!*//
評論