[mw_shl_code=c,true]求各位大神帮看看这个串口的程序,哪里错了,我运行过了,没有警告,没有错误,可是就是灯没有闪烁,串口也没有显示,发送也没有显示[/mw_shl_code]
[mw_shl_code=c,true]
[/mw_shl_code]
[mw_shl_code=c,true]#include"stm32f4xx.h"
#include"delay.h"
#include"usart.h"
#include"led.h"
int main(void)
{
u8 t;
u8 len;
Stm32_Clock_Init (336,8,2,7);
delay_ms(168);
uart_init(84,115200);
LED_Init();
while(1)
{
if(USART_RX_STA&0x8000)
{
len=USART_RX_STA&0x3fff;
printf("\n从调试助手发送的数据为:\n");
for(t=0;t<len;t++)
{
USART1->DR =USART_RX_BUF[t];
while((USART1 ->SR &0x40)==0);
}
USART_RX_STA =0;
}
else
{
LED0=!LED0;
delay_ms(200);
}
}
}
以下是led.c的
#include"stm32f4xx.h"
#include"led.h"
void LED_Init(void)
{
RCC->AHB1ENR|=1<<5;
GPIO_Set(GPIOF,PIN9,GPIO_MODE_OUT,GPIO_OTYPE_PP,GPIO_SPEED_100M,GPIO_PUPD_PU);
LED0=1;
}
以下是led.h的
#ifndef __LED_H
#define __LED_H
#include "sys.h"
#define LED0 PFout(9) //DS0
void LED_Init(void);
#endif
[/mw_shl_code]
|