用官方的例程串口没法收发收据,后来修改程序如下:
调试代码有点乱,PA14是led灯正常,首先加了PB0 和 PB1的MFP映射到UART的操作,死循环打印数据,结果用万用表测试PB0和PB1的电平都为0,接着用了下面的程序测试,结果不管怎样,PB0的电平都是0,PC0的电平可以正常高低,请问是哪里出现问题了?第一次用这个MCU
while(1){
//UART_Write(UART0, (uint8_t *)"aaaaaa", 7);
//SendChar_ToUART(0x5a);
// printf("\n\nCPU @ %dHz\n", SystemCoreClock);
PA14 = 0;
PB0 = 0;
PB1 = 0;
PB2 = 0;
PB3 = 0;
PB4 = 0;
PB5 = 0;
PC0 = 0;
delay_nnn();
//UART_Write(UART0, (uint8_t *)"aaaaaa", 7);
//SendChar_ToUART(0xaa);
// printf("\n\nCPU @ %dHz\n", SystemCoreClock);
PA14 = 1;
PB0 = 1;
PB1 = 1;
PB2 = 1;
PB3 = 1;
PB4 = 1;
PB5 = 1;
PC0 = 1;
delay_nnn();
} |