loop write eeprom


Closed Thread
Results 1 to 14 of 14
  1. #1
    Join Date
    Jun 2006
    Location
    Greece
    Posts
    302

    Default loop write eeprom

    I have this code and i wonder if the eeprom is write continues or only if i push any button;

    LOOP:

    Button UP,1,10,2,b1,1,MONTE 'supervise the button UP
    Button DOWN,1,10,2,b2,1,DESCEND 'supervise the button DOWN
    Button CH_PAS,1,255,0,b3,1, CHOIX 'supervise the button PAS
    PAUSE 100 'pause of 0.1s
    I2CREAD SDA,SCL,ADDR2,[LOCK] 'check if pll is lock
    WRITE 0, TMP_LO 'Store the 8 bits of weak weight of TMP in the EEPROM with address 0
    WRITE 1, TMP_HI 'Store the 8 bits of strong weight of TMP in the EEPROM with address 1
    GoTo LOOP
    Last edited by savnik; - 13th August 2006 at 13:22.

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Yup, it writes to the EEPROM on every loop.

    With the PAUSE 100 in there, it will take only 2 hours and 45 minutes to completely use up the available 100,000 write endurance limit of a 16F877 or equiv.

    Hope you haven't left it powered up

    DT

  3. #3
    Join Date
    Jun 2006
    Location
    Greece
    Posts
    302


    Did you find this post helpful? Yes | No

    Default

    I change the code and i believe now it's OK.

    MAIN:

    bla ... bla ...
    bla ... bla ...
    bla ... bla ...

    LOOP:

    Button UP,1,10,2,b1,1,MONTE
    Button DOWN,1,10,2,b2,1,DESCEND
    Button CH_PAS,1,255,0,b3,1, CHOIX
    PAUSE 100
    I2CREAD SDA,SCL,ADDR2,[LOCK]
    GoSub AFFICHAGE
    GoTo LOOP

    MONTE: '** INCREASE THE FREQUENCY OF 1 PAS (STEP)

    TMP = TMP + PAS
    If TMP > 410 Then TMP = 0
    GOSUB MEM
    GoTo MAIN

    DESCEND: '** DECREASE THE FREQUENCY OF 1 PAS (STEP)

    If TMP<PAS Then RAZ_TMP
    If TMP = 0 Then TOP
    TMP = TMP - PAS
    GOSUB MEM
    GoTo MAIN

    TOP:

    TMP=410
    GOSUB MEM
    GoTo MAIN

    RAZ_TMP:

    TMP = 0
    GOSUB MEM
    GoTo MAIN

    MEM:

    WRITE 0, TMP_LO
    WRITE 1, TMP_HI
    Return
    Last edited by savnik; - 13th August 2006 at 23:31.

  4. #4
    Join Date
    Jun 2006
    Location
    Greece
    Posts
    302


    Did you find this post helpful? Yes | No

    Default

    it's ok now;

  5. #5
    Join Date
    Jun 2006
    Location
    Greece
    Posts
    302


    Did you find this post helpful? Yes | No

    Default

    any help ;

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by savnik
    it's ok now;
    Where is the 'question mark' ?
    What do you expect?
    What is the real question?
    Steve

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

  7. #7
    Join Date
    Jun 2006
    Location
    Greece
    Posts
    302


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by savnik
    I change the code and i believe now it's OK.

    MAIN:

    bla ... bla ...
    bla ... bla ...
    bla ... bla ...

    LOOP:

    Button UP,1,10,2,b1,1,MONTE
    Button DOWN,1,10,2,b2,1,DESCEND
    Button CH_PAS,1,255,0,b3,1, CHOIX
    PAUSE 100
    I2CREAD SDA,SCL,ADDR2,[LOCK]
    GoSub AFFICHAGE
    GoTo LOOP

    MONTE: '** INCREASE THE FREQUENCY OF 1 PAS (STEP)

    TMP = TMP + PAS
    If TMP > 410 Then TMP = 0
    GOSUB MEM
    GoTo MAIN

    DESCEND: '** DECREASE THE FREQUENCY OF 1 PAS (STEP)

    If TMP<PAS Then RAZ_TMP
    If TMP = 0 Then TOP
    TMP = TMP - PAS
    GOSUB MEM
    GoTo MAIN

    TOP:

    TMP=410
    GOSUB MEM
    GoTo MAIN

    RAZ_TMP:

    TMP = 0
    GOSUB MEM
    GoTo MAIN

    MEM:

    WRITE 0, TMP_LO
    WRITE 1, TMP_HI
    Return
    is the code now OK;

  8. #8
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,650


    Did you find this post helpful? Yes | No

    Talking Savnik ... not Spoutnik !!!

    Hi, Steve ...

    may be the problem is here :

    If TMP If TMP = 0 Then TOP

    That works only vith very aged PIC's ...

    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 " !!!
    *****************************************

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


    Did you find this post helpful? Yes | No

    Default

    Alain, yeah i saw that one too... copy/paste mistake i guess.

    Quote Originally Posted by Acetronics
    That works only vith very aged PIC's
    Vith?

    Quote Originally Posted by Savnik
    is the code now OK;
    i still searching the question mark but YES it looks OK.

    any problem with your keyboard
    ?????????????????????????????????
    Steve

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

  10. #10
    Join Date
    Jun 2006
    Location
    Greece
    Posts
    302


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e
    Alain, yeah i saw that one too... copy/paste mistake i guess.


    i still searching the question mark but YES it looks OK.

    any problem with your keyboard
    ?????????????????????????????????
    Yes is copy/paste mistake
    The question was :
    I have this code and i wonder if the eeprom is write continues or only if i push any button;
    I make some changes above , but i don't know if the eeprom is write continues still
    The code work very well

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


    Did you find this post helpful? Yes | No

    Default

    As i said.. it looks good to me now @4:30 AM, after night-clubbing, dee-jay'ing, dancing and drinking and everything i can't say on a public forum finishing by 'ing'

    What you can do for your own persual... Blink a led every time you write to your EEPROM.

    High LED
    WRITE . . .
    Pause x
    LOW LED
    Steve

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

  12. #12
    Join Date
    Jun 2006
    Location
    Greece
    Posts
    302


    Did you find this post helpful? Yes | No

    Smile

    Quote Originally Posted by mister_e
    As i said.. it looks good to me now @4:30 AM, after night-clubbing, dee-jay'ing, dancing and drinking and everything i can't say on a public forum finishing by 'ing'

    What you can do for your own persual... Blink a led every time you write to your EEPROM.

    High LED
    WRITE . . .
    Pause x
    LOW LED
    I feel envy
    How write the code in my programm , to blink the led every time the programm write to eeprom;

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


    Did you find this post helpful? Yes | No

    Default

    i thought it was clear enough.. ok let's try once again.
    MEM:
    HIGH LED
    WRITE 0, TMP_LO
    WRITE 1, TMP_HI
    pause 250
    LOW LED
    Return
    Steve

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

  14. #14
    Join Date
    Jun 2006
    Location
    Greece
    Posts
    302


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e
    i thought it was clear enough.. ok let's try once again.
    MEM:
    HIGH LED
    WRITE 0, TMP_LO
    WRITE 1, TMP_HI
    pause 250
    LOW LED
    Return
    THANK YOU VERY MUCH
    Maybe i am blunt

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. Controlsystem for compact sporting (clay shooting)
    By Fredrick in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 30th July 2009, 16:48
  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, 14:19
  4. Microcontroller with 2 way paging application problem
    By oneohthree in forum mel PIC BASIC Pro
    Replies: 30
    Last Post: - 20th April 2007, 17:27
  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