2009-05-06 01:01 AM
2011-05-17 12:31 AM
Hi,
Can someone provide an example of UART communication using interrupts? Using Hyperterminal, I am sending data to my Keil ST ARM9 eval board and trying to implement the Receive Interrupt. The UART->RIS raw interrupt status register is behaving as expected. However, the UART->MIS masked interrupt status register has no activity even though UART->IMSC (RXIM bit) is enabled. Thanks for your help, kk2011-05-17 12:31 AM
Hi Kk ;-),
Here attached you will find an STR9 IAR project (as a draft) in which UART communication uses interrupts. I hope it will be useful for you. Regards Eris [ This message was edited by: eris on 04-08-2006 11:27 ]2011-05-17 12:31 AM
Thanks for your help.
Turns out I was initializing the UART again after I made all the settings. So I just moved one line up. Stupid mistake.2011-05-17 12:31 AM
hi Eris,
I've tryed your program that I found very interresting, However, the interupt occurs just ONCE, either in the transmit or the receive action. Moreover, by testing the main program and the handler, Ive found that after the first interupt the program gets stack inside of the handler, and never returns to the main program. Please is there any modification or suggestion for me that could help me solve my problem (maybe firmware version compatibility ??) thank you very much, best regardsCode:
// the handler <BR><BR>void UART0_IRQHandler(void) <BR><BR>{ <BR><BR> u8 i = 0, j = 0; <BR><BR> <BR><BR> /* Read 2 bytes from the receive FIFO */ <BR><BR> for(j = 0; j<16/*(j < 2) && (RxCounter < NbrOfDataToRead)*/; j++) <BR><BR> { <BR><BR> RxBuffer[RxCounter++] = UART_ReceiveData(UART0); <BR><BR> } <BR><BR> for (i= 0; i<16; i++) <BR><BR> { <BR><BR> UART_SendData(UART0, RxBuffer[i]+32); <BR><BR> } <BR><BR> <BR><BR> /* Clear the UART0 Receive interrupt */ <BR><BR> UART_ClearITPendingBit(UART0, UART_IT_Receive); <BR><BR> VIC1->VAR = 0; <BR><BR> // HERE I print something to the lcd to make sure it enters the <BR><BR> //interupt (and stays inside the handler) <BR><BR>} <BR><BR>
I'm using just a receive interupt, so I'm trying to receive - interupt - send reeived data[ This message was edited by: k.elhajjam on 06-05-2009 13:43 ]