#include "sys.h"
#include "usart.h"
#include "delay.h"
u8 com;
int main()
{
Stm32_Clock_Init(9);
delay_init(72);
uart_init(72,9600);
while(1);
}
#include "usart.h"
void Uart1_PutChar(u8 ch)
{
USART1->DR=ch;
while((USART1->SR&0X40)==0);//等待发送结束
}
void USART1_IRQHandler(void)
{
u8 com;
if(USART1->SR&(1<<5))//接收到数据
{
com=USART1->DR;
if(com == 0x63)
{
com = 0;
printf("\r\n您发送的消息为:\r\n");
Uart1_PutChar(0x63);
}
}
}
我看原子哥的程序,也有printf的语句,主函数目录下也有stdio.h,没加printf之间,在串口调试助手中输入0X63,显示63,加了printf之后,输入63就没反应了,为什么,还有我想问下,在能显示的情况下,为什么printf中的“您所发送的信息”等信息可以直接显示,串口并没有发送这些文字信息啊
|