给你程序,void USART_printf( uint8_t *Data)
{
uint8_t i=40;
while ( i--) // 判断是否到达字符串结束符
{
if ( *Data == 0x5c ) //'\'
{
switch ( *++Data )
{
case 'r': //回车符
USART_SendData(USART1, 0x0d);
Data ++;
break;
case 'n': //换行符
USART_SendData(USART1, 0x0a);
Data ++;
break;
default:
Data ++;
break;
}
}
else USART_SendData(USART1, *Data++);
while( USART_GetFlagStatus(USART1, USART_FLAG_TC) == RESET );
}
} |