ok so I think I did what u meant, and it didn't work, so I overdid it for good measure and it didn't work

/*MAIN LOOP*/
int main(void)
{
OSCFRQ=0b010; // OSCFRQ(HFFRQ0-2) SET OSCILLATOR TO 4MHz
TRISAbits.TRISA0=0; // TRISA0(RA0) BIG LIGHT DRIVE, OUTPUT
TRISAbits.TRISA1=0; // TRISA1(RA1) SMALL LIGHT DRIVE, OUTPUT
TRISAbits.TRISA2=1; // TRISA2(RA2) ANALOG POT, INPUT
TRISAbits.TRISA4=1; // TRISA4(RA4) BIG LIGHT SWITCH, INPUT
TRISAbits.TRISA5=1; // TRISA5(RA5) SMALL LIGHT SWITCH, INPUT
ANSELAbits.ANSA2=1; // ANSELA2(ANSA2) ANALOG POT, INPUT ANALOG
CCP1PPSbits.CCP1PPS=0b00000; // BIG LIGHT DRIVER (PWM->RA4), OUTPUT
CCP2PPSbits.CCP2PPS=0b00001; // SMALL LIGHT DRIVER (PWM->RA5), OUTPUT
ADCON0bits.CHS=0b000010; // ANALOG CHANNEL SELECTION BITS (RA2)
ADCON1bits.ADCS=0b111; // ADC COVERSION CLOCK SELECTION BITS (ADCRC)
ADCON0bits.ADON=1; // ANALOG CHANNEL SELECTION BITS (ADCON HIGH)
ADCON1bits.ADPREF=0b00; //ADC POSITIVE VOLTAGE REFRENCE CONFIGRATION bits (VREF+ IS VDD)
ADCON1bits.ADFM=1; // ADC RESULT FORMAT SELECTION BITS (RIGHT JUSTIFIED)
PIE0bits.IOCIE=1;//INTERUPT-ON-CHANGE ENABLE BIT IS SET
IOCANbits.IOCAN4=1;//INTERUPT-ON-CHANGE PORTA (RA4) NEGATIVE EDGE TRIGGERED
IOCANbits.IOCAN5=1;//INTERUPT-ON-CHANGE PORTA (RA5) NEGATIVE EDGE TRIGGERED
while(1)
{
BIG_SW=PORTAbits.RA4; //READ RA4 AND ASSIGN IT TO BIG_SW
SMALL_SW=PORTAbits.RA5; //READ RA5 AND ASSIGN IT TO SMALL_SW
while(BIG_SW==1||SMALL_SW==1)
{
PMD1bits.TMR2MD=0b0; // TIMER2 MOUDLE ENABLED
T2CONbits.CKPS=0b000; //TIMER2 PRESCALER SET TO 1:1
T2CONbits.OUTPS=0b0000; //TIMER2 POST-SCALER SET TO 1:1
T2PRbits.T2PR=0b01100011; // PR2 REGESTER SET TO 99
T2CLKCONbits.CS=0b0011; // TIMER2 CLOCK SOURCE SELECT BIT (HFINTOSC)
CCP1CONbits.CCP1FMT=1; //CCPW PULSE WIDTH Alignment bit (RIGHT JUSTIFIED)
CCP1CONbits.CCP1MODE=0b1111; // MODE IS SET TO PWM
CCP2CONbits.CCP2FMT=1; //CCPW PULSE WIDTH Alignment bit (RIGHT JUSTIFIED)
CCP2CONbits.CCP2MODE=0b1111; // MODE IS SET TO PWM
if(BIG_SW==1)
{
BIG_SW=PORTAbits.RA4; //READ RA4 AND ASSIGN IT TO BIG_SW
SMALL_SW=PORTAbits.RA5; //READ RA5 AND ASSIGN IT TO SMALL_SW
ADC_RESULT();
CCPR1=RESULT;
PIR4bits.TMR2IF=0b0;
T2CONbits.T2ON=0b1;
}
if(SMALL_SW==1)
{
BIG_SW=PORTAbits.RA4; //READ RA4 AND ASSIGN IT TO BIG_SW
SMALL_SW=PORTAbits.RA5; //READ RA5 AND ASSIGN IT TO SMALL_SW
ADC_RESULT();
CCPR2=RESULT;
PIR4bits.TMR2IF=0b0;
T2CONbits.T2ON=0b1;
}
}
}
}
I tried all combinations of the main loop and the subloops but it didn't work, I even got a new chip just to check I am not crazy and it doesn't seem to work

just as a form of sanity check, I went and removed the ccp and ADC stuff and just used the LATx register to output a high if its corresponding switch is high and it still didn't work
so just to check that my chip isn't dead or something, I got a new one and tried it out and it didn't work with and without the trimmed code

so I trimmed the whole program down to a just blink a led at lata0 and it finally worked

at this point, I have to follow an empirical approach, so I rewrote my program around the functioning blink program...
so here is a rundown of all the code that seems to be screwing with the operation of the code:
1)
OSCFRQ =0b010; // OSCFRQ(HFFRQ0-2) SET OSCILLATOR TO 4MHz
apparently, this code seems to slow down the CPU for some reason so I fixed it by increasing the clock:
OSCFRQ =0b101; // OSCFRQ(HFFRQ0-2) SET OSCILLATOR TO 16MHz
I also add a #define _XTAL_FREQ 4000000 to make the delay function work and will be removed later...
2)
reading and updating big switch, however, proved to be annoyingly difficult, I tried to do it inside the main loop, outside the main loop, in one IOC ISR, in two sperate IOC ISR, to the point of absolute insanity

at this point I admit couldn't conditionally toggle a GPIO on or off if my life depended on it

3)
for both the ccp and ADC sanity check I had to rely on some conditional statement and let's just say that didn't go very well
