PIC18F I2C Communication with Arduino


Closed Thread
Results 1 to 12 of 12

Hybrid View

  1. #1
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,605


    Did you find this post helpful? Yes | No

    Default Re: PIC18F I2C Communication with Arduino

    Dave,
    I do design hardware from time to time but yeah, I'd love to do more. I tend to use SPI as I think it's both easier and faster and all the functions you mention are available in chips with SPI-interface as well as I2C so I've never actually had the need TO use it - that's it really.

    Scampy,
    I2C/Read/Write are not "hardware assisted" commands, they do not use the (M)SSP module in the PIC so any pins can be used.

    picmilan,
    I'll repeat what I said earlier: Check if the pins you're using has analog functions and make sure they're turned off.

    /Henrik.

  2. #2
    Join Date
    May 2016
    Posts
    33


    Did you find this post helpful? Yes | No

    Default Re: PIC18F I2C Communication with Arduino

    Quote Originally Posted by HenrikOlsson View Post
    picmilan,
    I'll repeat what I said earlier: Check if the pins you're using has analog functions and make sure they're turned off.

    /Henrik.
    Yeah,You are right! Looking at datasheet those pins are analog by default..

    Now Control Address and write address is what confuses me.Control Address is 0x26 as defined in arduino code,right? so what is write address?

    Is SPI easier? I don't have many pins available but if I2C doesn't work I guess I don't have any other option.

  3. #3
    Join Date
    Oct 2009
    Posts
    583


    Did you find this post helpful? Yes | No

    Default Re: PIC18F I2C Communication with Arduino

    Henrik, I thought as much, which is why I added the comment about PBP using any pin. I was simply suggesting he tried other pins, and use those designated for such communications if the pic has them. Hopefully if the OP disables any analogue config his issue will be resolved

  4. #4
    Join Date
    May 2013
    Location
    australia
    Posts
    2,631


    Did you find this post helpful? Yes | No

    Default Re: PIC18F I2C Communication with Arduino

    try it like this
    Arduino i2c address' are 7bit
    pbp uses 8bit


    ADDR = $26 ' 7bit Arduino I2C address
    addr=addr<<1 ;shift to 8 bitformat



    I2CWrite SDA,SCL,ADDR,[0]
    Warning I'm not a teacher

  5. #5
    Join Date
    May 2016
    Posts
    33


    Did you find this post helpful? Yes | No

    Default Re: PIC18F I2C Communication with Arduino

    Quote Originally Posted by richard View Post
    try it like this
    Arduino i2c address' are 7bit
    pbp uses 8bit


    ADDR = $26 ' 7bit Arduino I2C address
    addr=addr<<1 ;shift to 8 bitformat



    I2CWrite SDA,SCL,ADDR,[0]
    It worked! Thanks alot!

Similar Threads

  1. Interfacing with Arduino I2C LCD
    By norohs in forum Documentation
    Replies: 47
    Last Post: - 30th May 2017, 18:53
  2. I2C lcd ( arduino ) with PICBASIC, help
    By iw2fvo in forum mel PIC BASIC Pro
    Replies: 92
    Last Post: - 10th September 2014, 18:00
  3. EEprom and MCP9801 I2C communication problems
    By aajgss in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 3rd September 2011, 21:45
  4. How do I operate an Arduino I2C LCD
    By menta in forum General
    Replies: 8
    Last Post: - 13th July 2011, 02:28
  5. Replies: 2
    Last Post: - 10th June 2005, 02:34

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

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