/* Includes ------------------------------------------------------------------*/ #include "stm32f4xx_conf.h" #include void Delay(__IO uint32_t nCount); //*********************************************** //函数功能:延时ms //入口参数:延时长度 //出口参数:无 //备 注: //************************************************ void Delay_ms(u16 ms) { u32 j; for(;ms>0;ms--) for(j=0;j<9700;j++); } //*********************************************** //函数功能:IO 配置 //入口参数:无 //出口参数:无 //备 注: //************************************************ void GPIO_Configuration(void) { GPIO_InitTypeDef GPIO_InitStructure; /* GPIOD Periph clock enable */ RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOC, ENABLE); /* Configure PD12, PD13, PD14 and PD15 in output pushpull mode */ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; GPIO_Init(GPIOC, &GPIO_InitStructure); /* Configure PA0 pin as input floating */ //GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN; //GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; //GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0; //GPIO_Init(GPIOA, &GPIO_InitStructure); } //*********************************************** //函数功能:UART 配置 //入口参数:无 //出口参数:无 //备 注: //************************************************ void USART_Configuration(void) { USART_InitTypeDef USART_InitStructure; USART_InitStructure.USART_BaudRate =9600; //波特率 USART_InitStructure.USART_WordLength = USART_WordLength_8b; //8 位数据 USART_InitStructure.USART_StopBits = USART_StopBits_1; //停止位 USART_InitStructure.USART_Parity = USART_Parity_No; // 校验方式:无 USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None; //硬件流控制失能 ...