Write and Read from internal Memory


Closed Thread
Results 1 to 11 of 11

Hybrid View

  1. #1
    Join Date
    Nov 2007
    Location
    Cebu, Philippines
    Posts
    14

    Default thank you

    I see..
    Thank you so much Melanie..

    I really learn a lot from this forum.

    Cheers!

    ria

  2. #2
    Join Date
    Nov 2007
    Location
    Cebu, Philippines
    Posts
    14

    Default PBP vs PBPW

    By the way Melanie..why we need to use PBPW instead of PBP in compiling?

    What's the difference between them?

  3. #3

    Default

    Hi Melanie,
    I got your code running, initially I placed '9999' at memory location 0. I'm trying
    to read it from the internal memory, So I try this code below. But when I press the button I got '655535'
    instead the initial value '9999'.



    TRISB=%00010000 ' All PortB is Output - except
    ' B.3 = Button
    TRISC=%00000000 ' All PortC is Output
    CMCON=%00000111 ' Disable Comparators
    CVRCON=%00000000 ' Disable Reference Module
    OPTION_REG.7=0 ' Enable Weak Pull-Up's
    Pause 2000
    ButtonPRESS var PortB.4 ' Push Button
    WORDVariable var WORD

    PromptLoop:
    Serout PortC.1,6, [$FE,1,"Press Button..."]
    While ButtonPRESS=1:Wend ' Wait here until Button Pressed
    READ 0,WORDVariable.HighByte ' Reconstruct Word variable from EEPROM
    READ 1,WORDVariable.LowByte
    Serout PortC.1,6, [$FE,1,"Reading=",#WORDVariable] ' Display Result
    While ButtonPress=0:Wend ' Wait here as long as finger is on Button
    Goto PromptLoop
    '
    End

    Thanks for the time, appreciate it very much,
    joe

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

    Default

    Make sure your PIC programmer program the EEPROM location, unless.. you may read an empty EEPROM $FFFF

    Now depending of how you wrote your DATA line, this may work.. or not.

    Code:
    data  @0, WORD 9999
    should work.

    Your PICProgrammer software should allow to see the EEPROM section, just compile your code, import the .HEX and look if your data is saved in the EEPROM.
    Last edited by mister_e; - 24th November 2007 at 18:17.
    Steve

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

  5. #5

    Question Data in Address 0 keeps overwriting...

    Thanks all, I got it to work. But I've noticed that every time I compile it the data '9999' in Address 0 restarts to 655535. How can I prevent it from overwriting. So that every time I check Address 0 the same data will show.



    Thanks all,
    joe

Similar Threads

  1. write -read problem?
    By turkuaz in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 30th August 2009, 14:06
  2. Write Onewire data toa I2C memory / read ASCI
    By Eugeniu in forum mel PIC BASIC Pro
    Replies: 67
    Last Post: - 16th November 2008, 20:19
  3. PIC16F684 + LCD to use the 256bytes of EEPROM - HELP
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 7th March 2008, 15:19
  4. Need the code to write to a memory
    By Hamlet in forum General
    Replies: 0
    Last Post: - 20th August 2007, 01:22
  5. Read / Write , To / From Internal EEPROM
    By charudatt in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 31st October 2003, 03:23

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