CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

MCP 23017 interrupt on change

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Sterngleiter



Joined: 07 Jan 2013
Posts: 90

View user's profile Send private message

MCP 23017 interrupt on change
PostPosted: Sun Dec 30, 2018 5:59 am     Reply with quote

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: 9093
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sun Dec 30, 2018 6:20 am     Reply with quote

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

View user's profile Send private message

solved
PostPosted: Sun Dec 30, 2018 6:24 am     Reply with quote

I found my mistake. I only had a small mistake while reading.
Sterngleiter



Joined: 07 Jan 2013
Posts: 90

View user's profile Send private message

Adresse
PostPosted: Sun Dec 30, 2018 10:29 am     Reply with quote

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

View user's profile Send private message

Adresse
PostPosted: Sun Dec 30, 2018 10:33 am     Reply with quote

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: 19215

View user's profile Send private message

PostPosted: Sun Dec 30, 2018 10:38 am     Reply with quote

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: 9093
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sun Dec 30, 2018 10:50 am     Reply with quote

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

View user's profile Send private message

thanks
PostPosted: Sun Dec 30, 2018 12:29 pm     Reply with quote

thanks, it was a great help
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group