IECTOOLTest1/Buzzer_Ctrl.c
// call void Buzzer_Control_msec(void) function in 1msec
call void Buzzer_Control_msec(void) function in 1msec
call void Buzzer_Control_msec ( void ) function in 1msec
void Buzzer_Control_msec(void)
{
    if(1==Buzzer_ON)
    {   
        if(Buzzer_1msec_Cnt >= Bbeep_tickPoint)
        {
            TMR2_WriteTimer(0);
            TMR2_ToggleTimer();
            Bbeep_tickPoint=Bbeep_tickPoint+Bbeep_tickPointMsec;
            TMR2_WriteTimer(0);
        }
        if(Buzzer_1msec_Cnt > Buzzer_Duration_1msec)
        {
            TMR2_WriteTimer(0);
            TMR2_StopTimer();
            Buzzer_ON=0;
            Buzzer_1msec_Cnt=0;
        }
        Buzzer_1msec_Cnt++;
    }
    else
    {
        TMR2_StopTimer();
    }        
}
void Buzzer_Control_msec ( void ) { if ( 1 == Buzzer_ON ) { if ( Buzzer_1msec_Cnt >= Bbeep_tickPoint ) { TMR2_WriteTimer ( 0 ) ; TMR2_ToggleTimer ( ) ; Bbeep_tickPoint = Bbeep_tickPoint + Bbeep_tickPointMsec ; TMR2_WriteTimer ( 0 ) ; } if ( Buzzer_1msec_Cnt > Buzzer_Duration_1msec ) { TMR2_WriteTimer ( 0 ) ; TMR2_StopTimer ( ) ; Buzzer_ON = 0 ; Buzzer_1msec_Cnt = 0 ; } Buzzer_1msec_Cnt ++ ; } else { TMR2_StopTimer ( ) ; } }
call void Buzzer_Control_msec(void) function in 1msec
call void Buzzer_Control_msec ( void ) function in 1msec
//check if Enable //toggle timer ON/OFF at beep points msec //increment for next beep //Stop at duration expire