发送程序
//while(++time%500 != 0);
usart3_send(0xff);
delay_ms(30);
//while(++time%500 != 0);
usart3_send(0xfe);
delay_ms(30);
//while(++time%500 != 0);
usart3_send(2);
delay_ms(30);
//while(++time%500 != 0);
usart3_send(1);
delay_ms(30);
//while(++time%500 != 0);
usart3_send(72);
delay_ms(30);
//while(++time%500 != 0);
usart3_send(10);
delay_ms(30);
//while(++time%500 != 0);
usart3_send(20);
delay_ms(30);
//while(++time%500 != 0);
usart3_send(30);
delay_ms(30);
//while(++time%500 != 0);
usart3_send(40);
delay_ms(30);
发送的函数
void usart3_send(u8 data)
{
USART3->DR = data;
while((USART3->SR&0x40)==0);
}
接受程序
int USART3_IRQHandler(void)
{
if(USART3->SR&(1<<5))//接收到数据
{
u8 res;
res=USART3->DR;
delay_ms(20);
printf( "
USART3接收到的数据=%d
",res );
}
return 0;
}
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
一周热门 更多>