user28707: Is there a way to write a custom function which would be the mode/reason to trigger an interrupt. I have an analog joystick connected to my arduino analog pin. It reads a value of 689 on one end and 0 on the other and around 480 in the center. I would like to trigger an interrupt based on these value changes i.e an interrupt when it  more then 600 and another when less then 10. None of the pre-defined modes RISING,HIGH,LOW,FALLING,CHANGE are working satisfactorily. 

user4143: No. Interrupts are hardware. You cannot "create" interrupts in software.
The closes there is to what you are after is the Analog Comparator (see section 27 of the datasheet).
The analog comparator allows you to trigger an interrupt if a voltage is above (or below) a reference voltage which is up to you to provide.
For anything more complex you would need to use external comparators to trigger on different voltage levels which then trigger external INT pins on the ATMega.

user41250: Of course, you can make software interrupts on Arduino; it just costs a hardware pin. The following is a quote from the Atmel ATmega48A/PA/88A/PA/168A/PA/328/P datasheet:
"13. External Interrupts
The External Interrupts are triggered by the INT0 and INT1 pins or any of the PCINT23...0 pins. Observe that, if enabled, the interrupts will trigger even if the INT0 and INT1 or PCINT23...0 pins are configured as outputs. This feature provides a way of generating a software interrupt."
You set up an interrupt on the pin you select for the purpose, you set the pin as output, and then you trig your "software interrupt" by writing a value to the pin.

28707: <p>Is there a way to write a custom function which would be the mode/reason to trigger an interrupt. I have an analog joystick connected to my arduino analog pin. It reads a value of 689 on one end and 0 on the other and around 480 in the center. I would like to trigger an interrupt based on these value changes i.e an interrupt when it  more then 600 and another when less then 10. None of the pre-defined modes RISING,HIGH,LOW,FALLING,CHANGE are working satisfactorily. </p>
 4143: <p>No. Interrupts are hardware. You cannot "create" interrupts in software.</p>

<p>The closes there is to what you are after is the Analog Comparator (see section 27 of <a href="http://www.atmel.com/Images/Atmel-42735-8-bit-AVR-Microcontroller-ATmega328-328P_datasheet.pdf" rel="nofollow noreferrer">the datasheet</a>).</p>

<p>The analog comparator allows you to trigger an interrupt if a voltage is above (or below) a reference voltage which is up to you to provide.</p>

<p>For anything more complex you would need to use external comparators to trigger on different voltage levels which then trigger external INT pins on the ATMega.</p>
 41250: <p>Of course, you can make software interrupts on Arduino; it just costs a hardware pin. The following is a quote from the Atmel ATmega48A/PA/88A/PA/168A/PA/328/P datasheet:</p>

<p>"13. External Interrupts
The External Interrupts are triggered by the INT0 and INT1 pins or any of the PCINT23...0 pins. Observe that, if enabled, the interrupts will trigger even if the INT0 and INT1 or PCINT23...0 pins are configured as outputs. This feature provides a way of generating a software interrupt."</p>

<p>You set up an interrupt on the pin you select for the purpose, you set the pin as output, and then you trig your "software interrupt" by writing a value to the pin.</p>
