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.
It has been said that debugging is twice as hard as writing the code in the first place.
Therefore, if you couldn't write the code yourself, you have no chance of debugging it!
<quote>But, obviously, that only helps if you always and only ever use the same editor.</quote>
not troo. no. no not at all. yew can set hard tab stop to 8 (eg) in uvision and vstudio and many othur editers and it looks the sayme.
bee four some one donates good advise the some one kneeds good under standing.
Always yo're freind.
But you cannot set tab stops when you post to a website, can you?
And, if you don't use TABs at all, then you don't have to keep reconfiguring all your different editors. And you don't have to tell others what tab stops to use to view your code.
<quote>But you cannot set tab stops when you post to a website, can you?</quote>
troo. not sayed diferunt.
<quote>And, if you don't use TABs at all, then you don't have to keep reconfiguring all your different editors.</quote>
very pour. very very pour.
keep reconfuguring? only configered each editer once. who do'snt configere there editer when they thirst yews it? won setting four tabs is <bold>realey</bold> hard? realey? sum editers even have default of hard tabs!
Zeusti.
I have seen files edited with tab size 4, and where the header in all files said "tab size 4". Next guy edited with other tab setting, wondering why the indent looked so strange. Third guy edited with yet another setting (while converting tabs to spaces) and wondered about the astonishing indent.
Tabs really are no good.
Also, annotate from some source code repository programs adds a fixed prefix to each line, without checking for tabs. So the initial 8-step tab will only become a 6-step or 5-step tab.
Then there is the web applications that allows you to look at source code from the repository using your web browser. How would you configure them to know what tab settings you have in the different directories?
And if you cut some lines and mail inline in the mail program?
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.