Shop OBEX P1 Docs P2 Docs Learn Events
Debug I2C Scanner and BNO086 oddity - Page 2 — Parallax Forums

Debug I2C Scanner and BNO086 oddity

2»

Comments

  • JonnyMacJonnyMac Posts: 9,338
    edited 2025-06-18 23:54

    Technically, we're using 7-bit addressing, it's just how the code presents (format) and deals with it. Since I learned with datasheets that showed 8 bits, I've stuck with that, and I think it makes code a little more obvious. For example.

    con
    
      WR_8591  = %1001_000_0                                        ' I2C device ID for PCF8591
      RD_8591  = %1001_000_1
    

    To be honest, I created my I2C scanner so that I could verify what's happening with actual hardware. I added the 7-bit output format to the list portion to serve as a helper for those who may be adapting Arduino-compatible code. The Arduino library does a left shift of the 7-bit address to make room for the read/write bit.

  • dMajodMajo Posts: 860

    @Rayman said:
    Am wondering if the 7-bit address is the defacto standard these days. Have seen both 8-bit and 7-bit in the past. Maybe it's all 7-bit now? Hope so, but maybe not...

    I would say that each device (if you think in terms of byte or 8bit) on I2C bus has 2 consecutive addresses one to read from and the other to write to it.
    The MSB 7 bits are the same and are defacto the address while the lsb or 8th bit is the access direction (read or write)

Sign In or Register to comment.