在串口试验中,USART_SendArray(DEBUG_USARTx , a,10);没能输出a[10]中的元素?
例程中编写了以下程序,
#include "bsp_led.h"
#include "bsp_usart.h"
int main()
{
uint8_t ch;
uint8_t a[10]={1,2,3,4,5,6,7,8,9,10};
USART_Config();
USART_SendByte(DEBUG_USARTx , 0x64);//01100100
printf("n");
USART_Send2Byte(DEBUG_USARTx , 0xff56);
printf("n");
USART_SendArray(DEBUG_USARTx , a,10);
printf("n");
USART_SendString(DEBUG_USARTx, "sendString");
printf("n");
printf("chuankou printf函数测试n");
putchar('b');
printf("n");
while(1)
{
// ch = getchar();
ch = '1';
printf("ch = %cn",ch);
switch(ch)
{
case '1'
ED_GREEN;
break;
case '2'
ED_BLUE;
break;
case '3'
ED_RED;
break;
default{:10:}ED_RGBOFF;
break;
}
}
}
我debug测试结果如下:
d
V
s
chuankou printf函数测试
b
ch = 1
问题是:
USART_SendByte(DEBUG_USARTx , 0x64);//01100100
输出结果是d
USART_Send2Byte(DEBUG_USARTx , 0xff56);
输出结果是 V
USART_SendArray(DEBUG_USARTx , a,10);
没能输出a[10]中的元素。
USART_SendString(DEBUG_USARTx, "sendString");
只输出了一个 s就没有了?