|
#include "absacc.h"
#include"reg51.h"
#define PA55 0x8000
#define PB55 0x8001
#define PC55 0x8002
#define CTL55 0x8003
unsigned char count;
unsigned char disp_data[4];
unsigned char code led_data[]={0x0c0,0x0f9,0xa4,0xb0,0x99,0x92,0x82,0x0f8,0x80,0x90};
void time0_int() interrupt 1
{ TH0=0x4c;
TL0=0x00;
count++;
if(count==20)
{
count=0;
disp_data[0]++;
if(disp_data[0]>9)
{
disp_data[0]=0;
disp_data[1]++;
if(disp_data[1]>5)
{
disp_data[1]=0;
disp_data[2]++;
if(disp_data[2]>9)
{
disp_data[2]=0;
disp_data[3]++;
if(disp_data[3]>5)
disp_data[3]=0;
}
}
}
}
}
void delay(void)
{
unsigned char i;
for(i=0;i<20;i++);
}
void disp(void)
{
unsigned char j,k;
j=0x01;
for(k=0;k<4;k++)
{
XBYTE[PA55]=led_data[disp_data[k]];
XBYTE[PB55]=~j;
delay();
XBYTE[PB55]=0xff;
j=j<<1;
}
}
main()
{
unsigned char i;
count=0;
for(i=0;i<4;i++)
disp_data[4]=0x00;
XBYTE[CTL55]=0x80;
XBYTE[PB55]=0xff;
TMOD=0x01;
TL0=0x00;
TH0=0x4c;
TR0=1;
ET0=1;
EA=1;
while(1)
{
disp();
delay();
}
}
|
-
test6.1.JPEG
(88.94 KB, 下载次数: 42)
编译后显示“source code build fullLED 1 error ”
-
无标题.png
(246.34 KB, 下载次数: 47)
|