⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 uart_test.c

📁 基于周立功arm开发板的实验程序
💻 C
字号:
/*********************************************************************************************
* File:	uart_communication.c
* Author:	embest
* Desc:	uart test file
* History:	
*			R.X.Huang, Programming modify, March 12, 2005
*********************************************************************************************/
/*------------------------------------------------------------------------------------------*/
/*                                     include files	                                    */
/*------------------------------------------------------------------------------------------*/
#include "uart_test.h"

//extern UINT32T g_nKeyPress;				// the SB1202/SB1203 press signal
/*********************************************************************************************
* name:		uart0_test
* func:		uart test function
* para:		none
* ret:		none
* modify:
* comment:		
*********************************************************************************************/
void uart0_test(void)
{
	char cInput[256];
	UINT8T ucInNo=0;
	UINT32T	g_nKeyPress;
	char c;
	uart_init(0,115200,0);
	uart_printf("\n UART0 Communication Test Example\n");	
	uart_printf(" Please input words, then press Enter:\n");
	uart_printf(" />");
#ifdef BOARDTEST	
	sprintf(&cInput, "Type via UART0 to test.");
	print_lcd(195,170,0x1c,&cInput);	
#endif
	uart_printf(" ");
	g_nKeyPress = 1;
	while(g_nKeyPress==1)			// only for board test to exit
	{
		c=uart_getch();
		//uart_sendbyte(c);
		
		uart_printf("%c",c);
		if(c!='\r')
			cInput[ucInNo++]=c;
		else
		{
			cInput[ucInNo]='\0';
			break;
		}
	}
	delay(1000);	

	uart_printf(" \nThe words that you input are: %s\n",cInput);		
	uart_printf(" end.\n"); 
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -