External EEPROM can't read/write


Closed Thread
Results 1 to 17 of 17

Hybrid View

  1. #1
    Join Date
    Oct 2005
    Location
    Las Vegas, Nevada, USA
    Posts
    27


    Did you find this post helpful? Yes | No

    Default Word Size Address

    Darrel, I started this mess with a word sized address without highbyte, lowbyte. I found in another thread that the high-low byte addressing worked for someone, and when it didn't work for me, I made my first post in this tread with my code at the time.

    However, I changed the 16F877 a third time and it's working! Is it possible that some PICs just don't work with I2C? Prior to finding a working 16F877, I tried two other 16F877's and a 16F876A. All failed to work properly.

    Is it possible I had the circuit wrong? I can't go back and try a PIC that failed because they are all in their respective parts' bins with others of the same type. The most complicated part of my circuit is the MAX233, and it worked properly the first time. The 24LC256 is simple: Pins 1 to 4, and 7 to gnd, pin 8 to 5V, pin 5 pulled-up and to c.4, and pin 6 pulled-up and to c.3.

    Anyway, thank you all. You kept me motivated to keep trying. All I can say to anyone reading this tread with a similar problem is just keep trying different components, and periodically, start your breadboarding all over again. As stated above I tried four different PICs, and I re-wired my circuit at least four times. This is the code that works:

    Code:
    @ DEVICE HS_OSC, WDT_OFF, LVP_OFF, BOD_OFF, PWRT_OFF, PROTECT_OFF
    
    DEFINE	LOADER_USED	1
    DEFINE    OSC 20
    addr      var       word
    edata     var       BYTE
    addr = 0
    edata = 50
    pause 100
    for addr = 5 to 10
         I2CWRITE portc.4,portc.3,$A0,addr,[edata],Nowriteack
         pause 10
         serout2 portc.6,32,[dec addr,44,32,dec edata,10,13]
         edata = edata + 10
    next
    for addr = 5 to 10
         i2cread portc.4,portc.3,$A0,addr,[edata],NoREADAck
         serout2 portc.6,32,[dec addr,44,32,dec edata,10,13]
    next
    end
    NoWriteAck:
    serout2 portc.6,32,["No Write Acknowledgement",10,13]
    return
    NoReadAck:
    serout2 portc.6,32,["No Read Acknowledgement",10,13]
    return
    I've attached a picture, which was the objective of this exercise. It's rough, but at least I can move on to improvements and new challenges.
    Attached Images Attached Images  
    Last edited by coyotegd; - 13th May 2008 at 05:10. Reason: Add picture

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by coyotegd View Post
    ... I tried two other 16F877's and a 16F876A. All failed to work properly. ...
    I can't go back and try a PIC that failed because they are all in their respective parts' bins with others of the same type.
    Is it possible that some PICs just don't work with I2C?
    I doubt that very strongly.

    But, I would imagine that putting parts that have had problems back in the bin with the new chips, would enhance the probability considerably.

    Anyhow, glad it's working.

    Cheers,

    Added: Woohoo! Nice picture.
    Last edited by Darrel Taylor; - 13th May 2008 at 05:20. Reason: WooHoo.
    DT

  3. #3


    Did you find this post helpful? Yes | No

    Default

    In the past I've had a lot of sporadic problems with i2c and breadboards as well...I suspect your problem was solved somehow when rewiring the breadboard... My problems always went away when soldering my prototypes... Hope this helps...

Similar Threads

  1. Can't read sequential addresses in external EEPROM
    By tjkelly in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 18th February 2010, 14:46
  2. Replies: 1
    Last Post: - 28th January 2010, 22:15
  3. How to write/read strings EEPROM/LCD
    By g-hoot in forum mel PIC BASIC Pro
    Replies: 22
    Last Post: - 11th February 2007, 06:26
  4. Internal EEPROM Read/write Addressing Errors with 18F PIC's
    By Melanie in forum FAQ - Frequently Asked Questions
    Replies: 18
    Last Post: - 12th July 2005, 19:42
  5. word variable to 25lc640
    By TONIGALEA in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 6th July 2004, 19:59

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