Connect with us

PIC and EEPROM modules

Discussion in 'Electronic Design' started by [email protected], Jan 9, 2008.

Scroll to continue with content
  1. Guest

    Hi guys

    I'm currently using a PIC16F84 for a project. I need to use more
    EEPROM than I have on the chip. So I'm considering adding a memory
    module to store the additional data. I have no idea what my options
    are, which will be the easiest to implement etc.

    I dont even need the PIC to write the data to the EEPROM. I would like
    to use my computer to program the EEPROM (max 1Mb) and then just use
    the PIC to read it (I do the same currently with the PIC. Write EEPROM
    data with the pic programmer and then read the data with the PIC).

    I've been to microchip's website but I don't really get a noobguide to
    what my choices are. Seems like there's at least two architechtures
    I2C and SPI. Which will be best? Any suggestions?

    Thanks
     
  2. donald

    donald Guest

    Some design considerations.

    How many pins do you have left on the 16F84 ?

    How much code space do you have left in the 16F84 ?

    The 16F84 does _not_ have an SPI or I2C controller on board.
    You will need to bit-bang the lines to the external EEPROM.

    With these assumption, what can you do with your design ?

    Also, getting any data from your PC into the EEPROM.
    Do you have an external programmer, do you want to code another PIC to
    interface to a serial/parallel port on your PC.

    Do you want to remove the EEPROM from the target board to reprogram it ?

    All these things can be done, you need to make a decision about what you
    want to do.

    One last thing, are you programming in assembly or C ?

    donald
     
  3. Typically I2C is cheaper, slower, more complex to implement and uses
    only two pins (with bus pull-up resistors). SPI is simple, fast, uses
    more I/Os and the chips might cost more. I use both.. it just depends
    on the requirements. There's also a third architecture (Microwire)
    which is similar to SPI (eg. the old 93C46).

    Best regards,
    Spehro Pefhany
     
  4. Guest

    Hi Spehro

    Do you have a link or something for a simple diagram and tutorial?
    can you program any of these EEPROM modules with data using your PC?
    Or can you only write to them with the PIC?
     
  5. Try googling for PIC I2C master or SPI master (you'll want the micro
    to be master and the EEPROM to be slave). Google on the I2C standard
    (from Philips) as well.. there is more than one possible speed etc.

    These are chips, not modules, typically in something along the lines
    of a SOIC-8, DIP-8, SOT-23-5 or whatever.

    You can program them from a PC using an appropriate programmer device,
    or possibly by hacks on the old-style parallel port and a bit of
    software. Look around, you'll find some stuff.

    Here's a suitable I2C 1Mbit part:
    http://ww1.microchip.com/downloads/en/DeviceDoc/21941E.pdf

    And an SPI part:
    http://ww1.microchip.com/downloads/en/DeviceDoc/22064A.pdf

    (in this case the SPI part is cheaper).

    And a cheaper I2C part from Atmel:
    http://www.atmel.com/dyn/resources/prod_documents/doc5194.pdf

    If data integrity is of importance to you, you may wish to use one
    that has hardware write protection.

    Best regards,
    Spehro Pefhany
     
  6. Here is a small program in C to write via the part port to a 24C16
    EEPROM.
    It can also do bigger EEPROMs, scroll down to 'eeprog'.
    http://panteltje.com/panteltje/satellite/index.html

    This needs only 3 external components (2 resistors, 1 diode).
    Been 6 years since I wrote that, dont't remember anything more,
    but at least once I also had PIC 16F84 asm code to read that EEPROM.
     
  7. Since the F84 doesn't do either in hardware, you'll have to bit bang them.
    I2C will take two pins and SPI will take three at least. SPI is faster and
    probably easier to write the code for. If you can, I suggest looking at the
    16F88 as a pin compatible replacement with many more features. Price is
    cheaper even.

    I have some code I could give you that will bit-bang I2C to an EEPROM. It's
    not a strict implementation though, it doesn't check for ACKs. Outside
    that, it worked great for months on end in a data logger project I was
    tinkering on.
     
  8. Ben Jackson

    Ben Jackson Guest

    Even if you don't upgrade to a remotely modern PIC to get builtin SPI
    or I2C, it's worth downloading the datasheets because they explain those
    busses very clearly. AVR used to be a little worse in that area, but
    I know the Atmega88/48 datasheet also has good explanations of those
    busses.

    Personally I'd look into using a MMC card if it's a logger project.
    Then you can read the data with a PC.
     
  9. Guest

    Hi

    I really have a quite simple program. So I'm flexible on changing pics
    etc. I need to do something like a clock which plays a different tune
    every 15 minutes. The tunes are stored in the memory. So I want to use
    a computer to program the tunes into the memory module. If that
    doesn't work I'm willing to program another chip to program the
    memory, but I'd prefer to use the PC straight on the memory module. I
    use a K149 USB hardware pic programmer. I use assembly (trying to keep
    it elementary). I'm more than willing to remove the EEPROM to
    reprogram.

    BTW: I know the DE command to program pic EEPROM from the PC. Can I
    somehow program the pic memory RAM that way as well? It's REALLY
    difficult to search in google for DE, DT and other 2character
    commands. Does anyone have a link of how to program pic memory RAM (in
    a similar way that you program EEPROM on the pic)

    Thanks!
     
  10. donald

    donald Guest

    Ok,

    The design spec is to read a EEPROM device, thats been programmed
    somewhere else.

    To help a little you can look at:
    http://www.piclist.com/techref/microchip/i2c.htm

    What does the DE command have to do with the EEPROM ??

    If you picked out an EEPROM device and looked at its data sheet, you
    would know by now.
    good luck

    donald
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-