stm8s207串口收发问题
如题,求代码一电脑串口助手发送字符串,stm8s接收到后,并发送出去; void Uart3Init()//115200
{
UART3_CR2 = 0x00; //disable Tx & Rx
/* UART1 configured as follow:16M内部高速振荡器
- BaudRate = 9600 baud
- Word Length = 8 Bits
- Receive and transmit enabled
- UART1 Clock disabled
Configure UART1 */
UART3_CR1= 0x00;//No parity
UART3_CR3= 0x00;//One Stop Bit
UART3_BRR2 = 0x05;
UART3_BRR1 = 0x04;
UART3_CR2= 0x2C;//允许发送/接收中断
}
void Uart1Init()
{
UART1_CR2 = 0x00; //disable Tx & Rx
/* UART1 configured as follow:16M内部高速振荡器
- BaudRate = 9600 baud
- Word Length = 8 Bits
- Receive and transmit enabled
- UART1 Clock disabled
Configure UART1 */
UART1_CR1= 0x00;//No parity
UART1_CR3= 0x00;//One Stop Bit
UART1_BRR2 = 0x01;
UART1_BRR1 = 0x34;
UART1_CR2= 0x2C;//允许发送/接收中断
}
页:
[1]