EEPROM Variables (EE_Vars.pbp)


Closed Thread
Results 1 to 40 of 80

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default Time well spent

    Quote Originally Posted by Byte_Butcher View Post
    So... why does it demand lowercase on one side of the definition and uppercase on the other?
    It doesn't.

    The only one that has to be in upper case is the one in the EE_var declaration. (right side)
    There is a "case sensitive" note in post#4, EE_var section.

    Case doesn't matter on the VAR statement.

    I've double checked it here to be sure.
    DT

  2. #2
    Join Date
    Jan 2009
    Location
    California, USA
    Posts
    323


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor View Post
    It doesn't.

    The only one that has to be in upper case is the one in the EE_var declaration. (right side)
    There is a "case sensitive" note in post#4, EE_var section.

    Case doesn't matter on the VAR statement.

    I've double checked it here to be sure.

    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

  3. #3
    Join Date
    Feb 2006
    Posts
    20


    Did you find this post helpful? Yes | No

    Default EE_Vars resetting

    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

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


    Did you find this post helpful? Yes | No

    Default

    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.
    How much of the "bottom half" are you using?

    Technically, 511 is in the "bottom half".
    <br>
    DT

  5. #5
    Join Date
    Feb 2006
    Posts
    20


    Did you find this post helpful? Yes | No

    Default Bottom Half

    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

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


    Did you find this post helpful? Yes | No

    Default

    Do you think it has an effect on the operation?
    Without knowing how you are using the lower half, there's no way to answer that.

    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

  7. #7
    Join Date
    Feb 2006
    Posts
    20


    Did you find this post helpful? Yes | No

    Default

    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

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. Problem with I2C EEPROM addressing
    By Atom058 in forum General
    Replies: 14
    Last Post: - 3rd November 2009, 03:17
  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. How to write/read strings EEPROM/LCD
    By g-hoot in forum mel PIC BASIC Pro
    Replies: 22
    Last Post: - 11th February 2007, 06:26
  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 : 1

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