示例#1
0
文件: testuart.c 项目: zunaadmin/PIC
/*** Function    : main
**   Parameters  : None
**   Return      : int
**   Description : It is the entry point of program
**/
int main(void)
{
SetOsc(OSC_FREQ);             // Set Oscillator Freq
Serialbegin(BAUD_RATE);       // Set Baud Rate
Serialflush();                // Clear the buffers
Serialprint("uart test\n\r"); // Print a string
setSerialinterrupt();         // Enable Serial Interrupt
while(1)
{
 while(uartNewLineCount<NEW_LINE_THRESHOLD); // Wait until new line count reaches threshold
 Serialprint(uartReadBuffer);                // Print the uart read buffer
 Serialflush();                              // Flush the buffer
}
}
示例#2
0
/**
 * Start serial with baudrate. 
 * 
 * @param baud_count - baudrate for communication
 */
void Serial_::begin(uint32_t baud_count)
{
	Serialbegin(dev, baud_count);
	started = true;
}