I have a strange problem in my code. I cannot receive characters via the serial port.
I've read up on the TI and RI interrupts and I think I am handling these correctly.
The program goes to the serial I/O isr, but just sits at the gets(comin,4) line. When I examine comin in the watch window and input chars via the SIN = xx (where xx is an ascii code), I can see the comin array remains empty.
Below is the serial I/O interrupt routine (my application does not need Tx)
pre void uart_rx_isr (void) interrupt 4 using 3 { signed char index=0; EA=0;
if (RI == 1) { gets(comin,4); command = atoi(comin); } RI=FALSE; /* finished isr - clear flag */ TI=FALSE; /* TI will not be used - always clear it*/ EA=1; }
/pre
Here is a fragment from main() - you can see that I set TI=1 initially to set the UART up
pre
TI=TRUE; /* always set TI=1 initially to allow serial printing */ RI=0;
loop: //RI=0; //IDLE
while ((1));
goto loop; } /pre
Appreciate some pointers here.
Jason
the questions above is for the OP, DO NOT answer them for him/her.
I know your love of showing off by doing the thinking for the posters, but that does NOT help them
Erik
Zeusty likes to proclaim himself as "professor", "horrified", "honored" etc. Given Eric's comments, I suggest a new one: "Reprimanded Zeusty" :-)
HI.
question for ERIC.
what do u think the line from his isr does:
int index=0;
so index is good when it enters the loop.
<quote> such a lack of understanding that you need to go back to basics and do some studying </quote>
he has a lot wrong and i did not give all answers. just the one with the big big problem.
but u just confuse and indicate that something is wrong when it is right. not done well but not wrong.
Always yo're freind.
Zeusti.
at the beginning i said i will stay for a while.
my time is now over and i need to leave.
so i say goodbuy.
Forever yo're freind.
Ho Zeusti, do care to come back! We will be missing you! Please don't go! Who will guide the flock :-)