|
/*------------------------------------------------------------------*-
PC_LINK_O_Send_Char()
Based on Keil sample code, with added (loop) timeouts.
Implements Xon / Off control.
Uses on-chip UART hardware.
-*------------------------------------------------------------------*/
void PC_LINK_O_Send_Char(const char CHARACTER)
{
tLong Timeout1 = 0;
if (CHARACTER == '\n')
{
Timeout1 = 0;
while ((++Timeout1) && (TI == 0));
if (Timeout1 == 0)
{
// UART did not respond - error
// No error reporting in this simple library...
return;
}
TI = 0;
SBUF = 0x0D; // Output CR
}
Timeout1 = 0;
while ((++Timeout1) && (TI == 0));
if (Timeout1 == 0)
{
// UART did not respond - error
// No error reporting in this simple library...
return;
}
TI = 0;
SBUF = CHARACTER;
}
这段程序中红色的部分不太理解,还请达人帮忙看看
|
|