在线看毛片网站电影-亚洲国产欧美日韩精品一区二区三区,国产欧美乱夫不卡无乱码,国产精品欧美久久久天天影视,精品一区二区三区视频在线观看,亚洲国产精品人成乱码天天看,日韩久久久一区,91精品国产91免费

<menu id="6qfwx"><li id="6qfwx"></li></menu>
    1. <menu id="6qfwx"><dl id="6qfwx"></dl></menu>

      <label id="6qfwx"><ol id="6qfwx"></ol></label><menu id="6qfwx"></menu><object id="6qfwx"><strike id="6qfwx"><noscript id="6qfwx"></noscript></strike></object>
        1. <center id="6qfwx"><dl id="6qfwx"></dl></center>

            新聞中心

            EEPW首頁(yè) > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > STM32的串口配置(中斷方式)

            STM32的串口配置(中斷方式)

            作者: 時(shí)間:2013-04-10 來(lái)源:網(wǎng)絡(luò) 收藏

            的串口中斷配置,也是很簡(jiǎn)單的.

            首先是配置UART的GPIO口

            首先是配置UART的GPIO口

            /**********************************************

            * Name : UART1_GPIO_Configuration

            * Deion : Configures the uart1 GPIO ports.

            * Input : None

            * Output : None

            * Return : None

            **********************************************************/

            void UART1_GPIO_Configuration(void)

            {

            GPIO_InitTypeDef GPIO_InitStructure;

            // Configure USART1_Tx as alternate push-pull

            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);

            // Configure USART1_Rx as input floating

            GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10;

            GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;

            GPIO_Init(GPIOA, GPIO_InitStructure);

            }

            然后是配置串口參數(shù)

            /*******************************************************

            * Name : UART1_Configuration

            * Deion : Configures the uart1

            * Input : None

            * Output : None

            * Return : None

            *********************************************/

            void USART_Configuration(void)

            {

            USART_InitTypeDef USART_InitStructure;

            USART_ClockInitTypeDef USART_ClockInitStructure;

            Uart1_GPIO_Configuration();

            USART_ClockInitStructure.USART_Clock = USART_Clock_Disable;

            USART_ClockInitStructure.USART_CPOL = USART_CPOL_Low;

            USART_ClockInitStructure.USART_CPHA = USART_CPHA_2Edge;

            USART_ClockInitStructure.USART_LastBit = USART_LastBit_Disable;

            /* Configure the USART1 synchronous paramters */

            USART_ClockInit(USART1, USART_ClockInitStructure);

            USART_InitStructure.USART_BaudRate = 9600;

            USART_InitStructure.USART_WordLength = USART_WordLength_8b;

            USART_InitStructure.USART_StopBits = USART_StopBits_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;

            /* Configure USART1 basic and asynchronous paramters */

            USART_Init(USART1, USART_InitStructure);

            /* Enable USART1 Receive interrupts */

            USART_ITConfig(USART1, USART_IT_RXNE, ENABLE);

            /* Enable USART1 */

            USART_Cmd(USART1, ENABLE);

            }

            然后是在中斷設(shè)置,需要修改stm32f10x_it.c 中的串口中斷函數(shù) 并且需要修改void NVIC_Configuration(void)函數(shù)


            上一頁(yè) 1 2 下一頁(yè)

            關(guān)鍵詞: STM32 串口配置 中斷方式

            評(píng)論


            相關(guān)推薦

            技術(shù)專區(qū)

            關(guān)閉