#include<reg51.h>
sbit P17=P1^7;
void Timer0Init(void) //1毫ç§@6.000MHz
{
TMOD &= 0xF0; //设置å®æ¶å¨æ¨¡å¼
TMOD |= 0x01; //设置å®æ¶å¨æ¨¡å¼
TL0 = 0x0C; //设置å®æ¶åå¼
TH0 = 0xFE; //设置å®æ¶åå¼
TF0 = 0; //æ¸
é¤TF0æ å¿
ET0=1; //å¼å®æ¶å¨0
TR0 = 1; //å®æ¶å¨0å¼å§è®¡æ¶
EA=1;//å¼æ»ä¸æ
}
void main()
{
Timer0Init();
while(1);
}
void time0() interrupt 1
{
TL0 = 0x0C; //éè£
åå¼
TH0 = 0xFE; //éè£
åå¼
P17=~P17;
}
温馨提示:内容为网友见解,仅供参考