STM32
直播中

杨福林

7年用户 1480经验值
私信 关注
[问答]

STM8L051复用PC5,PC6脚做串口无输出的原因?

       #define Uart_TX 5
#define Uart_RX 6

void Uart_IO_Init(void)
{
        PC_DDR  = (~(1<>8)   0xf0);                        //
        USART1_BRR2 |= ((unsigned char)(2000000/9600)   0x0f);
        USART1_BRR1 = ((unsigned char)(2000000/9600)>>4);        
        
        
        USART1_CR2 |= (1<<2) | (1<<3) ;                        //使能接收发送
        
}

以上是我串口配置,发送数据时,TX脚上用示波器观察没有输出,是配置上还有问题吗?


回帖(1)

吴江

2024-5-14 10:21:56
引脚配置错误照成的。PC_CR1 |= (1<

更多回帖

发帖
×
20
完善资料,
赚取积分