Home  >  Support  >  Support Forum  >  how do you timeout waiting for data back from the JackRabbit?
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

how do you timeout waiting for data back from the JackRabbit?

0 votes
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.
asked Jul 15 in Rabbit Software by homersimpson New to the Community (12 points)
edited Jul 15 by homersimpson

Please log in or register to answer this question.

1 Answer

+1 vote
 
Best answer
Take a look at samples\serial\EchoChr.c. This program waits on serDgetc() to return success (0)

Here is the function description:

SYNTAX: int serDgetc(void);

DESCRIPTION: Get next available character from serial port D read buffer.
This function is non-reentrant.

PARAMETER1: None

RETURN VALUE: If successful, the next character in the low byte and 0 in
the high byte of the integer result;
otherwise, the integer -1 which indicates either an empty
or a locked receive buffer.
answered Jul 16 by trooper2 Veteran of the Digi Community (556 points)
selected Jul 17 by homersimpson
Thank you so much.
Contact a Digi expert and get started today! CONTACT US
...