|
define.h
#include
#define uchar unsigned char
#define uint unsigned int
sbit led1=P1^0;
uchar num;
main.c
#include
void main(void)
{
TMOD=0x01;
TH0=(65536-45872)/256;
TH0=(65536-45872)%256;
EA=1;
ET0=1;
TR0=1;
while(1);
}
T0.C
#include
void T0_time() interrupt 1
{
TH0=(65536-45872)/256;
TH0=(65536-45872)%256;
num++;
if(num==20)
{
num=0;
led1=~led1;
}
}
|
|