/* --- STC12C5Axx Series MCU T0(Falling edge) Demo -----------------*/ #include "reg51.h" sfr AUXR = 0x8e; //Auxiliary register //T0 interrupt service routine void t0int() interrupt 1 //(location at 000BH) { } void main() { AUXR = 0x80; //timer0 work in 1T mode TMOD = 0x06; //set timer0 as counter mode2 (8-bit auto-reload) TL0 = TH0 = 0xff; //fill with 0xff to count one time TR0 = 1; //timer0 start run ET0 = 1; //enable T0 interrupt EA = 1; //open global interrupt switch while (1); }