Well Darrel, you're absolutely right of course ...
I tried it about 100 times and couldn't get it to work. Then other real life problems cropped up and I had to set it aside for a couple weeks .
Now that I've got time to work with it again, it works *perfectly*, just as advertised.
There was obviously a problem with that little lump of gray matter between my ears, but it seems to be better now...
Sorry to bother you. Thanks for your help.
Steve
Hi, I have incorporated EE_Vars into my project. I have replied to to this thread previously and mentioned two things in particular. I have changed 'EE_start' to 511 (I am using an 18F2525) because I am using the bottom half of the EEProm for some other functions. I only mention it as it a modification to the original program and may give an insight to my problem. The other thing is I discovered that while using MicroCode Studio I must have Loader Options set to program Data of the EEProm and Variables do not get intitialized.
My problem is that sometimes the EEProm and Variables get reinitialized after the initial programming is done. I do not have anything in my program that sets EE_Start to zero or resets it. This happens when I first power up, doesn't happen all the time. Sometimes I notice it when I pull a chip out of board after turning off power and put it in another board then power up. It seems kind of random.
The start of my progam looks like this:
INCLUDE "Defines.bas"
INCLUDE "EE_Vars.PBP" 'Darrel Taylors EE_Vars program
INCLUDE "VarDefs.bas" 'Define vars and use EE_Vars routines
Goto start ;Jump over assembly routine
INCLUDE "AsmInt.bas" ;Assembly interrupt service routines
INCLUDE "LcdText.bas" ;Strings, lookup tables
'------------GetAddress Macro - Location insensitive --------------------
ASM
GetAddress macro Label, Wout ; Returns the Address of a Label as a Word
CHK?RP Wout
movlw low Label
movwf Wout
movlw High Label
movwf Wout + 1
endm
ENDASM
start:
INCLUDE "Init.bas" ;Initialize I/O
INCLUDE "InitVars.bas" ;Initialize Variables
INCLUDE "ModSerVer.bas" ;to configure my model, serial, version
Having a hard time figuring this one out. Any help would be appreciated.
Thanks, Bob
How much of the "bottom half" are you using?I have changed 'EE_start' to 511 (I am using an 18F2525) because I am using the bottom half of the EEProm for some other functions.
Technically, 511 is in the "bottom half".
<br>
DT
Well I'm not using all of it. I picked 511 as I thought it was midway. I used to use chips that only had 255 bytes of EEProm before I started using EE_Vars. So I just picked 511 randomly and started moving Vars to it. Some of them can't be used this way so I left them at the beginning. Do you think it has an effect on the operation?
Thanks, Bob
Without knowing how you are using the lower half, there's no way to answer that.Do you think it has an effect on the operation?
If you are using a variable to access lower EEPROM locations, you could be accidentally overwriting other locations if you're not careful.
If location 511 gets overwritten at any point along the way, it will automatically restore the default values on the next Reset. So it doesn't surprise me that it only happens when you unplug the chip or turn off power.
If you are unsure of whether or not it gets overwritten, you can use the EEIF interrupt which triggers after every WRITE completion. Then in the handler ... Read back 511 and see if it's changed. If it has changed, an address in the routine that changed it will be sitting on the stack (TOS).
<br>
DT
Ok, I see what your saying. As I said it seems random. I don't believe I am accessing any EEPROM addresses up at 511 but I have some checking to do. Is it true that the reset will occur only if '511' or EE_start is set to Zero? If it's not zero then a reset will not occur correct? I suppose if it is set to some other number it would only load the EE_vars up to the number it is set to.
I do have a timed interrupt routine that writes into one of the first 62 bytes of EEProm once a minute. When you said 'if your not careful' did you mean something could be happening that I may not be aware of or that there would be something I can spot in my program that would be causing the overwrite?
Thanks, Bob
Bookmarks