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
Bookmarks