📄 xian shi lian xi.c
字号:
#include<reg51.h>
#define uchar unsigned char
#define OSC_FREQ 12000000
#define _10ms (65536-OSC_FREQ/(12000000/9970))
uchar code tab[]={0x88,0xEB,0x4c,0x49,0x2B,0x19,0x18,0xCB,0x08,
0x09,0x0A,0x38,0x9C,0x68,0x1C,0x1E,0xFF};
uchar ucCnt_10ms;
uchar ucLed1;
uchar ucLed2;
uchar ucLed3;
uchar ucLed4;
uchar ucLed5;
uchar ucLed6;
/**************************************/
void main(void)
{
uchar j;
uchar i;
TMOD=0x01;
TH0=_10ms/256;
TL0=_10ms%256;
SCON=0x00;
TI=0;
EA=1;
ET0=1;
TR0=1;
ucCnt_10ms=0;
ucLed1=0;
ucLed2=1;
ucLed3=2;
ucLed4=3;
ucLed5=4;
ucLed6=5;
for(;;)
{
SBUF=tab[ucLed1];
while(!TI);
TI=0;
SBUF=tab[ucLed2];
while(!TI);
TI=0;
SBUF=tab[ucLed3];
while(!TI);
TI=0;
SBUF=tab[ucLed4];
while(!TI);
TI=0;
SBUF=tab[ucLed5];
while(!TI);
TI=0;
SBUF=tab[ucLed6];
while(!TI);
TI=0;
for(i=0;i<0x02;i++);
for(i=0;i<0xff;i++);
for(i=0;i<0xff;i++);
for(i=0;i<0xff;i++);
for(i=0;i<0xff;i++);
for(i=0;i<0xff;i++);
for(i=0;i<0xff;i++);
for(i=0;i<0xff;i++);
for(i=0;i<0xff;i++);
for(i=0;i<0xff;i++);
for(i=0;i<0xff;i++);
for(i=0;i<0xff;i++);
for(i=0;i<0xff;i++);
}
}
/*********************************/
void Time0(void) interrupt 1
{
TR0=0;
TH0=_10ms/256;
TL0=_10ms%256;
TR0=1;
if(ucCnt_10ms++==100)
{
ucCnt_10ms=0;
if(ucLed1++==0x10)
{
ucLed1=0;
}
if(ucLed2++==0x10)
{
ucLed2=0;
}
if(ucLed3++==0x10)
{
ucLed3=0;
}
if(ucLed4++==0x10)
{
ucLed4=0;
}
if(ucLed5++==0x10)
{
ucLed5=0;
}
if(ucLed6++==0x10)
{
ucLed6=0;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -