?? uart_test.c
字號:
/*********************************************************************************************
* File: uart_test.c
* Author: embest
* Desc: uart test
* History:
* H.T.Zhang, Programming start, September 12, 2005
*********************************************************************************************/
#include "2410lib.h"
#include "lcd.h"
#include "def.h"
#include "demo.h"
int f_nUartSelect;
extern void lcd_disp_ascii8x16(UINT16T, UINT16T, UINT8T, UINT8T *);
/*********************************************************************************************
* name: uart_test
* func: uart test function
* para: none
* ret: none
* modify:
* comment:
*********************************************************************************************/
void uart_test()
{
char szcInput[30];
char szcTestStr[30]="UART OK";
int i;
lcd_disp_str16(40,60,BLUE,"Please connect UART0 and UART1 with cross cable.");
if(rUTRSTAT1 & 0x1) // Check if Receive data ready
i = rURXH1;
f_nKeyPress = 0;
while(!f_nKeyPress)// any key to exit.
{
for(i=0;i<strlen(szcTestStr);i++)
{
uart_select(0);
uart_sendbyte(szcTestStr[i]);
delay(10);
uart_select(1);
szcInput[i] = uart_getkey();
}
szcInput[i] ='\0';
if(!strcmp(szcInput,szcTestStr))
{
lcd_disp_ascii8x16(40,140,RED,szcInput);
lcd_disp_ascii8x16(40,160,BLUE,"end.");
break;
}
}
f_nKeyPress = 0;
while(!f_nKeyPress);// any key to exit.
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -