嵌入式单片机基础篇(二十五)之stm32F103串口接收发送固定大小字符串程序

stm32F103串口接收发送固定大小字符串程序

#include "stm32f10x.h"
#include "string.h"
#include "stdio.h"
unsigned char UARTbuff[32];  
int k=0;
static unsigned char count=0;
void My_USART1_Init(void)
{
   
	GPIO_InitTypeDef GPIO_InitStrue;
	USART_InitTypeDef USART_InitStrue;
	NVIC_InitTypeDef NVIC_InitStrue;
	
	RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA,ENABLE);
	RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1,ENABLE);
	
	GPIO_InitStrue.GPIO_Mode=GPIO_Mode_AF_PP;
	GPIO_InitStrue.GPIO_Pin=GPIO_Pin_9;
	GPIO_InitStrue.GPIO_Speed=GPIO_Speed_10MHz;
  GPIO_Init(GPIOA,&GPIO_InitStrue);
	
	GPIO_InitStrue.GPIO_Mode=GPIO_Mode_IN_FLOATING;
	GPIO_InitStrue.GPIO_Pin=GPIO_Pin_10;
	GPIO_InitStrue.GPIO_Speed=GPIO_Speed_10MHz;
  GPIO_Init(GPIOA,&GPIO_InitStrue)

你可能感兴趣的:(嵌入式,单片机,串口通信,嵌入式,stm32,单片机,串口通信)