| void Timer_Start() {
 // initialize Timer0         8bit timer, period = 10mS
 T0CR = 0x8C;            // timer setting
 T0DR = 0x26;            // period count
 IE2 |= 0x02;            // Enable Timer0 interrupt
 T0CR |= 0x01;           // clear counter
 T0CR=0x8C;       // 开Timer0;
 WTCR = 0x81;       // 32us watch timer --main osc 8MHz/256=31.25KHz (32us)
 WTDR  = 0xfc;      // 32*125= 4 ms 溢出,清计数器
 //WT中断计算公式:Fwck=Fx/128=32768; WT频率=Fwck/2^14=2Hz; 即每周期生产一个中断=500ms;
 // 16bit timer, period = 10.000000mS
 T1CRH = 0x00;           // timer setting High
 T1CRL = 0xA0;           // timer setting Low
 T1ADRH = 0x9C;          // period count High
 T1ADRL = 0x3F;          // period count Low
 IE2 |= 0x04;            // Enable Timer1 interrupt
 T1CRH |= 0x80;          // enable counter
 BITCR       = 0x4E;                 // BIT = 8MHz/128 = 62.5KHz (16us) 16us*128=2.048ms
 WDTDR       = 0xfa;                 // 2.048 x 250 = 512ms watchdog refresh cycle
 WDTCR       = 0xE0;                 // WDT enable and refresh
 
 }
 
 
 
 void INT_Timer0() interrupt 13
 {
 WDTCR= 0x20;        // Clear WDT Counter
 IIFLAG&=0x00;    //清定时器0的中断标志,使得为T0为没有溢出中断、没有T0中断产生。
 T0CR=0x0C;   //关闭timer0
 
 T1_50ms++;
 if(T1_50ms==80)
 {
 敲入你的代码;
 }
 
 T0DR = 0x26;  //再次装入计数值
 T0CR=0x8C;       // 开Timer0;
 
 }
 
 
 
 
 void INT_Timer1() interrupt 14
 {
 WDTCR= 0x20;        // Clear WDT Counter
 T1CRL = 0x60;           // timer setting Low   0x60->0110 0000-->011->Fx/8;  清定时器1的中断标志
 T1CRH = 0x00;           // timer setting High  关定时器T1
 T2_510ms++;
 if(T1_10ms==50)
 {
 敲入你的代码;
 }
 
 T1ADRH = 0x9C;          // period count High
 T1ADRL = 0x3F;          // period count Low
 T1CRH |= 0x80;          // 开定时器 counter1
 
 }
 
 参考这些代码,芯片是96F8208S。估计差不多。若你不放心,可以用MC9x code generator代码生成器,重新弄一下.
 
 
 
 
 
 
 |