Announcement

Collapse
No announcement yet.

I2CWrite Confusion

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • I2CWrite Confusion

    I'm having a bit of trouble understanding the application of 'I2Cwrite' to my target device.
    I've included a small shot of what is required by the device but am confused by the 'control' versus the devices address (and the 'address' as part of the command).
    I'm not quite sure what goes where.
    I'd appreciate anyone unraveling this for me-Keith
    Attached Files

  • #2
    It is a bit confusing.

    The "Control" byte of the I2C commands is the Slave Address ($7C).
    The "Address" byte of the I2C commands, is the Control byte of your slave.
    The data always goes inside the brackets.

    Code:
    Control   VAR BYTE
    
    I2CWRITE  SDA, SCL, $7C, Control,[YourData1, YourData2, YourData3]
    PBP3 Manual : Microchip Datasheets - 10F, 12F, 16F, 18F
    Never download a PIC datasheet from anywhere but microchip.com

    Comment


    • #3
      Thanks Darrel. I was getting there with the slave address being the control byte of the command. Figured I was getting that confused (I was using this command a while ago with PBP but was sure the syntax was different on another version).
      The only thing I'm not sure of still is: "The "Address" byte of the I2C commands, is the Control byte of your slave."
      This 'address byte' is a register where you're pointing your data at?
      -Keith

      Comment


      • #4
        Well, that datasheet is a liitle big to digest.
        The chinese accent doesn't help either.

        But it looks like there are only 2 bits in the control byte (Co and RS).
        RS is the register select, which is like doing $FE in the LCDOUT command.
        When RS = 0, you are sending a command.
        When RS = 1, you are sending data.
        PBP3 Manual : Microchip Datasheets - 10F, 12F, 16F, 18F
        Never download a PIC datasheet from anywhere but microchip.com

        Comment


        • #5
          Haha, oh yes, the data sheets from New Haven Display's are miraculously mind bending (with a dash of bad pinouts; e.g on this one: green led cathode for RGB backlight is really blue led cathode!).
          Yeah, that confused me (2 bits in control byte), but I guess we both saw it, so majority rules...unless of course it didn't occur to them to include necessary information.
          Nothing surprises me anymore.
          Thanks.-Keith

          Comment


          • #6
            This is rich; I was told by the company that the slave address is not $7C as in the diagram but rather $78. Why? No one knows.

            Comment

            Working...
            X