香水城主,最近遇到STM8L152C6T6的USART功能不起作用,相应端口无数据输出,能帮我看下是什么原因不
下面是配置测试程序
#include "STM8L152C6.h"
_Bool TC @USART1_SR:6;
_Bool reset @PC_ODR:0;
main()
{
CLK_CKDIVR =0x00; //system clock source/1
while(!(CLK_ICKCR & 0x02)); //等待HSI准备好
CLK_PCKENR1=0x20;
USART1_BRR2 = 0x03;
USART1_BRR1 = 0x68;
USART1_CR2 = 0x0C;
SYSCFG_RMPCR1|=0x10; //PA2 TX, PA3 RX
while (1)
{
USART1_DR=0x50;
while(TC==0);
TC=0;
}
} |