Multiple I2c Devices


+ Reply to Thread
Results 1 to 6 of 6
  1. #1
    Join Date
    Jan 2012
    Posts
    3

    Default Multiple I2c Devices

    Hi,
    I need four I2c ports to be used to communicate with four slave I2c devices (having same fixed address tcs3414) using 16F689. For one device it is OK with Busin and Busout. But i am unable to find a way to use multiple devices on same chip. Is there any solution exist using Picbasic Pro.

  2. #2
    Join Date
    Nov 2008
    Posts
    26

    Default Re: Multiple I2c Devices

    Hi

    This can easly be done in PBP using the I2CREAD and I2CWRITE commands.
    The I2C routines in PBP are software based and can be assigned to almost any pin on the PIC, in your case you could use RC0 - RC7 as 4 seperate I2C interfaces.

    The manual expalins alot of the function for this http://pbp3.com/downloads/PBP_Reference_Manual.pdf section 5.33 & 5.34, but I'd be more than happy to answer any specific questions you may have.

  3. #3
    Join Date
    Jan 2012
    Posts
    3

    Default Re: Multiple I2c Devices

    Hi,
    Thanks for your reply, i have tried following simple code but getting error for I2Cwrite (I2cRead is OK), please check whats wrong with this code. is there something missing......?

    '*********************
    Device 16F689
    Config FCMEN_ON, IESO_OFF, CPD_OFF, CP_OFF, MCLRE_ON, PWRTE_ON, WDT_OFF, INTRC_OSC_NOCLKOUT,BOR_OFF
    TRISC=%00000000


    Declare All_Digital = True
    Xtal=8



    Symbol Dpin PORTC.4
    Symbol Cpin PORTC.6


    DelayMS 100


    main:


    I2CWRITE Dpin,Cpin,$72,$80,[$3]
    I2CREAD Dpin,Cpin,$72,$80,[$3]




    End

  4. #4
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,164

    Default Re: Multiple I2c Devices

    This doesn't look like PBP code to me?
    Dave Purola,
    N8NTA
    EN82fn

  5. #5
    Join Date
    Nov 2008
    Posts
    26

    Default Re: Multiple I2c Devices

    Agreed, not picbasic, what version of picbasic are you running?

  6. #6
    Join Date
    Jan 2012
    Posts
    3

    Default Re: Multiple I2c Devices

    Hi,
    Sorry i made a mistake, actually it is proton code and i mixed proton with pic basic. I will try writing in picbasic and will let you know if there is any issue.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts