ADS115 Datasheet

Go To Last Post
43 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I need help to understand information given in the datasheet https://cdn-shop.adafruit.com/datasheets/ads1115.pdf

 

 

I do not understand which one is correct slave address in datasheet ? 

 

This topic has a solution.
Last Edited: Thu. Apr 9, 2020 - 01:21 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Are you seriously telling us you are unable to match up the circled-in-red bits with those from the Table-5

 

Highlighted Address Bits

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

N.Winterbottom wrote:

Are you seriously telling us you are unable to match up the circled-in-red bits with those from the Table-5

 

No I was confused in table 5 because there is four slave address given in the table so If I am not wrong when the ADDR pin is connected to ground Slave address will be 1001000

 

 

What is Data Byte 1 and Data Byte 2 in fig 32 ?

 

Is it data that would be store at pointer register ?

Last Edited: Sun. Apr 5, 2020 - 09:22 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ansh11 wrote:
What is Data Byte 1 and Data Byte 2 in fig 32 ?

 

Exactly what it says - 16bit data for the register addressed by Frame 2. It seems this device has 16 bit registers, so it is explaining the byte order.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

ansh11 wrote:
If I am not wrong when the ADDR pin is connected to ground Slave address will be 1001000

You are not wrong. I really don't know why you doubted your decision, the datasheet couldn't be much more clear.

 

BTW: I like this feature - I wish some real-time-clocks had something like this.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kartman wrote:

ansh11 wrote:
What is Data Byte 1 and Data Byte 2 in fig 32 ?

 

Exactly what it says - 16bit data for the register addressed by Frame 2. It seems this device has 16 bit registers, so it is explaining the byte order.

this is key point that I do not understand Its still not clear for me, we are sending byte of data to ads1115, What type of data is it ? Is it address of register? Is it raw data that will store at register address? 

Last Edited: Sun. Apr 5, 2020 - 10:23 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

I think we're having a language issue here.

 

It is a 16 bit value that will be stored at the register address. I don't know what you mean by 'raw' data.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

thanks I got it 

 

Please find below programming flow chart that I have drawn it to describe I2C write operation. I will appreciate any opinion on it  

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Unless the I2C spec mandates it, different devices can do what they please.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kartman wrote:
Unless the I2C spec mandates it, different devices can do what they please.

its important to understand basic first and I am doing that , I made it what I understand from reading documents on I2C specification 

 

My question is what happen when we to write multiple registers slave. diagram describe only operation of only one register  what happen when we  we need to write multiple data to different registers of slave?.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ansh11 wrote:

...diagram describe only operation of only one register  what happen when we  we need to write multiple data to different registers of slave?.

 

That's Kartman's point. Different slaves will have different ways of writing to multiple registers.

 

Some devices will automatically increment the register address so that you only have to write data; some will require you to alternate writes of address and data, and some will require you to have a completely separate transaction, selecting the device each time, for each register.

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#2 Hardware Problem? Read AVR042.

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I don't think that the flowchart is correct at the very bottom.  It is my understanding that the Slave will always acknowledge with an assertion (the line gets pulled low to GND) on the SDA when it receives 8 bits of data from the Master.  During a Master-Write type of transfer, the Slave will only assert the SDA line during the ACK cycle.  All the other times, the Slave releases (allows to float to Vcc) both the SCL and SDA lines.  So when the Master is done sending data to the Slave, and the Slave has ACK'ed the latest byte transfer, it is the Master that releases the SCL followed by releasing the SDA, which creates the STOP condition.   Please correct if this is not right.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Brian Fairchild wrote:

ansh11 wrote:

...diagram describe only operation of only one register  what happen when we  we need to write multiple data to different registers of slave?.

 

That's Kartman's point. Different slaves will have different ways of writing to multiple registers.

 

Some devices will automatically increment the register address so that you only have to write data; 

consider case when slave devices will automatically increment the register address so that we only have to write data. what happen when we  we need to write multiple data to different registers of slave?.

 

just give me idea so that I will try to draw in flow chart

Last Edited: Sun. Apr 5, 2020 - 02:43 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ansh11 wrote:

...just give me idea so that I will try to draw in flow chart

 

I can't because, as we've said, every slave is different. So you'll need to draw a different flowchart for every type of device. If you want to see an example of a chip that support sequential write with automatic increment then get the datasheet for the MCP23017.

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#2 Hardware Problem? Read AVR042.

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Brian Fairchild wrote:
  If you want to see an example of a chip that support sequential write with automatic increment then get the datasheet for the MCP23017. MCP23017

 

http://ww1.microchip.com/downloads/en/devicedoc/20001952c.pdf

 

I think this diagram in the datasheet describe write operation so can you help me to understand how write operation work in sequence 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kartman wrote:
Unless the I2C spec mandates it, different devices can do what they please.

Brian Fairchild wrote:
every slave is different. So you'll need to draw a different flowchart for every type of device

@ ansh11 : We've been through all this - at length - in your previous thread:

https://www.avrfreaks.net/forum/what-data-means-diagram-i2c-bus

 

It seems you need to go back and review that thread already!

 

ansh11 wrote:
what happen when we  we need to write multiple data to different registers of slave?

As explained in your previous thread, you do whatever the chip documentation tells you!

 

https://www.avrfreaks.net/commen...

 

And "the chip documentation" includes application notes, examples, etc provided by the manufacturer.

 

You can also look at 3rd-party examples, tutorials, etc:

 

https://www.avrfreaks.net/commen...

 

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Sun. Apr 5, 2020 - 10:11 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

awneil wrote:
As explained in your previous thread, you do whatever the chip documentation tells you! And "the chip documentation" includes application notes, examples, etc provided by the manufacturer.

 

@awneil I have asked specific question about chip that I don't understand in datasheet. post #15 I do not understand how does that meaning  

Last Edited: Mon. Apr 6, 2020 - 03:49 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I don't see where you've asked a question in #15. What don't you understand about the diagrams?

 

I2C can be broken down into some very specific sequences:

 

Stop(P)

Start (S)

Repeated start (SR)

Send byte

Receive Byte

ACK

NACK

 

 

If you're having trouble understanding this, then you've skipped some fundamental learning. 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

In msg #15, those diagrams DO show sequential read. 

 

There are starts S device addresses OP and data Din/Dout (some of which can be register addresses) and repeated starts SR, and more. The whole lot is there in those diagrams. Rather than just asking for an "explanation", ask about some detail or feature that shows that you are making an effort to understand rather than just copy and paste.

 

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

@OP the NXP document that you were given a link to in your other thread explains in great detail EXACTLY how I2C works. If you read and understand the basics of the different I2C actions then you will be able to understand any I2C chip and its operations.

Rather than focusing on a chip I strongly advise that you spend a few days understanding how I2C works at the fundamental level. Once you have that knowledge you will be able to read any datasheet.

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#2 Hardware Problem? Read AVR042.

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ansh11 wrote:
I have asked specific question about chip that I don't understand in datasheet

But, as in your other thread, you seem to have made no effort to find clarification for yourself!

 

  • You seem to have looked only at the diagram - not gone through the rest of the datasheet for further clarification/explanation
  • You haven't looked at other resources describing the chip.

 

You just keep asking questions which are clearly answered in the datasheet!

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kartman wrote:

 

I2C can be broken down into some very specific sequences:

 

Stop(P)

Start (S)

Repeated start (SR)

Send byte

Receive Byte

ACK

NACK

 

If you're having trouble understanding this, then you've skipped some fundamental learning. 

 

I understand this sequence,  look at diagram #8 I have describe it.

 

this is my understand for fundamental basics 

 

I2C Write(Start - Slave address  + Write + check ACK + Register address + Check ACK + Data byte + check ACK  + Stop )

 

I2C Read( Start - Slave address  + Read + check ACK + Read the register and stored  value in variable + check ACK  + Stop)

 

When device doesn't acknowledged stop the transmission  

 

I do not understand the sequence given in post #15 ?

 

 

Last Edited: Mon. Apr 6, 2020 - 07:24 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What specifically don't you understand?

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


 

 

ansh11 wrote:
I do not understand the sequence given in post #15 ?

Go on!

 

It's very clearly stated:

 

 

If you don't understand that, then have you looked for other documentation that further explains or illustrates it?

 

Again, in your previous thread:

 

I wrote:
The really important thing to learn is how to seek out this information for yourself.

 

That's why it's important that you realise:

  1. The information was in the datasheet;
  2. The information was in the manufacturer's other supporting materials;
  3. The information was available in 3rd-party materials (tutorials, etc).

and learn to seek out & study such materials.

 

https://www.avrfreaks.net/commen...

 

EDIT

 

 

Have you done that?

 

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Mon. Apr 6, 2020 - 07:32 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kartman wrote:

What specifically don't you understand?

 

 

This diagram confused me 

 

I do not understand meaning Din and Dout,  what does incoming and outgoing arrow indicate in the diagram 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

 

That diagram summarises all of the possible sequences on the I2C interface.

 

Again, if you had followed the direction

 

 

You would have found each sequence described separately & in detail - including a definition of what DIN and DOUT mean eg,

 

Again, it was all there - you really need to learn to seek these things out for yourself!

 

 

EDIT

 

The datasheet is a PDF document.

 

You have a Search facility - so, if you come across a term you don't understand, use the Search to find where it's defined:

 

 

In general, reading a datasheet will take a number of passes - there will be cross-references that you need to follow.

 

EDIT 2

 

Following cross references can be harder on a screen - especially a small screen, where you can only see a small part of the document at a time.

 

So you may find it helpful to print the document - or key sections of it.

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Mon. Apr 6, 2020 - 08:52 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

ansh11, muke12 and sky33 must be related. 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Yes - I think so.

 

frown

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kartman wrote:

ansh11, muke12 and sky33 must be related. 

yesfrown

 

Thank you for helping all  It seems that I should take rest for some time and move forward towards my goal

Last Edited: Mon. Apr 6, 2020 - 09:42 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If you feel that this issue is resolved, then mark the solution.

 

See Tip #5 in my signature (below) for instructions.

 

And also your other threads.

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kartman wrote:

ansh11, muke12 and sky33 must be related. 

IP address puts all three in the same city in the same country so, yes, rather annoyingly this looks like one person using 3 different accounts.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

awneil wrote:

If you feel that this issue is resolved, then mark the solution.

 

See Tip #5 in my signature (below) for instructions.

 

And also your other threads.

 

honestly I didn't got answer as I was looking for my question. just forgot about datasheet, source code. Can you describe programming diagram on the paper from your many years of experience so flow diagram is easy to understand rather then writing code directly 

 

 I was looking help to draw the flow diagram to understand basic fundamentals and I shown some diagram I always try to solve problem on the paper first   

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:

Kartman wrote:

ansh11, muke12 and sky33 must be related. 

IP address puts all three in the same city in the same country so, yes, rather annoyingly this looks like one person using 3 different accounts.

strange, so many people live in the city. if you doubt on me that I am using three account with different name so  can you share the map location that show the which area or street they are accessing forum may be one of them is my college friend   

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ansh11 wrote:
I2C Read( Start - Slave address  + Read + check ACK + Read the register and stored  value in variable + check ACK  + Stop)

 

Should be:

]I2C Read( Start - Slave address  + Read + check ACK + Read the register and stored  value in variable + send NACK  + Stop)

 

The master sends NACK when it is done reading data from slave, so slave knows to release bus so master can send stop!!!

This basic I2C operation!

Jim

 

 

(Possum Lodge oath) Quando omni flunkus, moritati.

"I thought growing old would take longer"

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ki0bk wrote:

ansh11 wrote:

I2C Read( Start - Slave address  + Read + check ACK + Read the register and stored  value in variable + check ACK  + Stop)

 

 

Should be:

]I2C Read( Start - Slave address  + Read + check ACK + Read the register and stored  value in variable + send NACK  + Stop)

 

The master sends NACK when it is done reading data from slave, so slave knows to release bus so master can send stop!!!

This basic I2C operation!

Jim

 

Thanks ki0bk for help

 

suppose I want to send data to only one register  of salve and then read that register

 

Is this process to read write operation ?

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

 

ansh11 wrote:
send data to only one register  of salve and then read that register

Which slave are we talking about - two have been discussed in this thread!

 

Is this process to read write operation ?

Have you gone through it, step by step, and compared with what the appropriate datasheet says ?

 

EDIT

 

A key part of software development is testing & verifying what you've written. This applies equally to flowcharts as to source code.

 

So it is your job to go through your flowchart & test/verify it.

 

If I were doing this, I would get some of these:

 

 

Print out the appropriate section(s) of the datasheet

 

Print out the flowchart

 

Go through the datasheet section(s) with the highlighter(s) and mark off where each datasheet requirement is implemented in the flowchart.

 

