资源简介
STM32F103串口使用空闲IDLE中断接收不定长数据程序

代码片段和文件信息
#include “uart.h“
void USART1_Init(void)
{
GPIO_InitTypeDef GPIO_InitStructure;// 定义一个GPIO_InitTypeDef类型的变量
USART_InitTypeDef USART_InitStructure;// 定义一个USART_InitTypeDef类型的变量
NVIC_InitTypeDef NVIC_InitStructure;
/* 允许GPIOA和USART1的时钟 */
RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1 | RCC_APB2Periph_GPIOA ENABLE);
/* 配置USART1 */
/* 配置PA9(TXD) */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9; // 选择PIN9
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; // 复用推挽输出
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; // 50MHz速度
GPIO_Init(GPIOA &GPIO_InitStructure);// 把参数带进函数配置
/* 配置PA10(RXD) */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10;// 选择PIN10
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;// 选择浮空输入
GPIO_Init(GPIOA &GPIO_InitStructure); // 把参数带进函数配置
/* 配置串口USART1的模式 */
USART_InitStructure.USART_BaudRate = 115200; // 波特率9600
USART_InitStructure.USART_WordLength = USART_WordLength_8b;// 8个数据位
USART_InitStructure.USART_StopBits = USART_StopBits_1; // 1个停止位
USART_InitStructure.USART_Parity = USART_Parity_No ; // 无奇偶校验
USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;// 无硬件流控制
USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
USART_Init(USART1 &USART_InitStructure); //把上面配置的参数带进函数里面初始化串口
/* 打开空闲中断 */
USART_ITConfig(USART1 USART_IT_IDLE ENABLE);
/* 打开接收中断 */
USART_ITConfig(USART1 USART_IT_RXNE ENABLE);
/* 配置NVIC优先级组 */
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_0);
/* 允许UART1中断 */
NVIC_InitStructure.NVIC_IRQChannel = USART1_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
USART_ClearFlag(USART1USART_FLAG_TC);
USART_Cmd(USART1 ENABLE);// 打开串口1
}
// 发送一个字节
void USART1_Send_byte(uint8_t val)
{
USART_SendData(USART1 val);
while (USART_GetFlagStatus(USART1 USART_FLAG_TC) == RESET); //等待发送完成
}
// 接收一个字节
uint8_t USART1_Recv_byte(void)
{
while (USART_GetFlagStatus(USART1 USART_FLAG_RXNE) == RESET);
return USART_ReceiveData(USART1);
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 2348 2015-10-24 20:03 STM32F103串口使用空闲IDLE中断接收不定长数据程序\CFG\uart.c
文件 179 2015-03-05 15:34 STM32F103串口使用空闲IDLE中断接收不定长数据程序\CFG\uart.h
文件 17273 2010-06-07 10:25 STM32F103串口使用空闲IDLE中断接收不定长数据程序\Libraries\CMSIS\CM3\CoreSupport\core_cm3.c
文件 85714 2011-02-09 14:59 STM32F103串口使用空闲IDLE中断接收不定长数据程序\Libraries\CMSIS\CM3\CoreSupport\core_cm3.h
文件 26297 2011-03-14 12:31 STM32F103串口使用空闲IDLE中断接收不定长数据程序\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\Release_Notes.html
文件 15766 2011-03-10 10:52 STM32F103串口使用空闲IDLE中断接收不定长数据程序\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\startup\arm\startup_stm32f10x_cl.s
文件 15503 2011-03-10 10:52 STM32F103串口使用空闲IDLE中断接收不定长数据程序\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\startup\arm\startup_stm32f10x_hd.s
文件 15692 2011-03-10 10:52 STM32F103串口使用空闲IDLE中断接收不定长数据程序\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\startup\arm\startup_stm32f10x_hd_vl.s
文件 12376 2011-03-10 10:52 STM32F103串口使用空闲IDLE中断接收不定长数据程序\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\startup\arm\startup_stm32f10x_ld.s
文件 13656 2011-03-10 10:52 STM32F103串口使用空闲IDLE中断接收不定长数据程序\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\startup\arm\startup_stm32f10x_ld_vl.s
文件 12765 2011-03-10 10:52 STM32F103串口使用空闲IDLE中断接收不定长数据程序\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\startup\arm\startup_stm32f10x_md.s
文件 14073 2011-03-10 10:51 STM32F103串口使用空闲IDLE中断接收不定长数据程序\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\startup\arm\startup_stm32f10x_md_vl.s
文件 15955 2011-03-10 10:51 STM32F103串口使用空闲IDLE中断接收不定长数据程序\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\startup\arm\startup_stm32f10x_xl.s
文件 13072 2011-03-10 10:52 STM32F103串口使用空闲IDLE中断接收不定长数据程序\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\startup\gcc_ride7\startup_stm32f10x_cl.s
文件 13160 2011-03-10 10:52 STM32F103串口使用空闲IDLE中断接收不定长数据程序\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\startup\gcc_ride7\startup_stm32f10x_hd.s
文件 12482 2011-03-10 10:52 STM32F103串口使用空闲IDLE中断接收不定长数据程序\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\startup\gcc_ride7\startup_stm32f10x_hd_vl.s
文件 9814 2011-03-10 10:52 STM32F103串口使用空闲IDLE中断接收不定长数据程序\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\startup\gcc_ride7\startup_stm32f10x_ld.s
文件 10562 2011-03-10 10:52 STM32F103串口使用空闲IDLE中断接收不定长数据程序\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\startup\gcc_ride7\startup_stm32f10x_ld_vl.s
文件 10269 2011-03-10 10:52 STM32F103串口使用空闲IDLE中断接收不定长数据程序\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\startup\gcc_ride7\startup_stm32f10x_md.s
文件 11058 2011-03-10 10:52 STM32F103串口使用空闲IDLE中断接收不定长数据程序\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\startup\gcc_ride7\startup_stm32f10x_md_vl.s
文件 13261 2011-03-10 10:52 STM32F103串口使用空闲IDLE中断接收不定长数据程序\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\startup\gcc_ride7\startup_stm32f10x_xl.s
文件 16626 2011-03-10 10:53 STM32F103串口使用空闲IDLE中断接收不定长数据程序\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\startup\iar\startup_stm32f10x_cl.s
文件 16229 2011-03-10 10:53 STM32F103串口使用空闲IDLE中断接收不定长数据程序\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\startup\iar\startup_stm32f10x_hd.s
文件 15675 2011-03-10 10:53 STM32F103串口使用空闲IDLE中断接收不定长数据程序\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\startup\iar\startup_stm32f10x_hd_vl.s
文件 12650 2011-03-10 10:53 STM32F103串口使用空闲IDLE中断接收不定长数据程序\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\startup\iar\startup_stm32f10x_ld.s
文件 12950 2011-03-10 10:53 STM32F103串口使用空闲IDLE中断接收不定长数据程序\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\startup\iar\startup_stm32f10x_ld_vl.s
文件 12912 2011-03-10 10:53 STM32F103串口使用空闲IDLE中断接收不定长数据程序\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\startup\iar\startup_stm32f10x_md.s
文件 13601 2011-03-10 10:53 STM32F103串口使用空闲IDLE中断接收不定长数据程序\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\startup\iar\startup_stm32f10x_md_vl.s
文件 16628 2011-03-10 10:53 STM32F103串口使用空闲IDLE中断接收不定长数据程序\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\startup\iar\startup_stm32f10x_xl.s
文件 12604 2011-03-10 10:54 STM32F103串口使用空闲IDLE中断接收不定长数据程序\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\startup\TrueSTUDIO\startup_stm32f10x_cl.s
............此处省略133个文件信息
相关资源
- STM32F103RC+ADC+DMA多通道采样LCD显示
- I2C读写AT24C02 基于STM32F103 cube116540
- 基于stm32f103ve的程序——跑马灯实验
- STM32f103超声波模块例程
- stm32f103c8t6 4 oled.rar
- STM32F103 串口程序(完整版)
- STM32F103定时器中断程序
- [免费]基于stm32f103ze 的OLED驱动代码
- STM32F103RBT6驱动UC1698控制芯片的160160黑
- STM32F103 DS18B20 V3.5.0固件库驱动程序工
- STM32F103 CC2500完整驱动(模拟SPI)
- SX1280.rar
- STM32F103C8T6+NRF24l01无线通信
- MQTT+串口(usart)透传
- stm32f103.SchDoc
- STM32F103 USART+DMA
- 4_USART串口通信(空闲中断+DMA.zip
- stm32f105-usart-DMA收发demo
- 基于STM32F103C8单片机的晶联讯电子JL
- STM32F103实现OV7670摄像头显示
- STM32F103VCT6TR - High-density performance lin
- stm32f103 虚拟U盘,调试成功的
- 基于stm32F103vct6的SD卡FATFS文件系统移植
- FreeModbus_Slave+STM32F407+USART2代码亲测可
- STM32F103启动文件HD;MD
- 单片机串口printf函数自实现第二版
- 基于STM32F103的实时时钟程序,采用D
- STM32F103系列PWM输出应用之纸短情长音
- CP2102驱动WIN7、WIN10、32位、64位
- STM32F103移植FreeModbus实现modbus主机.zi
评论
共有 条评论