How To Send An 8-bit Address Over I2C - Arduino Forum

How to send an 8-bit address over I2C Projects Programming June 16, 2017, 1:40pm 1

Hello all,

My question is rather simple, I am trying to talk to a device which has an 8-Bit address. I cannot find I2C code to send an 8-Bit address, only 7-Bit.

Wire.beginTransmission(adress);

^ Only sends an 7 bit.

I'll show you my code, I am basically sending an 8-bit address and then sending 8 bytes of data. Then I send an 8-Bit address and read 12 bytes of data. I have made the code as basic as possible. p.s - I'm using an oscilloscope to monitor the bits, that's why there is delays in the code, just so I know where I am. Any help would be greatly appreciated. Code Below.

#include <Wire.h> byte Values[12];

void setup() { Wire.begin(); Serial.begin(9600); }

void loop() {

delay(3);

Wire.beginTransmission(202);

for (byte i = 0; i <= 7; i++) { Wire.write(0x00);

}

Wire.endTransmission();

delay(1);

Wire.requestFrom(203, 12);

if (Wire.available() > 0) { Serial.println("We are Reading!");

for (byte i = 0; i <= 11; i++) { Values = Wire.read();

  • }*
  • Wire.endTransmission();*
  • }* }
1 Like June 16, 2017, 5:10pm 2

Divide the address by 2. Use 101 for both beginTransmission() and requestFrom().

Wire - Arduino Reference

The Arduino programming language Reference, organized into Functions, Variable and Constant, and Structure keywords.

There are both 7- and 8-bit versions of I2C addresses. 7 bits identify the device, and the eighth bit determines if it's being written to or read from. The Wire library uses 7 bit addresses throughout. If you have a datasheet or sample code that uses 8 bit address, you'll want to drop the low bit (i.e. shift the value one bit to the right), yielding an address between 0 and 127.

June 16, 2017, 5:14pm 3

Probably the 8 bit address you have got for the slave device is a 7 bit address with binary '0' at the end for reading and a '1' at the end for writing. Link. Try using the decimal value of 65 for both reading and writing to the device to see if you get anywhere. Maybe you can also load the I2C scanner sketch and see what device addresses are reported. Otherwise, provide a link here to the device you are attempting to connect to.

Topic Replies Views Activity
I2C addressing Networking, Protocols, and Devices 4 1648 May 6, 2021
Confirm understanding of I2C addresses Programming 14 214 September 19, 2025
Wire.write 8bit byte Programming 29 6776 January 18, 2022
Arduino Giga I2C Programming 1 73 January 8, 2025
I2C - 8-bits Slave address Networking, Protocols, and Devices 6 4708 May 6, 2021
Unfortunately, your browser is unsupported. Please switch to a supported browser to view rich content, log in and reply.

Tag » Arduino I2c 7 Bit Address