Some of the datasheet stuff you've posted has both text & diagrams to describe the operation - you should verify your flowchart against both

 

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Tue. Apr 7, 2020 - 08:23 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

awneil wrote:

 

ansh11 wrote:
send data to only one register  of salve and then read that register

Which slave are we talking about - two have been discussed in this thread!

 

Some of the datasheet stuff you've posted has both text & diagrams to describe the operation - you should verify your flowchart against both

 

 

 

assume for MCP23017

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ansh11 wrote:
assume for MCP23017

We can't just assume!

 

Either it is for an MCP23017, or it isn't.

 

As has been repeated many times: every slave is different !

 

Have you checked it yet ?

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

awneil wrote:

ansh11 wrote:
assume for MCP23017

We can't just assume!

 

Either it is for an MCP23017, or it isn't.

That is diagram for  MCP23017

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So you do know how to edit the quotes, then.

 

And the bit you chose to take out is:

 

I wrote:
Have you checked it yet ?

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

awneil wrote:

So you do know how to edit the quotes, then.

 

And the bit you chose to take out is:

 

I wrote:
Have you checked it yet ?

 

I mean to say that I have read the datasheet Then whatever I understood. I explained with a flow chart I need your help to identify that does my flow chart follow the rule given in datasheet ?

 

 

as per my knowledge, the flow chart follows the rules given in the datasheet.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

There may be an implied auto increment of the register address. If this is the case, you won’t read IODRA, but the next register following it. What does the datasheet say about this?

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Rather than fretting over overly-detailed diagrams, if I wanted to know how to operate an MCP23017 I'd have a look at how someone else is already using it. So there is a library of code for it here:

 

https://github.com/adafruit/Adafruit-MCP23017-Arduino-Library

 

and that has "examples" that include:

 

https://github.com/adafruit/Adafruit-MCP23017-Arduino-Library/blob/master/examples/button/button.ino

 

so the code of that is simply:

Adafruit_MCP23017 mcp;
  
void setup() {  
  mcp.begin();      // use default address 0

  mcp.pinMode(0, INPUT);
  mcp.pullUp(0, HIGH);  // turn on a 100K pullup internally

  pinMode(13, OUTPUT);  // use the p13 LED as debugging
}



void loop() {
  // The LED will 'echo' the button
  digitalWrite(13, mcp.digitalRead(0));
}

so just look at the code "behind" those calls to the mcp object:

void Adafruit_MCP23017::begin(void) {
	begin(0);
}
void Adafruit_MCP23017::begin(uint8_t addr) {
	if (addr > 7) {
		addr = 7;
	}
	i2caddr = addr;

	Wire.begin();

	// set defaults!
	// all inputs on port A and B
	writeRegister(MCP23017_IODIRA,0xff);
	writeRegister(MCP23017_IODIRB,0xff);
}

the key thing there being the writeRegister() calls which are using:

#define MCP23017_IODIRA 0x00
#define MCP23017_IODIRB 0x01

and it's implemented as:

void Adafruit_MCP23017::writeRegister(uint8_t regAddr, uint8_t regValue){
	// Write the register
	Wire.beginTransmission(MCP23017_ADDRESS | i2caddr);
	wiresend(regAddr);
	wiresend(regValue);
	Wire.endTransmission();
}

which uses:

#define MCP23017_ADDRESS 0x20

The .pinmode() and .pullup are:

void Adafruit_MCP23017::pinMode(uint8_t p, uint8_t d) {
	updateRegisterBit(p,(d==INPUT),MCP23017_IODIRA,MCP23017_IODIRB);
}
void Adafruit_MCP23017::pullUp(uint8_t p, uint8_t d) {
	updateRegisterBit(p,d,MCP23017_GPPUA,MCP23017_GPPUB);
}

And they depend on:

void Adafruit_MCP23017::updateRegisterBit(uint8_t pin, uint8_t pValue, uint8_t portAaddr, uint8_t portBaddr) {
	uint8_t regValue;
	uint8_t regAddr=regForPin(pin,portAaddr,portBaddr);
	uint8_t bit=bitForPin(pin);
	regValue = readRegister(regAddr);

	// set the value for the particular bit
	bitWrite(regValue,bit,pValue);

	writeRegister(regAddr,regValue);
}

So it't pretty clear the sequence of bytes written to I2C to achieve the desired operations.