sdecorme
Newbie level 5
- Joined
- Jun 20, 2013
- Messages
- 9
- Helped
- 1
- Reputation
- 2
- Reaction score
- 1
- Trophy points
- 1,283
- Location
- FRANCE
- Activity points
- 1,352
Hi,
I try to capture aPWM coming on my Int1 pin of my PIC32MX695F512H
when I use this code the interrupt make toggling the led at the right frequency,
but after the first interrupt my main loop crash and never loop again .
Any ideas ?
void Initialize(void)
{
mInit();
OpenTimer23(T2_ON | T2_32BIT_MODE_ON | T2_PS_1_1, 4000000000);
ConfigIntCapture1(IC_INT_ON | IC_INT_PRIOR_6 |IC_INT_SUB_PRIOR_3);
OpenCapture1(IC_INT_1CAPTURE | IC_CAP_32BIT | IC_TIMER2_SRC | IC_EVERY_EDGE |IC_ON );
INTEnableSystemMultiVectoredInt();
mIC1ClearIntFlag();
Vitesse=0;
}
// Input capture interrupt handler
void __ISR(_INPUT_CAPTURE_1_VECTOR, IPL6SRS) InputCapture_Handler(void)
{
mLED_5_Toggle();
mPORTDClearBits(BIT_2);
mIC1ClearIntFlag();
while(!mIC1CaptureReady());
Vitesse = mIC1ReadCapture();
}
Thanks
I try to capture aPWM coming on my Int1 pin of my PIC32MX695F512H
when I use this code the interrupt make toggling the led at the right frequency,
but after the first interrupt my main loop crash and never loop again .
Any ideas ?
void Initialize(void)
{
mInit();
OpenTimer23(T2_ON | T2_32BIT_MODE_ON | T2_PS_1_1, 4000000000);
ConfigIntCapture1(IC_INT_ON | IC_INT_PRIOR_6 |IC_INT_SUB_PRIOR_3);
OpenCapture1(IC_INT_1CAPTURE | IC_CAP_32BIT | IC_TIMER2_SRC | IC_EVERY_EDGE |IC_ON );
INTEnableSystemMultiVectoredInt();
mIC1ClearIntFlag();
Vitesse=0;
}
// Input capture interrupt handler
void __ISR(_INPUT_CAPTURE_1_VECTOR, IPL6SRS) InputCapture_Handler(void)
{
mLED_5_Toggle();
mPORTDClearBits(BIT_2);
mIC1ClearIntFlag();
while(!mIC1CaptureReady());
Vitesse = mIC1ReadCapture();
}
Thanks