Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

i2c data

Status
Not open for further replies.

Joe G

Member
I'm starting to learn how to use I2c, but I'm at a loss as to writing of the command byte and data byte, I'm using a pic16f886 master to a LTC2990 slave. The address byte was easy, but the command and data byte are a little confusing as to which is which for there is quite a few different registers to access but not much in the way of an example, or not sinking in to me :( I want to set the registers to read a current differential and a voltage, The reading of the slave seems pretty straight forward.
thank you
 
assembly, I've looked over a lot of routines, which seem pretty straight forward. but in the data sheet there is no example that I can see? Like, do I write to just one register or do I have to write to all of them, and what do I write to them..they give you the register address but what would I put in for the data?
 
Usually writing...

Write device address
Wait for ack
Write internal address ( 0 to 16 )
Wait for ack
Write data byte
Wait for ack
Send stop

Reading....

Write device address
Wait for ack
Write internal address ( 0 to 16 )
Wait for ack
Send restart
Write device address + RW
wait for ack
Receive Byte
Send ack ( to send more bytes)
Send nack ( No more bytes )
Send stop

This is the format...
 
Last edited:
so, the internal address would be the register (0x06) and then the data would be the CONTROL Register bits (b'00001011') ? would that be correct?
 
If you select internal address 0x06

When you read a byte it will be the value that register 0x6 contains... V1 ( msb ) if you send an ack after receiving V1 ( msb ) just reading the byte again it will be V1 ( lsb )

Write device address
Wait for ack
Write internal address (6)
Wait for ack
Send restart
Write device address + RW
wait for ack
Receive Byte ( V1 ) msb
Send ack
Receive Byte ( V1 ) lsb
Send nack ( No more bytes )
Send stop
 
yep, got that, but don't I have to write to it first, to set it up, before it'll let me read them?
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top