用74ls154和74hc595完成
Proteus仿真:
80290427916x64LeD-in-51.rar
(85.59 KB, 下载次数: 144)
程序如下
- #include <reg52.h>
- #define uchar unsigned char
- #define uint unsigned int
- sbit P1_0=P1^0;
- sbit P1_1=P1^1;
- sbit P1_2=P1^2;
- sbit P1_3=P1^3;
- sbit P3_0=P3^0;
- uchar idata pragm[4*32]={0};
- uchar pos=0;
- uchar code zi[12][32]={
- {0x01,0x00,0x41,0x00,0x23,0xF8,0x22,0x08,
- 0x85,0x10,0x50,0xA0,0x50,0x40,0x10,0xB0,
- 0x23,0x0E,0x2E,0x04,0xE3,0xF8,0x22,0x08,
- 0x22,0x08,0x22,0x08,0x23,0xF8,0x22,0x08},/*"洛",0*/
- {0x10,0x00,0x10,0xFC,0x20,0x84,0x3E,0x84,
- 0x40,0x84,0x7C,0xFC,0x90,0x84,0x10,0x84,
- 0xFE,0x84,0x10,0xFC,0x10,0x84,0x12,0x84,
- 0x14,0x84,0x18,0xFC,0x10,0x84,0x00,0x00},/*"钼",4*/
- {0x08,0x80,0x08,0x40,0x1F,0xF8,0x30,0x80,
- 0x5F,0xF8,0x10,0x80,0x1F,0xF8,0x10,0x80,
- 0x1F,0xFC,0x01,0x00,0x7F,0xFE,0x03,0x40,
- 0x05,0x20,0x19,0x1C,0x61,0x08,0x01,0x00},/*"集",6*/
- {0x00,0x00,0x7F,0xFC,0x40,0x84,0x40,0x84,
- 0x5F,0xF4,0x41,0x84,0x41,0x84,0x42,0x84,
- 0x44,0x84,0x48,0x84,0x50,0x84,0x60,0x84,
- 0x42,0x84,0x41,0x04,0x7F,0xFC,0x40,0x04},/*"团",7*/
- {0x01,0x00,0x01,0x00,0x02,0x80,0x04,0x40,
- 0x08,0x30,0x30,0x0E,0xCF,0xF4,0x01,0x00,
- 0x01,0x00,0x3F,0xF8,0x01,0x00,0x09,0x20,
- 0x05,0x20,0x05,0x40,0xFF,0xFE,0x00,0x00},/*"金",8*/
- {0x3F,0xFC,0x20,0x04,0x3F,0xFC,0x20,0x00,
- 0x2F,0xF8,0x20,0x80,0x27,0xF8,0x24,0x88,
- 0x27,0xF8,0x20,0x80,0x2F,0xFC,0x28,0xA4,
- 0x48,0xF4,0x4B,0x14,0x88,0x04,0x08,0x0C},/*"属",9*/
- {0x00,0x00,0x10,0x10,0x10,0x10,0x10,0x10,
- 0xFD,0xFE,0x10,0x10,0x38,0x30,0x34,0x30,
- 0x34,0x50,0x50,0x50,0x50,0x90,0x91,0x10,
- 0x12,0x10,0x10,0x10,0x10,0x50,0x10,0x20},/*"材",10*/
- {0x08,0x08,0x08,0x88,0x4A,0x48,0x2C,0x48,
- 0x18,0x08,0xFF,0x08,0x1C,0x88,0x2A,0x48,
- 0x2A,0x4E,0x49,0xF8,0x48,0x08,0x88,0x08,
- 0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08},/*"料",11*/
- {0x01,0x00,0x01,0x00,0x7F,0xFE,0x02,0x00,
- 0x04,0x00,0x0F,0xF0,0x18,0x10,0x28,0x10,
- 0x4F,0xF0,0x88,0x10,0x08,0x10,0x0F,0xF0,
- 0x08,0x10,0x08,0x90,0x08,0x70,0x08,0x20},/*"有",12*/
- {0x00,0x00,0xFB,0xF8,0x92,0x08,0x93,0xF8,
- 0xA2,0x08,0xA2,0x08,0x93,0xF8,0x8A,0x80,
- 0x8A,0x48,0xAA,0x50,0x92,0x20,0x82,0x20,
- 0x82,0x10,0x82,0x8E,0x83,0x04,0x82,0x00},/*"限",13*/
- {0x00,0x00,0x04,0x40,0x06,0x40,0x04,0x40,
- 0x08,0x20,0x08,0x10,0x10,0x18,0x22,0x0E,
- 0x43,0x04,0x02,0x00,0x04,0x20,0x08,0x10,
- 0x11,0xF8,0x3F,0x18,0x10,0x10,0x00,0x00},/*"公",14*/
- {0x00,0x00,0x3F,0xFC,0x00,0x04,0x00,0x04,
- 0x7F,0xE4,0x00,0x04,0x00,0x04,0x3F,0xC4,
- 0x20,0x44,0x20,0x44,0x3F,0xC4,0x20,0x44,
- 0x20,0x04,0x00,0x14,0x00,0x08,0x00,0x00},/*"司",15*/
- };
- unsigned long int T500ms=0;
- uchar T500ms_flag=0,k=0;
- void delay(int z);
- void main()
- {
- uchar l,n,k,m,q;
- SCON=0x00;
- TMOD=0x01;
- TR0=1;
- IE=0x82;
- P2=0x3f;
- while(1)
- {
- for(l=0;l<12;l++)
- {
- for(n=0;n<2;n++)
- {
- for(k=0;k<8;k++)
- {
- for(m=0;m<16;m++)
- {
- for(q=0;q<4;q++)
- {
- pragm[m*2+q*32]=pragm[m*2+q*32]<<1|pragm[m*2+1+q*32]>>7;
- if(q==3) pragm[m*2+1+q*32]=pragm[m*2+q*32+1]<<1|zi[l][m*2+n]>>(7-k);
- else
- pragm[m*2+1+q*32]=pragm[m*2+1+q*32]<<1|pragm[m*2+(q+1)*32]>>7;
- }
- delay(80);
- }
- delay(2000);
- }
- }
- }
- }
- }
- void delay(int z)
- {
- int i,j;
- for(i=z;i>0;i--)
- for(j=4;j>0;j--);
- }
- void leddisplay(void)interrupt 1
- {
- register unsigned char m,n=8;
- TH0=0xfc;
- TL0=0x18;
- m=P2;
- m=++m&0x0f;
- do
- {
- n--;
- SBUF=pragm[m*2+(n/2)*30+n];
- while(!TI);
- TI=0;
- }while(n);
- P1_3=1;
- P2&=0xf0;
- P1_0=0;
- P2|=m;
- P1_0=1;
- delay(1);
- P1_0=0;
- P1_3=0;
- }
复制代码
|