Write and Read from eeprom


Closed Thread
Results 1 to 24 of 24

Hybrid View

  1. #1
    Join Date
    Jun 2007
    Posts
    26


    Did you find this post helpful? Yes | No

    Default reply

    Its the internal eeprom of the pic16f84a

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by jason View Post
    Its the internal eeprom of the pic16f84a
    uhh...der...it sure is...dumb question on my part...


    Break it down, get it simple, get rid of all of that other stuff in your program, make something seriously simple, and build it back up. There is a bit of a logic error in your program that'll probably cause your symptoms.

  3. #3
    Join Date
    Jun 2007
    Posts
    26


    Did you find this post helpful? Yes | No

    Default ok, I did it

    Thank you for your quick help on this

    Ok I did as you suggested

    I made a new file, and slowly added until I had a problem. I'm not sure if this is the problem with my "write" but I wouldn't doubt it, due to some sort of overflow.

    here I am trying to get a percentage of a word sized integer


    percent=35
    example: A=65535 * .35 or A=(65535*100) /35

    '-----------
    A = TOTAL * 100 'A is temporary storage of computation
    A = DIV32 PERCENT 'using DIV32... B can be any integer up to 65534
    '-----------

    if total=100 wouldn't A=35 ???


    I'm not familiar with DIV32 at all, I read up on it and understand somewhat how it works, becuase PBP can't deal with numbers larger than a "word" it uses this as a temperary variable so that people like me can do this type of math, right ?

  4. #4
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Post EEPROM and index ...

    Hi, Jason

    Did you had a look to THAT Thread ???

    http://www.picbasic.co.uk/forum/showthread.php?t=1078

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  5. #5
    Join Date
    Jun 2007
    Posts
    26


    Did you find this post helpful? Yes | No

    Default uuuuuh ?????

    WOW

    I think that is my problem here. However I only understood a little bit of it.

    Why is this so complicated just to store a word ?

    OK, so I thought storing total.byte0 in location 0 and then storing total.byte1 in location 1 would handle the whole word right ?
    '----------------------------------------------------------------------
    total=33024 or total.byte0=10000000 and total.byte1=11111111
    write 0,total.byte0
    write 1,total.byte1

    If so then in location 0 would be 10000000 and in location 1 would be 11111111
    or is this wrong ?

    if it is right then I can't get that data back the same way ?

    read 0,total.byte0
    read 1,total.byte1

    total=33024

    if not then what ???? I'm more confused then before, but I think your on the right track

  6. #6
    Join Date
    Mar 2005
    Location
    Iowa, USA
    Posts
    216


    Did you find this post helpful? Yes | No

    Default

    total=33024
    Binary(33024) = %1000000100000000
    total.BYTE1 = %10000001
    total.BYTE0 = %00000000

    Quote Originally Posted by PBP Manual
    To write a word, each of the 2 bytes that make up the word must be
    written separately:
    w Var Word
    WRITE 0,w.BYTE0
    WRITE 1,w.BYTE1
    Last edited by rhino; - 8th June 2007 at 20:38.
    Wisdom is knowing what path to take next... Integrity is taking it.
    Ryan Miller

  7. #7
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    And there be the logic error I thought I saw earlier...
    Now build you program up and see what happens...then we can work on optimizing that program a bit. I looks a bit of a mess...not too bad, but could be better...

  8. #8
    Join Date
    Jun 2007
    Posts
    26


    Did you find this post helpful? Yes | No

    Default just an example,

    thank you for setting me straight, however that didnt answer my question. am i reading the data back to "total" correctly ?

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. Problem with I2C EEPROM addressing
    By Atom058 in forum General
    Replies: 14
    Last Post: - 3rd November 2009, 03:17
  3. write -read problem?
    By turkuaz in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 30th August 2009, 13:06
  4. PIC16F684 + LCD to use the 256bytes of EEPROM - HELP
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 7th March 2008, 14:19
  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