UART Interrupt on dsPIC33

General discussion on mikroC PRO for dsPIC30/33 and PIC24.
Post Reply
Author
Message
dcggames
Posts: 60
Joined: 09 Apr 2013 23:54

UART Interrupt on dsPIC33

#1 Post by dcggames » 17 Jun 2013 17:50

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?

User avatar
marina.petrovic
Posts: 2986
Joined: 18 Apr 2013 08:11

Re: UART Interrupt on dsPIC33

#2 Post by marina.petrovic » 19 Jun 2013 09:29

Hi,

I believe I have answered you on the support desk.

Best regards,
Marina

farhan
Posts: 2
Joined: 04 Nov 2021 07:03

Re: UART Interrupt on dsPIC33

#3 Post by farhan » 04 Nov 2021 12:55

Hello Merina, can you please help me with the same problem?

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: UART Interrupt on dsPIC33

#4 Post by filip » 05 Nov 2021 09:49

Hi,

Can you please explain your issue in details ?

Regards,
Filip.

ebimoein
Posts: 1
Joined: 19 Dec 2021 14:28

Re: UART Interrupt on dsPIC33

#5 Post by ebimoein » 20 Dec 2021 07:13

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){

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

Post Reply

Return to “mikroC PRO for dsPIC30/33 and PIC24 General”