HI, i hav written a piece of code tat executes continuously i.e. while(1) In this there r two condition statement: if(SBUF1==0x20||SBUF1==0x7F||SBUF1==0x0FF) { //Statements } else if(SBUF1==0x53||SBUF1==0x73) { //Statements } And in debug mode i change the value of SBUF1 SFR accordingly...however wen i do "step into" it just does not enter either of these loops. Please help in this regard.
does this do what you want? if(SBUF1==0x20||SBUF1==0x7F||SBUF1==0x0FF) { //Statements } else if(SBUF1==0x53||SBUF1==0x73) { //Statements } Reading from SBUF removes the char. The other compares will not see the same char. It gets worse if another char comes in.
it does not do what i want it to do... and i m wondering how will readin(or comparing data)SBUF1 clear it unless another byte has been received in it? well, the bottomline is, i want to simulate SBUF1(reception). How do i write data into SBUF1 so that it will be treated as the data that has been received, and not data that is to be transmitted? is it a possibility in Uvision2?
Instead of modifying SBUF in the simulation, you should use the VTREGs SxIN/SxOUT.
yes, tats wat i did just now....finally i figured out tat data can be received in SBUF1 by using S1IN=XxXX in command window.... thnx everyone. If i get stuck somewhere again i will surely write back. And ,yes, the basic loop tat i mentioned in my first query is getting executed properly!!!