External Interrupt trigger on rising and falling edges?

Post your requests and ideas on the future development of mikroC for dsPIC30/33 and PIC24.
Post Reply
Author
Message
Bob Shankle
Posts: 10
Joined: 30 Dec 2007 16:44

External Interrupt trigger on rising and falling edges?

#1 Post by Bob Shankle » 08 Apr 2008 02:27

Hi,

I'm new to this and have search everywhere but can't seem to configure INT0 so that it triggers an interrupt (0x14) on both the rising and falling edges. (It forces me to choose one or the other can't find how to choose both.) :(

I am using EASYdsPIC4 as my development board, and the dsPIC30F4013 chip.

Here is my initialization proceedure:

Code: Select all

void initialize_interrupts(void)
{ 
   LATF = 0xFFFF;
   TRISF = 0;

////    SETUP TIMER INTERRUPT
    IPC0   = IPC0 | 0x1000;   // Interrupt priority level = 1
     IFS0   = IFS0 & 0xFFF7;   // Clear TMR1IF
     IEC0   = IEC0 | 0x0008;   // Enable Timer1 interrupts

    T1CON = 0x8030;//0x8000;

   IEC0.F0 = 1; // Enable Ext 0 interrupts
   INTCON2.F0 = 1;    // Exint0 negative edge

 Delay_ms(100);

}
Any hints or suggestions are greatly appreciated!

thanks,
Bob

jpc
Posts: 1986
Joined: 22 Apr 2005 17:40
Location: France 87

#2 Post by jpc » 08 Apr 2008 07:29

The INTx inputs are edge-sensitive by nature , if you need interrupt on any change you should use Input Change interrupt on one of the CNx inputs.
You might have a look at the Input Change Notification Module in the datasheet of the 30F4013

Bob Shankle
Posts: 10
Joined: 30 Dec 2007 16:44

#3 Post by Bob Shankle » 08 Apr 2008 10:59

Thank you!
Bob

SmartShadow
Posts: 14
Joined: 27 Nov 2007 12:30

#4 Post by SmartShadow » 20 Aug 2008 20:41

Hello :D

Instead using that pin for external interrupt, try using one of the INPUT CAPTURE pins configured as u want. As u can see in the MCU datasheet u can configure the triggering signal by the rising edge or by the falling one.
As a tip, don't chose for ICM<2:0>(ICxCON): Input Capture Mode Select bits
111 = Input Capture functions as interrupt pin only, when device is in Sleep or Idle mode this option ;).

Happy coding :D

Post Reply

Return to “mikroC for dsPIC30/33 and PIC24 Wish List”