Saving numeric data to eeprom from array


Closed Thread
Results 1 to 6 of 6
  1. #1

    Default Saving numeric data to eeprom from array

    Hello everyone,
    Can anyone guide me how to save/write the content of variable mydata[5] which consist of '98765' to the internal eeprom...


    Thanks,
    joe

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898

    Default

    You need to use WRITE statement.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  3. #3
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    947

    Default

    ' originally posted EEdata var byte [5] ' make space for mydata in eeprom
    EEdata Data 0 ' This is where the data is written to in eeprom, initial value is 0


    Cntr var byte ' counter to index the array

    ' write the data to the eeprom
    for Cntr = 0 to 4
    write EEdata+Cntr, mydata[cntr]
    next

    ' done
    Last edited by Jerson; - 11th December 2007 at 04:41. Reason: Correction

  4. #4

    Default

    Thanks everyone for the responce, here is what I'm trying to do...kindly guide me.

    Data @0, 5 ,"29690" 'initially saved to memory

    -to check if the code is the same with the data stored in the eeprom, Lookdown() is used for security password.
    What i'm trying todo is to change "29690" with this code..
    ************************************************** *******
    ' Saving to EEPROM
    @ READKEYPAD _myvar
    if scroll = 3 then
    Serout PortC.1, 6, [$FE,1]
    Serout PortC.1, 6, [$FE,$C0]
    for countera = 0 to 4
    @ READKEYPAD _Key
    Serout PortC.1, 6, [$FE,($C0+5),"["]
    Serout PortC.1, 6, [$FE,($C0+6+COUNTERA),"*"]
    Serout PortC.1, 6, [$FE,($C0+7+COUNTERA),"]"]
    code[countera]=key
    Write countera+1, code[countera] ; write the digit to EEPROM
    next countera
    Serout PortC.1, 6, [$FE,1,"Saving..."]
    pause 1000
    WRITE 0,5
    Endif
    **************************************
    'To check if the new number is saved I used this code...
    @ READKEYPAD _Key
    if key = 11 then
    read 0,code
    serout PortC.1, 6, [$FE, 1,#code]
    pause 1000
    for countera = 0 to 4
    read countera+1,code
    serout PortC.1, 6, [$FE, $82+countera,#code]
    pause 1000
    next countera
    Endif

    it shows that i succeeded overwriting the "29690" using the above code, But when I try to use it for password entry using the Lookdown(), I get Access denied.
    Originally the code is from Darrel and Steve.


    Thanks,
    Joe

  5. #5
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898

    Default

    Did you refresh the array which hold the code?

    What happen when you remove the power and reconnect it? Is the new code works?

    With the whole code, it will be easier so far..
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  6. #6

    Thumbs up writing and reading to eeprom success...

    Hi everyone,
    I got the code working as I intended to, thanks for the guide...now I can write and read to the eeprom. I realized that there is a need for convertion to hex.

    Thanks to all,
    joe

Similar Threads

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