SneaKSz
Member
Hi all,
Im facing a stupid problem, I'm able to initialise my I2C IO expander :MCP23008 (https://www.electro-tech-online.com/custompdfs/2011/02/21919d.pdf) .
I'm unable to get an interrupt, but I"m able to set different ports high and low. I cant find the fault.
I want to have an interrupt when an input change from state ( port 7->4). As you can see in the code , Ive set them as input , enabled the interrupts. But the interrupt is always high, and Ive set it as active HIGH , so there is always an interrupt.
Hopefully someone can help me with this problem !
!
My I2C pulses are correct !
Hopefully someone can help me !
With kind regards
Im facing a stupid problem, I'm able to initialise my I2C IO expander :MCP23008 (https://www.electro-tech-online.com/custompdfs/2011/02/21919d.pdf) .
I'm unable to get an interrupt, but I"m able to set different ports high and low. I cant find the fault.
I want to have an interrupt when an input change from state ( port 7->4). As you can see in the code , Ive set them as input , enabled the interrupts. But the interrupt is always high, and Ive set it as active HIGH , so there is always an interrupt.
Hopefully someone can help me with this problem !
Code:
void main(void){
init();// setup
Delay10KTCYx(300);// wait 333ms startup GPIO
while(1){
SendByte(0x40,GPIO,0xF0);
Delay10TCYx(1);
SendByte(0x40,IOCON,0b00110010); // active high
Delay10TCYx(1);
SendByte(0x40,IODIR,0xF0); //WriteAddress iodir , high nibble input
Delay10TCYx(1);
SendByte(0x40,INTCON,0xF0); // compare to def val
Delay10TCYx(1);
SendByte(0x40,DEFVAL,0xF0);// def val to compare
Delay10TCYx(1);
SendByte(0x40,IPOL,0x00); // same pol
Delay10TCYx(1);
SendByte(0x40,GPPU ,0xFF);
Delay10TCYx(1);
SendByte(0x40,GPINTEN,0xF0); // enable input pin for inter on change
}
while(1);
My I2C pulses are correct !
Hopefully someone can help me !
With kind regards
Last edited: