rajbabu
Junior Member level 3
![Junior Member level 3](/styles/images/ranks/clevel3.gif)
what is problem in this code.
My problem is that when i debuggind it then first time ( serial int comes ) it execute properly but when second time serial int comes then it jumps abruplty.
IT JUMPS TO LINE NO. 19 THIS CONDITION IS FULL FILLED SO IT JUMPS TO 20
AGAIN CONDITION IS TRUE SO IT JUMP 21 BUT THEN IT JUMPS TO DIRECTLY 25 AND THEN 44.
1. void IRQ_UartGet () interrupt 4
2. {
3. unsigned char i;
4. if(RI==1)
5. {
6. RI=0;
7. i=SBUF;
8. if(!ReceiveOK)
9. {
10. if(0==Rx_Cnt)
11. {
12. if(PKG_MARK1==i)
13. {
14. Timer=UART_OUT_TIME;
15. CommBuf[Rx_Cnt++]=i;
16. SCC=i;
17. }
18. }
19. else if(1==Rx_Cnt)
20. {
21 if(PKG_MARK2==i)
22. {
23. CommBuf[Rx_Cnt++]=i;
24. SCC+=i;
25. }
26. else
27. {
28. Rx_Cnt=0;
29. }
30. }
31. else if(Rx_Cnt<4)
32. {
33. CommBuf[Rx_Cnt++]=i;
34. SCC+=i;
35. }
36. else if(Rx_Cnt<CommBuf[3]+4)
37. {
38. CommBuf[Rx_Cnt++]=i;
39. SCC+=i;
40. }
41. else if(Rx_Cnt<CommBuf[3]+4)
42. {
43. CommBuf[Rx_Cnt++]=i;
44. SCC+=i;
45. }
46. }
47. }
48. }
My problem is that when i debuggind it then first time ( serial int comes ) it execute properly but when second time serial int comes then it jumps abruplty.
IT JUMPS TO LINE NO. 19 THIS CONDITION IS FULL FILLED SO IT JUMPS TO 20
AGAIN CONDITION IS TRUE SO IT JUMP 21 BUT THEN IT JUMPS TO DIRECTLY 25 AND THEN 44.
1. void IRQ_UartGet () interrupt 4
2. {
3. unsigned char i;
4. if(RI==1)
5. {
6. RI=0;
7. i=SBUF;
8. if(!ReceiveOK)
9. {
10. if(0==Rx_Cnt)
11. {
12. if(PKG_MARK1==i)
13. {
14. Timer=UART_OUT_TIME;
15. CommBuf[Rx_Cnt++]=i;
16. SCC=i;
17. }
18. }
19. else if(1==Rx_Cnt)
20. {
21 if(PKG_MARK2==i)
22. {
23. CommBuf[Rx_Cnt++]=i;
24. SCC+=i;
25. }
26. else
27. {
28. Rx_Cnt=0;
29. }
30. }
31. else if(Rx_Cnt<4)
32. {
33. CommBuf[Rx_Cnt++]=i;
34. SCC+=i;
35. }
36. else if(Rx_Cnt<CommBuf[3]+4)
37. {
38. CommBuf[Rx_Cnt++]=i;
39. SCC+=i;
40. }
41. else if(Rx_Cnt<CommBuf[3]+4)
42. {
43. CommBuf[Rx_Cnt++]=i;
44. SCC+=i;
45. }
46. }
47. }
48. }