Hello!
So I am programming a VEX controller for a autonomous car using MPLAB. I have line sensors connected to Interrupts 1 and 2 . My aim is to move the car backwards as soon as an interrupt is triggered. For this, I wrote an interrupt handler routine like this:
void edge_right (int x)
{
for (i = 0; i<50; i++)
{
pwm03 = 177;
pwm07 = 77;
printf(“yellow 1\n”); //for checking
}
}
with the calling being :
if (INTCON3bits.INT2IF && INTCON3bits.INT2IE) /* The INT2 pin is RB2/DIG I/O 1. */
{ edge_right(1);
INTCON3bits.INT2IF = 0;
}
I have already enabled the interrupts from the main code.
What is happening is that the interrupt is triggered - I know because i get the “yellow 1” on screen but the motors do not seem to respond.
Is there something extra that one has to do to control the pwm through the Interrupts?