I2C Slave with a PIC


Closed Thread
Results 1 to 40 of 130

Hybrid View

  1. #1
    Join Date
    Oct 2008
    Location
    Southern California
    Posts
    17


    Did you find this post helpful? Yes | No

    Unhappy New attempts

    Today I tried changing the Master and Slave addresses to higher numbers. I tried $26, $A6, and $02 just for good measure. They all responded with the same results; the slave sees the address, matches to its own, sets the interrupt flag, sets the Buffer Full flag, loads the address byte into the SSPBUF and I can read it from there. Although I reported before that the Slave wasn't sending an ACK, I think I was wrong. When I poll the ACKSTAT in the Master, it comes back with a "0" which I thought was NO ACK, but in fact a 0 is reporting a good ACK.

    I've also switched to 18F4685 on both Master and Slave just eliminate the possiblilty of bad chips. Same results.

    I took Daniel's suggestion to try to read from the Slave instead of sending to it. The slave responds by loading the first digit in its SSPBUF but I'm not seeing it show up at the Master.

    I notice that the Slave's D_A (SSPSTAT.5 ' SSP Data not Address) is always showing "1" for DATA and never have I seen a "0" for ADDRESS. Is that OK? How would that bit get changed?

    Rswain
    Last edited by rswain; - 14th March 2009 at 03:55.

  2. #2


    Did you find this post helpful? Yes | No

    Default

    I'll try to buy a 18F2620 this week and run a few test Hope I can get it here, I live in Argentina, it's not always easy to find those "big brothers" ...

    EDIT: I found a 18F452 laying around on the desk, will this serve the purpose???
    Last edited by DanPBP; - 14th March 2009 at 04:47.

  3. #3
    Join Date
    Oct 2008
    Location
    Southern California
    Posts
    17


    Did you find this post helpful? Yes | No

    Default Most any 18F will do

    Daniel - I'd be happy if any 18F would work. I'm starting to think something's wrong with PBP and 18F.

    Thanks for your continued attempts to beat this problem into submission!

    I'm going to switch to 16F877A (the old standby to see if I can get them to talk - once I get that, then we'll come back here and try again!

    Robert

  4. #4


    Did you find this post helpful? Yes | No

    Default

    I played all night with a 16F88 as a master and a 16F877 as a slave (the other way around I was playing these days)...

    I can send commands to the slave (16F877) and this is working fine, but something is wrong because I cannot read from the slave.

    I mean, I can read from the slave, but I'm not getting the value I wanted. For example, I'm supposed to read 12, but I'm reading 1.

    The code is the same I'm using for the 16F88 as a slave, so, that code is working fine. This is really strange.

    PS: today is my birthday, and it's almots 7am and I need some sleep... I'll continue later in the afternoon...
    Last edited by DanPBP; - 14th March 2009 at 09:40. Reason: more info added

  5. #5
    Join Date
    Oct 2004
    Location
    Hangover, Germany
    Posts
    289


    Did you find this post helpful? Yes | No

    Exclamation

    I has gone through this hell too.

    I bought a cheap LA (Po.Scope) in order to debug my code. I was looking for errors in PBP too, but at least the error was im my code (and maybe in PBP)...

    Please, post your code again.
    I use the 16F872 and 16F876 and 18F252 as I2C-slaves. They work all !!!

    Look at this page: http://www.astrosurf.com/soubie/pic_as_an_i2c_slave.htm
    Last edited by BigWumpus; - 14th March 2009 at 14:42.
    PBP 2.50C, MCS+ 3.0.0.5, MPLAB 8, MPASM 5.14, ASIX Presto, PoScope, mE mikroBasic V7.2, PICKIT2

  6. #6


    Did you find this post helpful? Yes | No

    Default

    I saw that page and talked to Robert, but, to be honest, I don't understand how to use his code...

  7. #7
    Join Date
    Oct 2004
    Location
    Hangover, Germany
    Posts
    289


    Did you find this post helpful? Yes | No

    Exclamation

    Again ... post your code !
    PBP 2.50C, MCS+ 3.0.0.5, MPLAB 8, MPASM 5.14, ASIX Presto, PoScope, mE mikroBasic V7.2, PICKIT2

  8. #8
    Join Date
    Oct 2004
    Location
    Hangover, Germany
    Posts
    289


    Did you find this post helpful? Yes | No

    Exclamation

    Quote Originally Posted by danielhr77 View Post
    I saw that page and talked to Robert, but, to be honest, I don't understand how to use his code...


    What ?

    It's PBP !
    PBP 2.50C, MCS+ 3.0.0.5, MPLAB 8, MPASM 5.14, ASIX Presto, PoScope, mE mikroBasic V7.2, PICKIT2

Similar Threads

  1. Problem with PICto PIC I2C MASTER-SLAVE
    By juanen19 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 11th June 2013, 03:58
  2. PIC as I2C Slave
    By Mainul in forum General
    Replies: 4
    Last Post: - 5th January 2013, 14:23
  3. I2C Slave, config Vref - + in pic with ADC
    By sebapostigo in forum PBP Wish List
    Replies: 4
    Last Post: - 5th March 2007, 04:21
  4. Pic as an i2c slave
    By Robert Soubie in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 25th January 2007, 22:11
  5. Use pic as slave in I2C
    By robert0 in forum General
    Replies: 2
    Last Post: - 3rd February 2006, 20:26

Members who have read this thread : 1

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