EEPROM writes and reads


Results 1 to 7 of 7

Threaded View

  1. #1
    Join Date
    Feb 2008
    Location
    Michigan, USA
    Posts
    231

    Default EEPROM writes and reads

    Hi all,

    Having a bit of a problem with the EEPROM access.

    Trying to save a mode setting so that if I re-power, it comes back in the last state. Here is the portion that I'm having the most trouble with. I know that there is ~10mS on the WRITE, and that makes sense. Can't find in the datasheet where that applies to the READ. I'm not jumping into the "StoreMode" sub, so I'm having troubleshooting it. It doesn't seem to be saving in EE.
    Does the WRITE dwell in that line of code for the 10mS, or do you need to set up a wait (or check the flag)?

    Code:
    '**************************************************   
    'Timing Sub
    '****************************************************
    DlyTime:
         for Dly = speed to 0 step -1
         READ 0,ModeStore
         if modestore <> modecnt then StorMode
         'READ 1,Speed   ' get the stored SPEED when entering: LATER OPTION
         'IF Speed <> StorSpeed THEN StoreMode :LATER OPTION  
         next Dly
    return   
    StorMode:
         modeStore = ModeCnt     ' update ModeStore to new ModeCnt
         'Speed = StoreSpeed      ' update the speed value: LATER OPTION
         hserout ["StorMode ",dec modeStore,10,13]   'verify jump to StorMode: DEBUG
         'hserout ["StoeSpeed ",dec Speed,10,13]   'verify Speed Change:       DEBUG   
    @ INT_DISABLE RX_INT         ; disable to allow the WRITE
    @ INT_DISABLE  TMR1_INT      ; MAY need to disable SPWM_INT for READ to work
         write 0, modestore      ' re-save the ModeCnt into EEPROM.0
         'WRITE 1, Speed          ' save the speed value into EEPROM.1: LATER OPTION
    @ INT_ENABLE  TMR1_INT       ; MAY need to re-enable SPWM_INT
    @ INT_ENABLE RX_INT          ; disable to allow the WRITE
         
    return
    I have attached the whole program so that it can be seen in context if that helps. If you do choose to look at the whole thing, I apologize ahead of time. It's not completely cleaned up yet, and I am definitely open to suggestions on improvements ;-}

    Thanks, as always, for your time.
    Bo

    Legit PBP 2.47, MPASM 5.20, 16F877A on a LABX-1
    Attached Files Attached Files

Similar Threads

  1. Serial EEPROM
    By William in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 10th July 2009, 18:09
  2. PIC16F690 - 24LC08B: they won't talk...
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 24th May 2008, 22:32
  3. Multiple Pics accessing single EEPROM
    By Atom058 in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 3rd February 2008, 17:22
  4. Replies: 5
    Last Post: - 16th February 2006, 23:43
  5. Writing / Reading EEPROM 24LC256 Problem
    By schmoddel in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 27th February 2004, 18:55

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