|
#include "reg52.h"
unsigned char mdsip;
unsigned char dsip;
void ds1() interrupt 0
{
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
mdsip++;
if(mdsip==20)
{
mdsip=0;
dsip++;
if(dsip==100)dsip=0;
}
}
void smg(unsigned char i)
{
unsigned char code led[]={0xC0,0xF9,
0xA4,0xB0,0x99,0x92,0x82,0xF8,0x80,0x90,};
P0=led[i/10];
P1=led[i%10];
}
void main()
{
TMOD=0x10;
TH0=(65536-60000)/256;
TL0=(65536-60000)%256;
TR1=1;
IE=0x88;
while(1)
{
smg(dsip);
if(dsip==100)
dsip=0;
}
}
|
-
3.bmp
(378.78 KB, 下载次数: 1)
|