1、两个函数
void UART_UartPutString(const char8 string[]);
void UART_UartPutCRLF(uint32 txDataByte);
第一个函数传送字符串 但是0会被他忽略掉。应为字符串是以0来结尾所以看到0他会认为是结束。以0判断字符串结束。
就会遇到问题只要你的数据有0那么直接结束从头开始。
AA55(00这里如果是00就结束)
AA55
void UART_UartPutString(const char8 string[])
{
uint32 bufIndex;
bufIndex = 0u;
/* Blocks the control flow until all data has been sent */
while(string[bufIndex] != ((char8) 0))//string[bufIndex] != ((char8) 0)
{
UART_UartPutChar((uint32) string[bufIndex]);
bufIndex++;
}
}
第二个函数传完一个数据后就会发送 0A 0D,我直接把它注释掉了,因为他是一个个传输的我不需要这个OD OA
* Function Name: UART_UartPutCRLF
********************************************************************************
*
* Summary:
* Places a byte of data followed by a carriage return (0x0D) and
* line feed (0x0A) into the transmit buffer.
* This function is blocking and waits until there is space available to put
* all the requested data into the transmit buffer.
*
* Parameters:
* txDataByte : the data to be transmitted.
*
* Return:
* None
*
*******************************************************************************/
void UART_UartPutCRLF(uint32 txDataByte)
{
UART_UartPutChar(txDataByte); /* Blocks control flow until all data has been sent */
UART_UartPutChar(0x0Du); /* Blocks control flow until all data has been sent */
UART_UartPutChar(0x0Au); /* Blocks control flow until all data has been sent */
}
然后直接用就可以了