• AVR Freaks

Hot!Defining EEPROM contents at a specific location - PIC16F690. XC8 version 2.00

Author
edware
Starting Member
  • Total Posts : 33
  • Reward points : 0
  • Joined: 2009/01/04 22:41:19
  • Location: 0
  • Status: offline
2019/07/18 01:21:27 (permalink)
0

Defining EEPROM contents at a specific location - PIC16F690. XC8 version 2.00

Hi all
I have used both of the following methods to define EEPROM contents for a PIC16F1844 device at a specific location
const unsigned char info2[] __at(0xF0D4) = __DATE__;
eeprom unsigned char buildinfo2[] __at(0xF0D4) = __DATE__;

 
I would like to achieve the same with a PIC16F690, however my testing shows this method doesn't appear to work for the '690.
Using the following method doesn't allow me to insert pre-defined macros easily.
__EEPROM_DATA(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF);

 
I have used the method below for earlier XC8 versions, but doesn't work with XC8 version 2.00 (c99), plus it's a little cumbersome and awkward to specify it's location.
#asm psect eeprom_data,class=EEDATA,delta=2,space=2
    IRPC ver, __DATE__
    DB    'ver'
ENDM
#endasm


Can anyone suggest a simple method to insert __DATE__ (or similar) into the EEPROM of a PIC16F690 at a specific location (at compile time)?
Thanks!
 
#1

3 Replies Related Threads

    ric
    Super Member
    • Total Posts : 23859
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: Defining EEPROM contents at a specific location - PIC16F690. XC8 version 2.00 2019/07/18 02:16:59 (permalink)
    +1 (1)
    What if you change
    const unsigned char info2[] __at(0xF0D4) = __DATE__;
    to
    const unsigned char info2[] __at(0x21D4) = __DATE__;
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #2
    1and0
    Access is Denied
    • Total Posts : 9762
    • Reward points : 0
    • Joined: 2007/05/06 12:03:20
    • Location: Harry's Gray Matter
    • Status: offline
    Re: Defining EEPROM contents at a specific location - PIC16F690. XC8 version 2.00 2019/07/18 06:32:01 (permalink)
    +2 (2)
    The const qualifier is usually used for code space so it will generate a warning, even though I think it will initialize the eeprom because of the address. ;)  The __eeprom qualifier is used from EEPROM space but it cannot be absolute addressed but initialization of absolute is not supported -- go figure!  So I think the only way is to use assembly if you want NO warning or error message.
    post edited by 1and0 - 2019/07/18 07:55:50
    #3
    1and0
    Access is Denied
    • Total Posts : 9762
    • Reward points : 0
    • Joined: 2007/05/06 12:03:20
    • Location: Harry's Gray Matter
    • Status: offline
    Re: Defining EEPROM contents at a specific location - PIC16F690. XC8 version 2.00 2019/07/18 07:41:36 (permalink)
    0
    I just have a thought. The following will not access the EEPROM:

    const unsigned char info2[] __at(0x21D4) = __DATE__;
     
    for (i = 0; i < 11; i++)
        foo = info2[i];

    #4
    Jump to:
    © 2019 APG vNext Commercial Version 4.5