在串口调试软件里,发送的数据单片机不能接收到,但能接收到单片机的数据。
程序如下:#include "stm8s.h"
#include "stm8s_uart3.h"
#include "stm8s_clk.h"
void CLK_Config(void)
{
CLK_DeInit();
//CLK_HSIPrescalerConfig(CLK_PRESCALER_HSIDIV2);//change the default value DIV8 into DIV2
}
void UART3_Config(void)
{
UART3_DeInit();
UART3_Init((u32)19200,UART3_WORDLENGTH_8D,UART3_STOPBITS_1,UART3_PARITY_NO,UART3_MODE_TXRX_ENABLE);
}
int delay(u16 time)
{
for(time;time>0;time--);
}
main()
{
static u8 data;
//data=0X03;
CLK_Config();
UART3_Config();
while (1)
{
data=UART3_ReceiveData8();
delay(1000);
//data=1;
UART3_SendData8(data);
}
}
|