jagadeeshvulava
Junior Member level 1
HI all,
I'm new one to ARM processors.....
I'm using stm32f103 processor for an embedded application.. i need to configure one IO pin in interrupt mode...
can any one help me to interface this to an external button on the board..
which register to be set to enable interrupts....
and how to check for interrupt occurrence ..
now i'm receiving data through USART in polling mode for that my code is like ............
how can i receive data in interrupt mode thourgh usart and how to get key status as external interrupt........
thank you in advance
I'm new one to ARM processors.....
I'm using stm32f103 processor for an embedded application.. i need to configure one IO pin in interrupt mode...
can any one help me to interface this to an external button on the board..
which register to be set to enable interrupts....
and how to check for interrupt occurrence ..
now i'm receiving data through USART in polling mode for that my code is like ............
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 void USART2_Configuration(void) { GPIO_InitTypeDef GPIO_InitStructure; USART_InitTypeDef USART_InitStructure; RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOA ,ENABLE); RCC_APB1PeriphClockCmd( RCC_APB1Periph_USART2,ENABLE); /* * USART1_TX -> PA2 , USART1_RX -> PA3 */ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_Init(GPIOA, &GPIO_InitStructure); GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_Init(GPIOA, &GPIO_InitStructure); USART_InitStructure.USART_BaudRate = 38400; 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; USART_Init(USART2, &USART_InitStructure); USART_ITConfig(USART2, USART_IT_RXNE, ENABLE); USART_ITConfig(USART2, USART_IT_TXE, ENABLE); USART_ClearFlag(USART2,USART_FLAG_TC); USART_Cmd(USART2, ENABLE); } void SendSerialData(unsigned char *CommandData, unsigned int CommandLength ) { unsigned int loopCounter = 0; for (loopCounter=0; loopCounter<CommandLength; loopCounter++) { USART_SendData(USART2, CommandData[loopCounter]); // wait untill data transmission complition while (USART_GetFlagStatus(USART2, USART_FLAG_TC) == RESET) {} } } void receiveCommandResponce(unsigned int recCount) { unsigned int loopCnt = 0; memset_local(USARTRecDataBuff, 0x00, 80); for (loopCnt=0;loopCnt<recCount; loopCnt++) { // wait untill data reception starts while (USART_GetFlagStatus(CAMERA_USART_PORT, USART_FLAG_RXNE) == RESET) {} USARTRecDataBuff[loopCnt] = USART_ReceiveData(USART2); } }
how can i receive data in interrupt mode thourgh usart and how to get key status as external interrupt........
thank you in advance
Last edited by a moderator: