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
HI.
i have tidyed yo're code.
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; }
TI=TRUE; /* always set TI=1 initially to allow serial printing */ RI=0; loop: // RI=0; //IDLE while ((1)) ; goto loop; }
they're a lot of things wrong.
the bigest i think is yo're interrupt. it gets called when they're is one char from uart. but you call 'gets" to get more char's. where do u think they will come from?
u must change yo're isr to collect the char's. one at a time.
also u must clear ri if it is set. not evry time.
r u using tx anywear? if u do not then u do not set ti.
Alway's yo're freind.
Zeusti.
I don't know this processor architecture so I don't know if the following is even supported, but maybe the OP is using serial communication with a FIFO which explains why he tries to read more than one character...?
Erik,
A little ENGLISH lesson for you ...
The word dependant when used in the context:
"...totally dependant upon the rest of the code."
is not a noun.
So, yet again, you have tried to indicate a fault in something that is correct.
A little advice - If you want to argue about semantics, ensure you have a cogent argument.
Regardless of context, "dependant" is always a noun, unless it is a misspelling and should actually read "dependent".
"Dependent" can be a noun, in which case it's an alternative form of "dependant", or an adjective.
Erik is correct, and the link he gives explains things quite nicely.
Please don't go around trying to teach people incorrect English.
<Extremely big sigh>
Consider British English.
The link that you attribute to Erik (which I actually gave to him) clearly shows a definition for dependant as an adjective (adj=adjective).
If you use a search engine or look in a British English dictionary, you can check for yourself.
Here is another link:
www.audioenglish.net/.../dependant.htm
Just for the record, I will change one thing:
So, yet again, you have tried to indicate a fault in something that is not incorrect.
Your link does.
"USAGE: Dependant is the generally accepted correct spelling in British usage for the noun and always refers to people: if you are single and have no dependants. The adjective should be spelt dependent: tax allowance for dependent (not dependant) children. American usage spells both adjective and noun with an e in the last syllable."
<Even bigger sigh>
Look at the Thesaurus entry and my other link and the many others.
Shame you can't see my British English dictionary that I have right in front of me.
Regardless, all this chatter didn't do anything to reveal the meaning of this gem:
"I see in the above posts that drawing the OPs attention to values made someone think I was ignorant of what they were, as in if I say "do you see the sunset" I am unaware of it ????"
Jesus Christ (sorry, Jack Sprat! I had to) people, can't you find a proper forum to discuss English spelling...? I think we had enough. Don't you agree?
Hello Tamir,
I totally agree - Besides which, I'm all sighed out!
You will hear no more on the subject from me.
Stephen.
look, up in sky! Its a bird, its a plane its... its Super Code Monkey!
No offense. Well partially none.
--Cpt. Vince Foster 2nd Cannon Place Fort Marcy Park, VA
Vince,
No idea what your on about (or on), but your post made me laugh.
Whoops,
Better fix that error:
No idea what you're on about (or on), but your post made me laugh.
you're on about (or on)...
15mg Hydrocodone, 650mg of APAP, 20mg Diazapam, 350mg of Cordosiporol, 1.5 shots of Bacardi 151, one "Rules for Coding [Monkey] Radicals," one fulll lip of Copenhagan, and bio-lab bunker level #3 with elevated O2 levels. Yet I still function at a higher strata than a sardine: 999.
Dirty-Deeds-Done-Dirt-Cheap.... what a concocted world I live in.
That should be, "a higher stratum", surely??
As usual, Vince, you rock...! :-)
"Diazapam, a benzodiazepine, C16H13ClN2O, used for alleviation of anxiety and tension..."
Have been working to close to warheads lately, captain :-)
I'm glad to see you are up to you old antics. Now I have a excellent mental image to carry my through the day.
Thanks Vince
View all questions in Keil forum