void Timer2_ISP(void) interrupt 5
{
EA = 0;
TF2 = 0;
EA = 1;
}
void init_sys(void)
{
IEN0=0x20;//0X0A;//0x0a; //中断允许位
IEN1=0x00;
TCON = 0X50;//0x50;
ADCON=0x0e; //adc mode init
ADT=0x2f; //adc 采样速率
ADCH=0xE0; //adc 采样通道P4.0-P4.1-P4.2
RSTSTAT=0x03;
T2CON = 0x04;//T2设置为定时模式
T2MOD = 0x00;//T2仅为递增计数器
RCAP2L = 0x3E;
RCAP2H = 0xFE;
TL2 = RCAP2L;
TH2 = RCAP2H; //设为定时器2中断周期:125us 65536-65036/4M
IEN0 = 0x20; //T2 ENABLE
EA = 0x01;
} |