This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

comparator issues

hi, i'm trying to make the comparator works, following the soc userguide, my code is the following:

void comphandler(void)
{
  GPIOPinIntClear(GPIO_A_BASE,GPIO_PIN_5);
  GPIOPinWrite(GPIO_B_BASE,GPIO_PIN_5,0xff);
}



int
main(void)
{


    SysCtrlClockSet(false, false, SYS_CTRL_SYSDIV_32MHZ);


	
    SysCtrlIOClockSet(SYS_CTRL_SYSDIV_32MHZ);
     

	 
    
    HWREG(0x400D9710) |= 0x20;    	// set PAIEN5 
    HWREG(0x400D9704) |= 0x0;		//PAIRC5=0 : rising edge interrupt
    
    
    

    HWREG(0x400D7024) |= 0x02;		//enable comparator
    HWREG(IOC_PA5_OVER) |= 0x01;	//set PA5 analog
    HWREG(IOC_PA4_OVER) |= 0x01;	//set PA4 analog
   
   
    IntMasterEnable();
	IntEnable(INT_GPIOA);
	
    GPIOPinWrite(GPIO_B_BASE,GPIO_PIN_5,0);

	
    while(1)
    {

	
    }
}


it's a one shot function,just to see if the interrupt works.
but i have no response, i use pa4 as reference pin and have a trimmer on pa5.

thanks!

  • Hi Giuseppe,

    Did you register the interrupt handler? A proper interrupt handler needs to be registered to process an interrupt. You can find some examples of interrupt handler registration in the foundation software. Please search the foundation software project for GPIOPortIntRegister.

    - Cetri