#ifndef _INT_H_
#define _INT_H_
void int0();
void timer0();
void inition();
#endif
#define uchar unsigned char
#include<reg51.h>
#include"INT.H"
void inition()
{
TMOD=0x01;//选择定时器0并选择工作方式1
TH0=0xec;
TL0=0x78;
P1=0x00;
EA=1;
ET0=1;
TR0=1;
while(1);
{
;
}
}
void int0() interrupt 0
{
static uchar i=0;
i++;
if(i%2)
TR0=1;
else
{
TR0=0;P1=0;
}
}
void timer0() interrupt 1
{
int i=100;
char temp=0x01;
TH0=0xec;
TL0=0x78;
i--;
if(i<=0)
{
P1=temp;
temp=temp<<1;
i=100;
}
}
#include<reg51.h>
#include"INT.H"
char i=100;
char temp=0x01;
void main()
{
inition()
}