Hi everyone, I am a assembly beginner and I am working on minor project required to use Mcp23s17. I also looked through its datasheet and my understand is that the interrupt could occur when there is a change in pin, can anyone please tell me step by step what I need to do to setup the interrupt for it.
Hi everyone, I am a assembly beginner and I am working on minor project required to use Mcp23s17. I also looked through its datasheet and my understand is that the interrupt could occur when there is a change in pin, can anyone please tell me step by step what I need to do to setup the interrupt for it.
Can I assume you have it connected to a micro??? The Mcp23s17 is an SPI device so controlled via this interface... There are registers to set inside for direction, pullup, and interrupt control.. These have to be done each time the Mcp23s17 is started...
This device has two 8 bit ports that can be used as a 16 bit port.. So there are two modes of operation.
In 8 bit mode all the registers are numerated 0x0 ~ 0xA on GPA and 0x10 ~ 0x1A on GPB.. But in 16 bit mode all the registers are sequential so you can update relevant registers in one go.
I write to two individual ports but sequentially ( makes it easier )... The IOCON is duplicated in both banks and this is the first register to modify.. Bit 7 controls the banks switching... The INTCONA and B control the interrupts on GPA and GPB you can set which pin triggers the interrupt, any or all can trigger an interrupt..
Lucky for you, there is an Arduino library redy to go..
Unfortunately, I'm not allowed to use any Arduino function in library, every single code line needs to be in assembly. For wiring, INTA(pin20) of Mcp23s17 is wired to PD3 Arduino. I knew that I have to set up the Mcp interrupt first, then do I need to set up anything else for Arduino?