此方式可以降低电源负载
if(FLAG_SCR_ON) //工作标志位 { if(FLAG_OPEN_SCR) { SCR_IO=1; OPEN_SCR_DELAY++; if(OPEN_SCR_DELAY>=12) //开1.5MS { OPEN_SCR_DELAY=0; SCR_IO=0; FLAG_OPEN_SCR=0; } } else { SCR_IO=0; OPEN_SCR_DELAY=0; } /**********************读过零信号******************************/ if(!FLAG_GET_ONCE_ZERO) { FLAG_GET_ONCE_ZERO=1; FLAG_NOW_ZERO_STATE=ZERO_IO; } if(FLAG_GET_ONCE_ZERO) { if(FLAG_NOW_ZERO_STATE!=ZERO_IO) //过零来了 { FLAG_GET_ONCE_ZERO=0; FLAG_ZERO_COME=1; // OPEN_SCR_ZERO_DELAY=0; } } /**********************读过零信号******************************/ if(FLAG_ZERO_COME) { FLAG_ZERO_COME=0; OPEN_SCR_ZERO_DELAY=0; USER_SET_HEAT_TIME1=USER_SET_HEAT_TIME; if(USER_SET_HEAT_TIME1<=2) USER_SET_HEAT_TIME1=2; if(USER_SET_HEAT_TIME1>=10) USER_SET_HEAT_TIME1=10; if(USER_SET_HEAT_TIME1==10) { FLAG_OPEN_SCR1=1; } else { OPEN_2CI_COUNT++; if(OPEN_2CI_COUNT<=USER_SET_HEAT_TIME1) { FLAG_OPEN_SCR1=1; } if(OPEN_2CI_COUNT==1) { REC_TIME=0; } else { REC_TIME=2; } if(OPEN_2CI_COUNT>=10) OPEN_2CI_COUNT=0; //最大开10个周期 } } if(FLAG_OPEN_SCR1) { if(ZERO_IO) { OPEN_SCR_ZERO_DELAY++; if(OPEN_SCR_ZERO_DELAY>=78-REC_TIME) //78 { OPEN_SCR_ZERO_DELAY=0; FLAG_OPEN_SCR=1; FLAG_OPEN_SCR1=0; } } else { OPEN_SCR_ZERO_DELAY++; if(OPEN_SCR_ZERO_DELAY>=78-REC_TIME) { OPEN_SCR_ZERO_DELAY=0; FLAG_OPEN_SCR=1; FLAG_OPEN_SCR1=0; } } } } else { FLAG_OPEN_SCR=0; FLAG_OPEN_SCR1=0; OPEN_SCR_ZERO_DELAY=0; FLAG_GET_ONCE_ZERO=0; FLAG_NOW_ZERO_STATE=0; FLAG_ZERO_COME=0; OPEN_2CI_COUNT=0; OPEN_SCR_DELAY=0; SCR_IO=0; }