Menu

I2C

bss1
2015-02-26
2015-02-26
  • bss1

    bss1 - 2015-02-26

    Hello,
    I'm new in here and to GCB. I've followed some examples as well as generated my own code. But I need to get help with the I2C function. I want to acces a DSP to acces a register and write in to this. As I can't find examples for this I ask you guys for help....Thanks

     

    Last edit: bss1 2015-02-26
  • Anobium

    Anobium - 2015-02-26

    We can help.

    If you can post your device description and the datasheet this will be the best plae to start.

    Anobium

     
    • bss1

      bss1 - 2015-02-26

      Thanks Anobium,

      Attached you'll the data sheet on DDX2001 and I want to use PIC16f866

      I would like to say that GCB fits me very well :-)

       
  • Anobium

    Anobium - 2015-02-26

    This look a simple device with a lot of registers. :-) That is not a concern.

    Question. Have you seen some working examples of this device for another programming language? I want to try understand the architecture of the device or is this as simple that the user (you) are aware of all the registers and the user simply reads and writes as required.

     
  • bss1

    bss1 - 2015-02-26

    Unfortunately not, this device is new to me, but I might be able to find some Windows SW for another device (Evaluation board) similar to this. I don't know if this will help?

    ApogeeDDX does not exist anymore, I've an old DDX amplifier and it sounds great. I know where to get the Circuits so this is not a problem.

    I'll take a look and get back if you'll need this...thanks!

     
  • Anobium

    Anobium - 2015-02-26

    Here goes.

    Connect up the device to the chip. Remember the 4.7k pullups on both the SLK and SDA lines. When you have done this you can test the address using the code here Edit the I2C discovery code to your specific chip. This may need a serial terminal or you can further adapt to a LCD.

    When you the code operational. You will have the address of the device, I think it should 0x34 but lets not guess :-) Do the discovery to prove all is good.

    Then, you are nearly there. Then, to write to the device byte registers.

    IS2Start
    I2CSend ( <the address> )
    I2CSend ( <the register to be written to> )
    I2CSend ( <the value to be set as a_byte_variable> )
    I2CStop
    ~~~~~
    
    To read,
    

    I2CStart
    I2CSend ( <the address=""> )
    I2CSend ( <the register="" to="" be="" read=""> )
    I2CReStart
    I2CSend ( <the address=""> + 1 ) ;add 1
    I2CReceive ( a_byte_variable, NACK )
    I2CStop
    ~~~~~</the></the></the>

    This is all untested but it should be a good start for you.

    Get back with any questions. No probs...

     
  • bss1

    bss1 - 2015-02-26

    Is it that simple!!!!! :-)
    Thanks anyway, maybe I'll get back to you, but now I have a pretty good idea

     
    • Anobium

      Anobium - 2015-02-26

      Good luck!

       
  • bss1

    bss1 - 2015-02-26

    Sorry, additional question:

    In the 16f886 datasheet are the RC3 - RC5 defined as I2C so I'll guess that I'm forced to use these pins?

     
  • Anobium

    Anobium - 2015-02-26

    You are not forced to. I have proposed you use Software. You can select your pins with the software I2C. See the Help File.

     
  • bss1

    bss1 - 2015-02-26

    Ok, thanks Again, I'll take a closer look at the the file you send...

     

Log in to post a comment.