您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 质量控制/管理 > STM32F103VET6-5个串口的配置
STM32F103VET6_5¸ö´®¿ÚµÄÅäÖÃ//*************************************************************¹Ü½Å¶¨Òå//*************************************************************/*UART1TXD*/GPIO_InitStructure.GPIO_Pin=GPIO_Pin_9;GPIO_InitStructure.GPIO_Speed=GPIO_Speed_50MHz;GPIO_InitStructure.GPIO_Mode=GPIO_Mode_AF_PP;GPIO_Init(GPIOA,&GPIO_InitStructure);/*UART1RXD*/GPIO_InitStructure.GPIO_Pin=GPIO_Pin_10;GPIO_InitStructure.GPIO_Mode=GPIO_Mode_IN_FLOATING;GPIO_Init(GPIOA,&GPIO_InitStructure);//*************************************************************/*UART2TXD*/GPIO_InitStructure.GPIO_Pin=GPIO_Pin_2;GPIO_InitStructure.GPIO_Speed=GPIO_Speed_50MHz;GPIO_InitStructure.GPIO_Mode=GPIO_Mode_AF_PP;GPIO_Init(GPIOA,&GPIO_InitStructure);/*UART2RXD*/GPIO_InitStructure.GPIO_Pin=GPIO_Pin_3;GPIO_InitStructure.GPIO_Mode=GPIO_Mode_IN_FLOATING;GPIO_Init(GPIOA,&GPIO_InitStructure);//*************************************************************/*UART3TXD*/GPIO_InitStructure.GPIO_Pin=GPIO_Pin_10;GPIO_InitStructure.GPIO_Speed=GPIO_Speed_50MHz;GPIO_InitStructure.GPIO_Mode=GPIO_Mode_AF_PP;GPIO_Init(GPIOB,&GPIO_InitStructure);/*UART3RXD*/GPIO_InitStructure.GPIO_Pin=GPIO_Pin_11;GPIO_InitStructure.GPIO_Mode=GPIO_Mode_IN_FLOATING;GPIO_Init(GPIOB,&GPIO_InitStructure);//*************************************************************/*UART4TXD*/GPIO_InitStructure.GPIO_Pin=GPIO_Pin_10;GPIO_InitStructure.GPIO_Speed=GPIO_Speed_50MHz;GPIO_InitStructure.GPIO_Mode=GPIO_Mode_AF_PP;GPIO_Init(GPIOC,&GPIO_InitStructure);/*UART4RX*/GPIO_InitStructure.GPIO_Pin=GPIO_Pin_11;GPIO_InitStructure.GPIO_Mode=GPIO_Mode_IN_FLOATING;GPIO_Init(GPIOC,&GPIO_InitStructure);//*************************************************************/*UART5TXD*/GPIO_InitStructure.GPIO_Pin=GPIO_Pin_12;GPIO_InitStructure.GPIO_Speed=GPIO_Speed_50MHz;GPIO_InitStructure.GPIO_Mode=GPIO_Mode_AF_PP;GPIO_Init(GPIOC,&GPIO_InitStructure);/*UART5RX*/GPIO_InitStructure.GPIO_Pin=GPIO_Pin_2;GPIO_InitStructure.GPIO_Mode=GPIO_Mode_IN_FLOATING;GPIO_Init(GPIOD,&GPIO_InitStructure);//*************************************************************Ìí¼ÓÖжÏ//*************************************************************/*´®¿Ú1½ÓÊÕÖжÏ*/NVIC_InitStructure.NVIC_IRQChannel=USART1_IRQChannel;NVIC_InitStructure.NVIC_IRQChannelSubPriority=0;NVIC_InitStructure.NVIC_IRQChannelCmd=ENABLE;NVIC_Init(&NVIC_InitStructure);/*´®¿Ú2½ÓÊÕÖжÏ*/NVIC_InitStructure.NVIC_IRQChannel=USART2_IRQChannel;NVIC_InitStructure.NVIC_IRQChannelSubPriority=0;NVIC_InitStructure.NVIC_IRQChannelCmd=ENABLE;NVIC_Init(&NVIC_InitStructure);/*´®¿Ú3½ÓÊÕÖжÏ*/NVIC_InitStructure.NVIC_IRQChannel=USART3_IRQChannel;NVIC_InitStructure.NVIC_IRQChannelSubPriority=0;NVIC_InitStructure.NVIC_IRQChannelCmd=ENABLE;NVIC_Init(&NVIC_InitStructure);/*´®¿Ú4½ÓÊÕÖжÏ*/NVIC_InitStructure.NVIC_IRQChannel=UART4_IRQChannel;NVIC_InitStructure.NVIC_IRQChannelSubPriority=0;NVIC_InitStructure.NVIC_IRQChannelCmd=ENABLE;NVIC_Init(&NVIC_InitStructure);/*´®¿Ú5½ÓÊÕÖжÏ*/NVIC_InitStructure.NVIC_IRQChannel=UART5_IRQChannel;NVIC_InitStructure.NVIC_IRQChannelSubPriority=0;NVIC_InitStructure.NVIC_IRQChannelCmd=ENABLE;NVIC_Init(&NVIC_InitStructure);//*************************************************************
本文标题:STM32F103VET6-5个串口的配置
链接地址:https://www.777doc.com/doc-7026218 .html