2010-06-24 01:36 AM
Hello i'm port uart2 polling receive data from hyperterminal it's ok. but i need use uart2 receive data with interrupt?
TIM3_DeInit(); TIM3_TimeBaseInit(TIM3_PRESCALER_1,0xFFFF); TIM3_ITConfig(TIM3_IT_UPDATE, ENABLE); enableInterrupts(); GPIO_Init(GPIOD, 0x01 , GPIO_MODE_OUT_PP_LOW_FAST); CLK_HSIPrescalerConfig(CLK_PRESCALER_HSIDIV1); UART2_DeInit(); UART2_Init((u32)9600, UART2_WORDLENGTH_8D, UART2_STOPBITS_1, UART2_PARITY_NO, UART2_SYNCMODE_CLOCK_DISABLE, UART2_MODE_TXRX_ENABLE); UART2_ClearITPendingBit(UART2_IT_RXNE); UART2_ITConfig(UART2_IT_IDLE, ENABLE); this code incorrect i don't know use function and see a register please help me2011-03-14 01:43 AM
UART2_ITConfig(UART2_IT_RXNE_OR, ENABLE);
2011-05-11 04:47 AM
I´m in doubt if I need to use the UART2_ClearITPendingBit() function after read a byte from UART2 Interruption routine, or the own read action clears the pending bit RXNE. I couldn´t find this information from RM0016 reference manual.
The code I´m using:
#ifdef _COSMIC_
@far @interrupt void UART2_RX_IRQHandler(void)
#else /* _RAISONANCE_ */
void UART2_RX_IRQHandler(void) interrupt 21
#endif /* _COSMIC_ */
{
// Read one byte from the receive data register
RxBuffer[RxCounter++] = UART2_ReceiveData8();
UART2_ClearITPendingBit(UART2_IT_RXNE_OR); // Does this function is necessary?
if(
RxCounter==128)RxCounter=0;
.
.
.
}
2011-05-11 08:45 AM
I´ve already tested here, that function is not necessary.