MCP23017 IO expander interrupt on change to LOW

Dear all

I'm using 4 MCP23017 to read many hall sensor by interrupt. Currently I configured MCP23017 to "interrupt on change" so every time a hall sensor change state I receive an interrupt.
But I want to receive interrupt only when output of one of hall sensors goes LOW (and do not receive interrupt when it goes HIGH again)!

I tried to change configuration to use "DEFVAL" (compare pin state against "default value" instead of previous pin state), but the problem is that in this condition if output of one of sensors goes LOW I receive interrupt all the time that this pin is LOW (not only on the change situation).

Is it possible to do so with MCP configuration or I have to manage it directly in the code.

I may be wrong but a quick look at the datasheet implies that a pin change interrupt on the MCP23017 is either edge of level triggered. I couldn't see an option to choose which edge triggered an interrupt.

I would stick with edge triggered and handle the "unwanted" interrupt in your code.

markd833:
I may be wrong but a quick look at the datasheet implies that a pin change interrupt on the MCP23017 is either edge of level triggered. I couldn't see an option to choose which edge triggered an interrupt.

I would stick with edge triggered and handle the "unwanted" interrupt in your code.

The datasheet shows to different method for triggering interrupts:
1.when ever pin state changes (for example if pin A.0 change from high to low or low to high)
2.when ever pin state become opposite of preset value (DEFVAL) in a register

My problem is that in second method if default value is HIGH, then when pin state become LOW it sends interrupts continuously but I need to receive only one interrupt even if I clear interrupt by reading port value.

That's what the datasheet implies. If you choose a level, then as long as that level is not met, the chip will generate interrupts until the level is met.

At least with edges (aka state change), you will only get 2 interrupts.

Either handle the extra interrupts or choose an alternative device.