How do you wait for serial data coming back from the processor?
What flags do you look for or wait on?
I tried all the followings conditions for timeout and none of them seem to work.
while(serDpeek()==-1)
while(BitRdPortI(SDSR, SS_RRDY_BIT) == 0)
while(serDrdUsed()<7)
Here is a complete while loop for timeout.
t = MS_TIMER;
while ( serDpeek() == -1)
{
if (MS_TIMER>(t+100)
break;
}
serDpeek always returns as though there is data to read when in fact no data has been received. With SDSR, SS_RRDY_BIT flag, it always indicates that port D is ready for reading. As for as serDrdUsed function goes, I have no idea what it is doing.