|
#include "reg51.h"
#define TIMS 3036
sfr AUXR =0x8E; //
sfr IE2 =0xAF; //??IE2??????0xAF
sfr TH2 =0xD6; //??TH2??????0xD6
sfr TL2 =0xD7; //??TL2??????0xD7
sfr CLK_DIV=0x97; //??CLK_DIV??????0x97
void timer_2() interrupt 12 //?????/???2??????
{
P16=!P16; //P4.6????
P17=!P17; //P4.7????
}
main()
{
P1M0=0;
P1M0=0;
CLK_DIV=0x03; //???8??
TL2=TIMS; //TIMS?8????TL2???
TH2=TIMS>>8; //TIMS?8????TH2???
AUXR|=0x10; //?????/???2,
P16=0; //P4.6???0,
P17=0; //P4.7???0
IE2|=0x04; //?????2??
EA=1; //CPU
while(1);
}
|
|