I2C issues


Closed Thread
Results 1 to 14 of 14

Thread: I2C issues

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default Re: I2C issues

    I'm guessing that you don't have scope or logic analyzer to actually see whats going on, I think thats the only way you're going to fix this. In this case I suspect a scope would be more helpful (USB from eBay £50 ish - for this you don't need lots of bandwidth) and as they are so cheap, Salea knock off (eBay £6). And before the winers start, a) Salea don't sell them any more and b) if you base your software on a reference design you shouldn't be surprised if people use alternate hardware.

    George

  2. #2
    Join Date
    May 2013
    Location
    australia
    Posts
    2,680


    Did you find this post helpful? Yes | No

    Default Re: I2C issues

    it works for me pbp3 pic16f1825 // ds1307 // pcf8574a either your code is wrong or your not connecting things properly

    tested at 8mz an 32mhz the pcf8574a has no problem

    Code:
                                
    #CONFIG
       __config _CONFIG1, _WDTE_ON    & _FOSC_INTOSC   &_MCLRE_ON    &_PWRTE_ON 
       __config _CONFIG2,              _LVP_OFF   & _PLLEN_ON
    #ENDCONFIG
             DEFINE OSC 32
             
                pkt var byte[11]
              MONTH VAR pkt[5]
              DATE  VAR pkt[4]
              HOUR  VAR pkt[2]
              MINS  VAR pkt[1]
              DOW VAR pkt[3]
              YEAR VAR pkt[6]
               SEC VAR pkt[0]
               cnt var byte
    
      
         osccon=$70    '8 MHz or 32mhz
             anselA=0        'dig i/o 
             ANSELC=0
          TRISC= 111111
           TRISA= 111110
           
       
         SDA         VAR PORTc.4       ; I2C Data pin
         SCL         VAR PORTc.3     ; I2C Clock Pin
    pcf_Addr CON $78
    rtc_Addr CON $d0       
          
           i2cwrite  sda,scl,rtc_Addr,0,[$80,$14,$11,3,$14,1,$14]  'SANE TIME AND DATE  
            i2cwrite  sda,scl,rtc_Addr,0,[$80]    'FORCE START IF REQ
            i2cwrite  sda,scl,rtc_Addr,0,[0]
     
      main:
      pause 2000
      i2cREAD  sda,scl,rtc_Addr,0,[str pkt \7 ]
      serout2 porta.0,84 ,[HEX HOUR,":", HEX2 MINS, ":",HEX2 sec, " - ", HEX DATE,"/", HEX MONTH  ,13,10]
      i2cwrite  sda,scl,pcf_Addr,0,[cnt]
      cnt=cnt+1
     goto main

  3. #3
    Join Date
    Apr 2011
    Location
    Welches, Oregon
    Posts
    198


    Did you find this post helpful? Yes | No

    Default Re: I2C issues

    In preparation for providing a drawing, I stripped off the board the battery holder, socket, and crystal from the standalone 1307 I tried earlier (they were not wired, but were cluttering the board), then began commenting out the unneeded code to post the minimal circuitry and programming that demonstrated the problem. Somewhere along the way... it works as intended now.

    You may recall that the last thread on this issue ended with my determination that it was some undiagnosed power issue related to backup battery voltage; I was not able to isolate the issue. Once again this is the case.

    I am tempted to write it off as a bad soldier joint or poor connection; it hurts my pride to admit such - I was a hearing aid technician for 20 years and close tolerance work was my bread and butter; yet, I cannot think of any other cause or issue that might manifest itself in so frustrating a way.

    I am looking now for a new DSO and I am convinced to get one with a logic analyzer. Issues like this are so demotivating...

    Thank you all for your suggestions and your effort and advice, I appreciate it very much.

Similar Threads

  1. I2C two master on one I2C display
    By Kmt in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 22nd September 2014, 20:44
  2. RFID Issues.... HELP !!!!!
    By andybarrett1 in forum mel PIC BASIC Pro
    Replies: 19
    Last Post: - 11th September 2014, 10:00
  3. EEPROM issues
    By timmers in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 25th March 2010, 16:19
  4. I2C Master Slave issues.
    By cpayne in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 29th March 2008, 19:33
  5. issues with 24lc1025
    By johnmiller in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 14th February 2008, 12:41

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