|
初始化程序什么的都调用了,却没有发送,走仿真发现会一直停在发送数据为空的判断上
#include "uart1.h"
void G_chuankouchushihua(void)
{
UART1_DeInit();
UART1_Init((u32)9600, UART1_WORDLENGTH_8D, UART1_STOPBITS_1,\
UART1_PARITY_NO, UART1_SYNCMODE_CLOCK_DISABLE, UART1_MODE_TXRX_ENABLE);
UART1_Cmd(ENABLE);
}
void G_chuankoufazijie(unsigned char byte)
{
UART1_SendData8(byte);
while (UART1_GetFlagStatus(UART1_FLAG_TXE) == RESET);//发送数据为空
}
#include "stm8s.h"
#include "stm8s_clk.h"
#include "uart1.h"
void G_chushihua(void)
{
CLK_HSIPrescalerConfig(CLK_PRESCALER_HSIDIV1);
void G_chuankouchushihua(void);
}
static void delay (int cnt)
{
while (cnt--);
}
int main(void)
{
G_chushihua();
while (1)
{
delay(10000);
delay(10000);
delay(10000);
G_chuankoufazijie('a');
G_chuankoufazijie('b');
G_chuankoufazijie('c');
}
}
|
|