Page 1 of 1

UART Interrupt on dsPIC33

Posted: 17 Jun 2013 17:50
by dcggames
Hi all,

I'm struggling with the UART Rx interrupt on the dsPIC33EP512MU810.

The PPS code:

Code: Select all

PPS_Mapping(101, _OUTPUT, _U1TX);              // Sets pin RP101 to be Output, and maps U1TX to it
PPS_Mapping(100, _INPUT,  _U1RX);              // Sets pin RP100 to be Input, and maps U1RX to it
The Init code:

Code: Select all

UART1_Init(9600);
delay_ms(100);
       
U1STAbits.URXISEL = 0;                              //Enable Rx interrupt
       
q = 32;
The ISR:

Code: Select all

void UART1_Interrupt() iv IVT_ADDR_U1RXINTERRUPT {
      LATA = 0x0000;
      uart_rd[LoopVar1] = UART1_Read();
      LoopVar1++;
      if (LoopVar1 >= q)
      {
       LoopVar1 = 0;
       ready = 1;
      }
    U1RxIF_bit = 0;
}
I'm using the LATA to check if I've reach that stage in the code. And depending on that, I conclude
that no interrupt is happening upon receiving an array of data.

Transmitting data seems to work fine.

What am I missing here?

Re: UART Interrupt on dsPIC33

Posted: 19 Jun 2013 09:29
by marina.petrovic
Hi,

I believe I have answered you on the support desk.

Best regards,
Marina

Re: UART Interrupt on dsPIC33

Posted: 04 Nov 2021 12:55
by farhan
Hello Merina, can you please help me with the same problem?

Re: UART Interrupt on dsPIC33

Posted: 05 Nov 2021 09:49
by filip
Hi,

Can you please explain your issue in details ?

Regards,
Filip.

Re: UART Interrupt on dsPIC33

Posted: 20 Dec 2021 07:13
by ebimoein
hi all
i have same problem,uart interrupt doesnt work.... :( :( :(
even the led does not turn on that i sure interrupt works well.
(i can receive data with uart in normal mode without interrupt .)
can you please help me ?


/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//void uart_interrupt() org 0x000026 {
// or
void uar1_interrupt() iv IVT_ADDR_U1RXINTERRUPT {
U1RXIF_bit=0;
PORTD.F3=1; // led on
UART1_Write_Text("Start");
}



void main() {
TRISD.F3=0; //OUTPUT PORTD.3 ==> led
UART1_Init(9600);
IPC2 = IPC2 | 0x0010; // Interrupt priority level = 1
U1RXIF_bit = 0; // ensure interrupt not pending IFS0 |=0X0200;
U1RXIE_bit = 1; // enable intterupt IEC0|= 0X0200;

while(1){

}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////