Init_uart, Kbhit – Zilog ZUSBOPTS User Manual
Page 210

Run-Time Library
UM017105-0511
182
Zilog Developer Studio II – ZNEO™
User Manual
Before using the
getch
function, the
init_uart()
function must be called to initialize
and select the UART. The default UART is _UART0.
init_uart
The
init_uart
function is a Zilog function that selects the specified UART and initial-
izes it for specified settings and returns the error status.
Synopsis
#include
int init_uart(int port, unsigned long freq, unsigned long
baud);
Returns
Returns 0 if initialization is successful and 1 otherwise.
Example
#include
#include
void main()
{
init_uart(_UART0,_DEFFREQ,_DEFBAUD);
printf("Hello UART0\n"); // Write to _UART0
}
_DEFFREQ
is automatically set from the IDE using the setting in the
Configure Target
dialog box. See
kbhit
kbhit
is a Zilog function that determines whether there is receive data available on the
selected UART.
Synopsis
#include
int kbhit(void);
Returns
Returns 1 if there is receive data available on the selected UART; otherwise, it returns 0.
Example
int i;
i=kbhit();
Note: