⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 00.c

📁 点阵LED显示技术
💻 C
字号:
#include <reg51.h>
unsigned char code tab[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f}; 
unsigned char code digittab[10][8]={{0x00,0x00,0x3e,0x41,0x41,0x41,0x3e,0x00},     //0 
                                    {0xff,0xff,0xff,0x00,0x21,0x7f,0x01,0x00},     //1 
                                    {0x00,0x00,0x27,0x45,0x45,0x45,0x39,0x00},    //2 
                                    {0x00,0x00,0x22,0x49,0x49,0x49,0x36,0x00},    //3 
                                    {0x00,0x00,0x0c,0x14,0x24,0x7f,0x04,0x00},     //4 
                                    {0x00,0x00,0x72,0x51,0x51,0x51,0x4e,0x00},    //5 
                                    {0x00,0x00,0x3e,0x49,0x49,0x49,0x26,0x00},    //6 
                                    {0x00,0x00,0x40,0x40,0x40,0x4f,0x70,0x00},     //7 
                                    {0x00,0x00,0x36,0x49,0x49,0x49,0x36,0x00},    //8 
                                    {0x00,0x00,0x32,0x49,0x49,0x49,0x3e,0x00}     //9 
                                    }; 

unsigned int timecount; 
unsigned char cnta; 
unsigned char cntb; 
void main(void) 
{ 
  TMOD=0x01; 
  TH0=(65536-3000)/256; 
  TL0=(65536-3000)%6; 
  TR0=1; 
  ET0=1; 
  EA=1; 
  while(1) 
    {; 
    } 
} 
void t0(void) interrupt 1 using 0 
{ 
  TH0=(65536-3000)/256; 
  TL0=(65536-3000)%6; 
  P3=tab[cnta]; 
  P1=digittab[cntb][cnta]; 
  cnta++; 
  if(cnta==8) 
    { 
      cnta=0; 
    } 
  timecount++; 
  if(timecount==333) 
    { 
      timecount=0; 
      cntb++; 
      if(cntb==10) 
        { 
          cntb=0; 
        } 
    } 
}

/*#include<reg51.h>
#define uchar unsigned char
uchar aa[]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};
uchar bb[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};
void delay(uchar yshi)
{
uchar i;
for(i=0;i<252;i++)
for(;yshi>0;yshi--)
;
}

main()
{
uchar i,j;
while(1)
{
for(i=0;i<8;i++)
for(j=0;j<100;j++)
{P1=aa[i];
P3=bb[i];
delay(252);
}

}
}
/*unsigned char code digittab[8]={0x00,0x00,0x3e,0x41,0x41,0x41,0x3e,0x00};
main()
{
unsigned char i,j,k;
while(1)
{
for(i=0;i<8;i++)
for(j=0;j<200;j++)
{
P1=digittab[i];
P3=tab[i];
for(k=0;k<5;k++);

}
}
}
*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -