#MAAM#
Full Member level 2
- Joined
- Nov 21, 2009
- Messages
- 131
- Helped
- 29
- Reputation
- 58
- Reaction score
- 27
- Trophy points
- 1,308
- Location
- Egypt
- Activity points
- 1,920
hi,
my code is too long so i put snapshot of my code
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?
my code is too long so i put snapshot of my code
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?