i am editing the program some one already made.i want help to receive the data from uart using the program.here is the interrupt program they have used.
void serial_interrupt() interrupt 4 using 1 { if(RI) { RI=0; com_tmr_rx=5; com_r_busy=1; //datas[0]=SBUF; //datas[com_r_index++]=SBUF; if(com_r_index>=34) com_r_index=0; } if(TI) { TI=0; TX_RX=0; if(com_t_index<com_t_length) { TX_RX=1; SBUF=datas[com_t_index++]; } else { com_t_index=com_t_length=0; TX_RX=0; } } }
.
So have you asked the original author?
What help, exactly, do you need?
i need the code to receive the serial data using the interrupt as the program given above.i am using like this but it gets hang in while loop.please any one can help me.
while(!RI); RI=0; if((datas[0]>='0')&&(datas[0]<='9')) { buffer[0]=datas[0]; datas[1]=buffer[0]; com_t_index=1; com_t_length=2; TX_RX=1; TI=1; delay_50us(50); }
The most important tool when debugging is the one between your ears - you need to think about what could be causing the problem and, thus, how to fix it.
Think: What condition is necessary for it to exit the while loop? If it isn't exiting the while loop, then that condition is never being fulfilled - so that is the problem which you need to fix!
Note also that your indentation is misleading. This might be because you have used TABs. Never use TABs. The interpretation of TABs is entirely unreliable - therefore, use only spaces for indentation.
Any decent programmer's editor will have the facility to insert the appropriate number of spaces when you press the TAB button; also the facility to convert TABs to spaces.
<quote>The interpretation of TABs is entirely unreliable</quote>
not if yew always use the same editor setings.
attentien to de-tail is important for progremmers.
always yo're freind.
Zeusti
(real tab users do it by the key)
But, obviously, that only helps if you always and only ever use the same editor.
Obviously, this forum has no knowledge whatsoever of what editor you use, and no knowledge whatsoever of what settings you have for it!
"attentien (sic) to de-tail (sic) is important for progremmers (sic)"
Oh, yes!
Also the ability to think things through completely!
i am editing the program some one already made
the point always to be made is:
if you can not make the code yourself, downloaded code is worthless.
the only thing you can hope (not know) is that the code worked under the circumstances the Author had.
but, if you could make the code yourself, you will have enough of an understanding of the downloaded stuff to fix/adapt it
Erik
Said by no other than zooisty. Oh, yeah.
Tamir - haven't you noticed that his english is sometimes free of spelling errors? He is just faking. And it is constantly trigging you.
<quote>And it is constantly trigging you.</quote>
its so very easy to trigg tapeer.
oh, yeah.
Per - I actually enjoy teasing the guy, I yes, I have noticed that sometimes his/her English is impeccable (unless he copy-pastes it...). I am sorry for stealing forum bandwidth - sometimes I cannot help it...!
<quote>I actually enjoy teasing the guy</quote>
LMAO. yew realey beleive yew tease me? cool.
<quote>I have noticed that sometimes his/her English is impeccable</quote>
LMFAO. yew judging my english? priceless.
Always yo're freind.
Zeusti.
View all questions in Keil forum