2019-09-14 03:10 AM
when program started interrupt is called but its read only one character and repeatedly read same character.most time getting garbage value.
RXNE Flag also set. my application is to handle data send by ATMEGA16 in while condition.
program:
void USART2_IRQHandler(void)
{
//Local variable
unsigned char data=0,i=0;
unsigned char TEMP[5];
if(USART_GetITStatus(USART2, USART_IT_RXNE) != RESET)
{
data = USART2->DR;
if(i<5)
{
TEMP[i]=data;
i++;
}
}
}
2019-09-14 04:31 AM
The holding buffer and index presumably need to be static variables.
Auto variables will hold junk from the stack.
2019-09-17 10:00 PM
yes now its work.but sometime i got single character