View previous topic :: View next topic |
Author |
Message |
Sterngleiter
Joined: 07 Jan 2013 Posts: 90
|
MCP 23017 interrupt on change |
Posted: Sun Dec 30, 2018 5:59 am |
|
|
hello, i would like to use i2c mcp23017. porta as output and portb as input. somehow I can not do that for portb interrupt. I sat down Gppub 0xff , gpintenb 0xff and intconb 0xff. It’s Not Running. The interrupt comes one times from high to low and Thema is bus in trouble. I have already worked with the mcp23s17. it was there. What is wrong? |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9121 Location: Greensville,Ontario
|
|
Posted: Sun Dec 30, 2018 6:20 am |
|
|
OK, we need a LOT more information !
While I've never used that I2C device (I use 'big' PICs), some questions for you...
What PIC are you using ?
Which Compiler and version ?
What 'driver' are you using ?
What pullups are on the I2C bus and the INT lines ?
Does it work in nonInterrupt mode ?
That device has a LOT of registers that NEED to be setup, so I'll assume one or more of them are not configured properly for your application. The 'S' version is an SPI interface and I didn't check to see if the register map is the same for the I2C device. There may be a difference ?
Jay |
|
|
Sterngleiter
Joined: 07 Jan 2013 Posts: 90
|
solved |
Posted: Sun Dec 30, 2018 6:24 am |
|
|
I found my mistake. I only had a small mistake while reading. |
|
|
Sterngleiter
Joined: 07 Jan 2013 Posts: 90
|
Adresse |
Posted: Sun Dec 30, 2018 10:29 am |
|
|
When I'm at it, I can also ask how it goes with the addressing. They say that you can attach 8 mcp23017 in an i2c bus. that can not go if I use for example the address 0x40 as write and 0x41 as read address. or do I use it differently? |
|
|
Sterngleiter
Joined: 07 Jan 2013 Posts: 90
|
Adresse |
Posted: Sun Dec 30, 2018 10:33 am |
|
|
since I can set with pins A0, A1, A2 only 8 bit, it is only 4 mcp23017 in the bus realistic or? |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19238
|
|
Posted: Sun Dec 30, 2018 10:38 am |
|
|
You change the address of the mcp23017 using it's A0, A1 & A2 pins.
Addresses are:
A0 A1 A2
0 0 0 0x40
1 0 0 0x42
0 1 0 0x44
1 1 0 0x46
0 0 1 0x48
1 0 1 0x4A
0 1 1 0x4C
1 1 1 0x4E
These are the 'write' addresses. In each case the 'read' address is one
greater.
Just set the device address using the hardware, and change the code
to suit. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9121 Location: Greensville,Ontario
|
|
Posted: Sun Dec 30, 2018 10:50 am |
|
|
and...
you can get another 'bus of 8 devices' by using a 2nd I2C pair of pins.
What may be difficult are the interrupt signals FROM the expanders.
That all depends on your application.
Jay |
|
|
Sterngleiter
Joined: 07 Jan 2013 Posts: 90
|
thanks |
Posted: Sun Dec 30, 2018 12:29 pm |
|
|
thanks, it was a great help |
|
|
|