eeprom how many data can store


Closed Thread
Results 1 to 9 of 9
  1. #1
    Join Date
    Nov 2006
    Posts
    33

    Post eeprom how many data can store

    Hi all

    Could I store 365 data in the eeprom??????? I am using PIC16F84A.
    If can not, can u suggest me how many data that I can store in the eeprom or other places. Thanks.
    ************************************************** ********
    For example: I want to store time 12:13 pm into a place.

    a var word
    c var byte
    '
    'some initialization
    '
    On INERRUPT exit

    EEPROM 0, [$0c0d]
    main: READ 0,a.highbyte
    READ 1,a.lowbyte
    c= a.highbyte - 5 ' return 7am
    IF hour = c THEN ' check 7:13 am
    IF second = a.lowbyte THEN '
    low PORTB.0 ' motor start
    ENDIF
    ENDIF
    GOTO main
    DISABLE
    exit:

    'Interrupt will accur every 65.536 msec
    'some program code here to calculate time using tmr0 interrupt
    '

    INTCON.2 = 0 ' clear flag
    RESUME
    END



    **************************************
    The return value below is it correct ???????
    a.highbyte=$0c ' 12
    a.lowbyte= $0d ' 13
    c = 7

  2. #2
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    Have you looked at the DATASHEET for the 16F84?

    If you haven't please download it from the Microchip website.

    The size for the on-board EEPROM for any PIC is usually found on Page 1 of the Datasheet. You can determine if it is sufficient for your needs from there.

    Please Look at the DOCUMENTATION for the EEPROM command. You can only play with BYTES... therefore...

    EEPROM 0,[$0C,$0D]

    or

    EEPROM 0,[12,13]

  3. #3
    Join Date
    Nov 2006
    Posts
    33


    Did you find this post helpful? Yes | No

    Post mistaken and help

    First of all thanks to your reply and advice.
    Sorry for the mistaken. What i mean is c = a.highbyte + a.lowbyte.

    I have looked on the datasheet for the PIC16F84A, the space is 64 bytes for eeprom. I know it is impossible for me to store in the 365 data into the eeprom.
    Do you have any suggestion?
    How about other places such as program memory or RAM?
    I am thinking of using PIC16F876 but it is only 256 bytes only.

    I just want to store the time(sunrise time) for 365 day to anything places that available so that i can read it thru the date.
    for example: 1 jan 06 the sunrise time is 6:10 am
    2 jan 06 the sunrise time is 6:15 am
    and so on.

    Please advice and thanks you very much.....

  4. #4
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    Example run again...

    c = a.highbyte + a.lowbyte

    a.highbyte=$0c ' 12
    a.lowbyte= $0d ' 13

    c = $19 (25 Decimal)

    Remember if you are adding two BYTES together, the result may be bigger than a Byte...

    If a and b are hours and minutes, you can't just add them together... you must convert everything to minutes...

    c=(a*60)+b

    Use an external I2C EEPROM like a 24LC32 (4k) or 24LC64 (8k)for your storage (see I2CWRITE and I2CREAD commands in your PBP manual).

  5. #5
    Join Date
    Nov 2006
    Posts
    33


    Did you find this post helpful? Yes | No

    Post Change to PIC16F876A

    Hi all

    First of all ,thanks to Melanie again.

    I had planned to use the external eeprom but i have not knowledge on using.
    I had gone thru the PBP manual but I still cant catch it.
    Can you please guide me to the basic so that I could start it easily?
    The overall of the code I will do it on my own and if i got any question then I will ask you. Is that ok?
    I had planned to use the PIC16F876A due to shortage of my I/O port.
    Is that the same ways using the I2Write and I2Read?????

    Thanks

  6. #6
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    Example... this assumes that your external EEPROM has a device address of $A0 (see your chosen EEPROM's Datasheet) and is of the 24LC32/24LC64 type). SCL is the PIC pin you are using for the I2C Clock line, SDA is the PIC pin you are using for the I2C Data line.
    Code:
    	'
    	'	Subroutine Writes BYTE to External EEPROM
    	'	------------------------------------------
    SetDataExternal:
    		' I2CData - General BYTE variable
    		' I2CDeviceAddress - Hardware Device Address - BYTE variable
    		' I2CDataAddress - Address in EEPROM - WORD variable
    	I2CDeviceAddress=$A0
    	I2CWrite SDA,SCL,I2CDeviceAddress,I2CDataAddress,[I2CData]
    	Pause 10
    	Return
    and the opposite to read...
    Code:
    	'
    	'	Subroutine Reads BYTE from External EEPROM
    	'	-----------------------------------------
    GetDataExternal:
    		' I2CData - General BYTE variable
    		' I2CDeviceAddress - Hardware Device Address - BYTE variable
    		' I2CDataAddress - Address in EEPROM - WORD variable
    	I2CDeviceAddress=$A0
    	I2CRead SDA,SCL,I2CDeviceAddress,I2CDataAddress,[I2CData]
    	Return
    For further information lookup the I2CREAD and I2CWRITE commands in your PBP manual and compare the examples against the EEPROM Datasheet.

  7. #7
    Join Date
    Nov 2006
    Posts
    33


    Did you find this post helpful? Yes | No

    Post Erase the eeprom

    Hi Melanie

    Thanks you...

    Can I know do I need to erased the external eeprom (24LC32) once i write it or once I programmed it???

    Which mean that I have to use I2write command to write all the data (365's sunrise times to the external eeprom)?? So I have to put the I2write command right after the all declaration and initialization.

    Thanks to your basic guideline. I will try this out.
    Last edited by DragonBall_6; - 5th December 2006 at 10:54.

  8. #8
    Join Date
    Nov 2006
    Posts
    33


    Did you find this post helpful? Yes | No

    Post 2 interrupt at the same time

    Hi Melanie

    Can I know it is possible to use 2 interrupt in a single program as i am using PIC16F876A?

    (i) TMR0 using to create 1 second elapsed time to create date and time.
    (ii) TMR1 using as sending 4.32 second pulses to the stepper motor driver ucn5804B.


    It is possible ??

    Please advice..
    Thanks you very much.

  9. #9
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    The content of a new EEPROM is unpredictable, all locations should be set to $FF but this cannot be guaranteed. It is simple to bulk erase an EEPROM with your PIC programmer (always assuming your programmer is capable of handling EEPROMS).

    If you write to the EEPROM, the content is retained even with the power removed.

    Yes you can have as many interrupts as you want, but your program becomes more complex.

Similar Threads

  1. Data EEPROM gets clobbered during programming
    By BrianT in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 18th July 2008, 03:46
  2. Big characters on HD44780 4x20
    By erpalma in forum mel PIC BASIC Pro
    Replies: 23
    Last Post: - 7th January 2007, 03:21
  3. LCD + bar graph
    By DynamoBen in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 5th October 2005, 15:50
  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, 20:42
  5. Sinus calculating !
    By Don Mario in forum mel PIC BASIC Pro
    Replies: 29
    Last Post: - 29th November 2004, 00:56

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