Storing values on pic16f887

Discussion in 'Embedded Systems and Microcontrollers' started by quantumlab, Jan 8, 2009.

  1. quantumlab

    Thread Starter Member

    Dec 4, 2008
    Im using a PIC to store and display varying voltage values in real time. I would like to store these values onboard the PIC for future analyis,is this possible? Would like to have a sampling rate of once a second.The sensor will be running up to an hour. We are using MICROC on a PIC16F887.

    Any help would be appreciated
  2. mik3

    Senior Member

    Feb 4, 2008
    Yes, you can use the built-in EEPROM of the PIC to store values for future use. I am not sure if this PIC has enough EEPROM for your application. If not look for another one with bigger EEPROM capacity.
  3. Alberto

    Active Member

    Nov 7, 2008
    Noway! assuming your data is at the minimum two bytes long, then sampling every second for one hour means 7200 bytes. No 16F series pics have so much eeprom on board. You must use external memory.

  4. futz


    Dec 14, 2008
    3600 seconds in an hour. Say your values are 8-bits. That means you'll need no less than 3600 bytes of non-volatile storage. If your values are 10-bit (call it 16-bit then) you'll need at least 7200 bytes. No PIC has that much internal EEPROM.

    If your program is fairly small and you have leftover flash program memory you could maybe write it there.

    I would suggest getting a Microchip 24LC256 EEPROM (256K-bit and around $2.50) or 24LC1024 Flash (1024K-bit and around $7.50) chip. Both have enough space for your project - the 256 is 32K bytes, and the 1024 is 128K bytes. The 256 uses an I2C interface and the 1024 uses SPI. SPI is easier to implement, IMHO.

    If you want to run it for longer periods than will fit in the above chips, look at SD cards. They're simple to interface (SPI) and not too difficult to code for. Vast amounts of storage for dirt cheap. :p You can buy a 2GB card for six bucks or less.