Can You Use External Interrupts And Pin Change Interrupts Within The Same Register?
How two external interrupts tin can trigger same ISR.
Hallo,
My PIC is dsPIC33ep512mu810.
I want to generate an interrupt from either pivot RD7 or RD13, which should trigger an ISR.
For external interrupt, i am using INT1. But how tin can I map INT1 interrupt source to either RD7(RP71=RD7) or RD13(RPI77=RD13)?
my code follows................................
_TRISD6 = i;//s3 an input(ane=input, 0=output)
_TRISD13 = one;//s4 an input
ANSELD=0b1101111100111111;//s6,s7,s13 are now digital:0-Digital, 1-Analog
RPINR0bits.INT1R =0b1000111;//RP71=RD7 source of interrupt
RPINR0bits.INT1R =0b1001101;//RPI77=RD13 source of interrupt
INTCON2bits.INT1EP = ane;//0 = Interrupt on positive border
INTCON2bits.GIE = 1;//1 = Interrupts and associated IE bits are enabled
//----------------------------------------------------------------------
IFS1bits.INT1IF = 0; /*Reset INT1 interrupt flag */
IEC1bits.INT1IE = one; /*Enable INT1 Interrupt Service Routine */
IPC5bits.INT1IP = ane; /*set depression priority*/
//---------------------------------------------------------------------
//_INT1Interrupt() is the INT1 interrupt service routine (ISR).
void __attribute__((__interrupt__, auto_psv)) _INT1Interrupt(void)
{
if(IFS1bits.INT1IF ==1)
{
}
}
Re: How ii external interrupts tin can trigger same ISR. 2017/04/08 xiii:43:41 (permalink)
Your mapping would be expert enough, but you can have only i agile at whatsoever time - I believe, am nost sure-certain.
Is your code running? What do you see?
Re: How ii external interrupts can trigger same ISR. 2017/04/08 13:46:10 (permalink)
You need to apply either CN interrupt or two different INT interrupts.
Re: How two external interrupts can trigger same ISR. 2017/04/08 13:55:46 (permalink)
Where's the problem?
Where required' each of the ii ISRs could deliver the 'immediate ISR framework' (entry/go out code), and so calling a common subroutine.
On the vivid side: where necessary, it is easy to pass the interrupt source equally some parameter to the subroutine.
mail service edited past du00000001 - 2017/04/08 16:05:20
Re: How 2 external interrupts can trigger same ISR. 2017/04/08 14:18:58 (permalink)
The code is running just it is taking just one external interrupt RD13.
My idea here is to check the modify(of the signal) coming Channel A and Channel B of the encoder.
They should trigger the same interrupt service routine.
Please suggest with some code..?
Re: How 2 external interrupts can trigger same ISR. 2017/04/08 14:33:43 (permalink)
Re: How 2 external interrupts tin can trigger same ISR. 2017/04/08 15:04:09 (permalink)
CinziaG
Oh sorry, nosotros are back to the same square![]()
http://world wide web.microchip.com/forums/m982112.aspxyeah...same square.sad:
![]()
http://www.microchip.com/forums/FindPost/347254
Can you lot delight explicate me in in a higher place link, how to assign my two digital inputs(RD7 and RD13) to create interrupt.
Delight note- I am a beginner. and Delight answer it by writing ii/3 lines of code.
I am using dsPIC33E and I could not notice the way to assign my digital inputs to Movie in the higher up method(link) which yous propose repeatedly.
Re: How 2 external interrupts can trigger same ISR. 2017/04/08 fifteen:05:33 (permalink)
Something seems fishy here:
RPINR0bits.INT1R =0b1000111;//RP71=RD7 source of interrupt
RPINR0bits.INT1R =0b1001101;//RPI77=RD13 source of interrupt
You could use 2 Schottky diodes to "OR" the low-going transitions from phase A and phase B to trigger the hardware interrupt, and and then read digital inputs to see if the change was A or B. Might also need a capacitor or ii as transition detectors. But if the inputs can be configured for IOC, the hardware interrupt pins would not be needed.
Re: How 2 external interrupts can trigger aforementioned ISR. 2017/04/08 16:47:34 (permalink)
It is absolutely normal and prophylactic to map more than one RPn pins to the same INTx input. So no Shottky-shmottky is needed at all.
Re: How ii external interrupts tin can trigger same ISR. 2017/04/08 17:24:54 (permalink)
MBedder
Information technology is absolutely normal and safe to map more i RPn pins to the aforementioned INTx input.
Not really. Yous can connect multiple INTs to a single input, but you cannot drive the same INT with multiple pins at the aforementioned time.
Re: How 2 external interrupts tin can trigger same ISR. 2017/04/09 01:21:44 (permalink)
Interesting. Well, allow me know when you discover the truth
Re: How ii external interrupts tin trigger same ISR. 2017/04/13 05:43:10 (permalink)
"Channel A and Aqueduct B of the encoder."
If this is a rotary encoder, you but need ane irq for the clock.
Read B for the change from last to get the direction.
I use Change Notify.
Re: How 2 external interrupts can trigger aforementioned ISR. 2017/04/13 05:57:36 (permalink)
From the spec sheet (dsPIC33EPXXX(GP/MC/MU)806/810/814 and PIC24EPXXX(GP/GU)810/814):
2: Every I/O port pin (RAx-RGx) can be used as modify notification (CNAx-CNGx). Run into Section xi.0 "I/O Ports" for more data.
Employ the change notification interrupt for each input. Then test the A/B inputs inside the CNInterrupt routine. Decode every bit has been explained in many references pointed out here.
Vince
Can You Use External Interrupts And Pin Change Interrupts Within The Same Register?,
Source: https://www.microchip.com/forums/m984880.aspx
Posted by: martinezshough.blogspot.com
0 Response to "Can You Use External Interrupts And Pin Change Interrupts Within The Same Register?"
Post a Comment