Comm GetChar

INT8U CammGetChar(INT8U ch, INT8U *err); (CCMMBGND.C)

CommGetChar () allows your application to extract data from the received data ring buffer. Arguments ch is the serial channel and can be either C0MM1 or COMM2.

err is a pointer to a variable that will hold status about the outcome of the function. CommGetChar () sets *err to one of the following:

COMM_NO_ERR. if a byte is available from the ring buffer. COMM_RX_EMPTY if the ring buffer is empty. COMM_BAD_CH if you do not specify either COMM1 or COMM2.

Return Value

The function returns the oldest byte stored in the ring buffer if the buffer is not empty. If the buffer is empty, CommGetChar () returns the NUL character (i.e., 0x00).

Notes/Warnings

None

Example void BgndFnct (void) {

INT8U err;

c = CommGetChar(COMM1, &err); if (err == COMM_NO_ERR) { Process character;

Was this article helpful?

0 0

Post a comment