
STM32F103ZET6单片机RS485通信实验软件源码.zip
5星
- 浏览量: 0
- 大小:None
- 文件类型:None
简介:
该文件包含针对STM32F103ZET6单片机进行RS485通信实验的完整软件源代码,适用于嵌入式系统开发人员和学生学习RS485通信协议。
STM32F103ZET6单片机RS485接口通信实验软件例程源码:
```c
void RS485_Init(u32 bound)
{
GPIO_InitTypeDef GPIO_InitStructure;
USART_InitTypeDef USART_InitStructure;
NVIC_InitTypeDef NVIC_InitStructure;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOG | RCC_APB2Periph_GPIOA, ENABLE); // 使能GPIOA\G时钟
RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART2, ENABLE); // 使能USART2时钟
/* 配置GPIO的模式和IO口 */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2; // TX-485,串口输出PA2
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; // 复用推挽输出
}
```
全部评论 (0)
还没有任何评论哟~


