|
你的程序有点乱 给你个参考
#include
#define uchar unsigned char
#define uint unsigned int
unsigned char buf[8]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};
uchar temp;
uchar tt;
void main()
{
TMOD=0X01;
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
EA=1;
ET0=1;
TR0=1;
while(1)
{
P0=buf[tt];
}
}
void timer0() interrupt 1
{
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
tt++;
if(tt==8) tt=0;
}
|
|