Programming Embedded Systems by By

Programming Embedded Systems by By

Author:By
Language: eng
Format: epub
ISBN: 0-596-00983-6
Publisher: O'Reilly
Published: 2011-10-03T16:06:10.098790+00:00


The serial device driver API function serialGetChar waits until a character is received and then reads the character from the serial port. To determine whether a character has been received, the data ready bit is checked in the UART status register. The character received is returned to the calling function. Here is the serialGetChar function:

#define DATA_READY (0x01) /********************************************************************** * * Function: serialGetChar * * Description: Get a character from the serial port. * * Notes: This function is specific to the Arcom board. * * Returns: The character received from the serial port. * **********************************************************************/ char serialGetChar(void) { /* Wait for the next character to arrive. */ while ((pSerialPort->uartStatus & DATA_READY) == 0) ; return pSerialPort->data; }



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.