This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

several interrupts

hi,

my code is too long so i put snapshot of my code

#include<..........>
.
.
.
.
.
main()
{
......
}

void down(void)//down
{

                        ES=0; //disable serial ISR
                        timer_flag=0;
                        ph_sensor_error();
                        motor_direction=ANTI_CLOCK_WISE;
                        while(ph_sensor_down==OFF && timer_flag==0)
                                motor_power=ON;
                        motor_power=OFF;
                        timer_flag=0;
                        ES=1; //enable serial ISR

}

void ph_sensor_error(void)
{
        TR0 = 1;                      /* Start Timer 1 Running */
}

/*** timer0 interrupt service routine ***/
void timer0_ISR (void) interrupt 1
{
        TR0 = 0;
        TF0 = 0;
        TH0 = 0x00;
        TL0 = 0x00;
        counter++;   // Increment the overflow count
        if(counter>=10)//0.71s
                {
                        TR0 = 0;
                        TF0=0;
                        counter=0;
                        timer_flag=1;
                }
        else
                TR0 = 1;

}

/*** serial interrupt ***/
void serial_ISR (void) interrupt 4
{
        unsigned char moh=0;
        if (RI == 1)
    {
        RI = 0;
                moh=SBUF;
                if(SBUF==0x31)
                        down();

                    }*/

}

my problem is when i entered in serial_ISR and the SBUF=0x31 it mean the condition true,when i call down() function i can not from it enter to timer0_ISR never. how can i solve this problem?

0