tcpipchip, aqui esta a forma de como colocar na interrupção a uartx, no meu caso foi a uart1.
Esta no mikroc, porém esta muito simples usar em outras ides, porque as funções são bem simples de importar, dá uma olhadinha no manual. Mas qualquer dúvida estou a disposição para ajudar, dentro do meu conhecimento é claro.
cpp code
void InterruptRx() // A cada interrupção o registro Receive acolhe o dado:
iv IVT_INT_USART1 ics ICS_AUTO //RX interrupt subroutine
{
if(USART1_SRbits.RXNE == 1) //RX buffer not empty
{
Receive = (0xFF & USART1_DR); //Read data from data register
}
}
void ConfigSetup() // Referencia no manual stm f103
{
RCC_APB2ENRbits.IOPAEN = 1; //Enable GPIOA
RCC_APB2ENRbits.USART1EN = 1; //Enable USART1
GPIOA_CRH = 0x4A0; //Set PA9 and PA10 as AFIO pins
USART1_BRR = 0x341; //Set value for required baud rate
USART1_CR1bits.UE = 1; //Set USART1
USART1_CR1bits.RE = 1; //Set USART1 RX to receive incoming data
USART1_CR1bits.TE = 1; //Set USART1 TX to send data
USART1_CR1bits.RXNEIE = 1; //Enable RX interrupt
NVIC_IntEnable(IVT_INT_USART1);
}