??? 09/29/09 06:29 Modified: 09/29/09 06:57 Read: times |
#169243 - Are you listening to anything that's been said here? Responding to: ???'s previous message |
You're doing strings of ifs again - where a case would be a far more obvious candidate
Ralf Altman said:
while (RI) { : } Why are you putting the entire code within while(RI) ? You need to: 1. wait for a character; 2. when one becomes available, read it; 3a. if that completes a message, handle the message; 3b. if it doesn't complete a message, repeat from (1); 4. repeat as necessary. Which is the converse of transmitting, as outlined previously: http://www.8052.com/forum/read/169121 Why are you back to polling? I thought you wanted to use interrupt-driven IO? You should avoid the use of "magic numbers"; eg, if(c==0x053 || c==0x056) //If S or V entered, store as 1st character If you're specifically intending these values as characters, then write them as characters - not as "magic numbers"; eg, if( c=='S' || c=='V' ) // If S or V received, store as 1st character Also, consider the use of arrays - instead of lots of individual variables... |