loop write eeprom


Closed Thread
Results 1 to 14 of 14

Hybrid View

  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;

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