2012-07-06 07:52 AM
2012-07-06 01:06 PM
You'd need to use UART4_IRQHandler() unless you reworked the vector table.
You can't keep calling USART_ReceiveData(), when RXNE signals/interrupts there is ONE character available. This is not valid C, 'if(buff== ''abc'')', strcmp() would also need a NUL terminated string.2012-07-06 10:18 PM
hello clive,
Thank for your reply.i usedUART4_IRQHandler() like:
#define USARTx_IRQHANDLER UART4_IRQHandler in stm32f4xx_it.ci can able to get a single character using interrupt.CODE:uint8_t ab;
ab=(USART_ReceiveData(UART4) & 0x7F);
if (ab=='a') //i get the character from uart interrupt and compare with ' a' character. { //do some thing }this coding is properly working...but i need to receive the string in if loop and do something in that loop.how i can get the string using uart interrupt.it can or can't working?????????????any help2012-07-07 03:41 AM
but i need to receive the string in if loop and do something in that loop. how i can get the string using uart interrupt.it can or can't working?
You'd need to accumulate characters, and/or use a state machine, and when you have enough characters to perform a specific test do it a that point. What you don't want to do in an interrupt is dwell in a while() loop waiting for other things to happen. Do your work quickly, and in a linear flow, and leave.2012-07-09 11:21 AM
''This is not valid C, 'if(buff== ''abc'')'''
Yes, itis
valid 'C' - but almost certainly not what the OP intended!2012-07-09 01:04 PM
Valid in that it compiles, Invalid in that it will never* work.
* I could construct an example that might ''work'' with specific compilers or settings, such that the pointers have the same address, but this condition wouldn't come close to the desired function as expressed by the OP. ''not viable'' might have been a better choice of words.2012-07-09 01:17 PM
''Valid in that it compiles''
Indeed.'''not viable' might have been a better choice of words'' Yes.It is a common beginner's mistake to assume that an absence of build errors means that the code must ''work''...