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

Serial Rx problem

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

Parents
  • Sardine figure,

    I have noticed something strange about you - maybe it is because you are like that, maybe you just try to be provocative. most of the time somebody dares to disagree with you, you attribute that to "completely missing the point", "read the manual" etc. And worse, now you begin with religious references (were you not quoting some holy text up there?). I do have a lot of respect for religion, but it really is not hard to imagine you as some kind of lunatic freak running around in circles waving his arms...!!! shame on you for harnessing devine powers!

Reply
  • Sardine figure,

    I have noticed something strange about you - maybe it is because you are like that, maybe you just try to be provocative. most of the time somebody dares to disagree with you, you attribute that to "completely missing the point", "read the manual" etc. And worse, now you begin with religious references (were you not quoting some holy text up there?). I do have a lot of respect for religion, but it really is not hard to imagine you as some kind of lunatic freak running around in circles waving his arms...!!! shame on you for harnessing devine powers!

Children