Searching \ for '[PIC]: EEPROM pre-setting directives' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/memory.htm?key=eeprom
Search entire site for: 'EEPROM pre-setting directives'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: EEPROM pre-setting directives'
2007\03\07@021228 by Rob Robson

flavicon
face
I'm wondering if there's a way to use some lines of program code to pre-load various EEPROM locations in an 18F452, in the same way that configuration bits can be pre-set using __CONFIG.  I've been using Modify under the Window menu in MPLAB each time I burn a chip, but it doesn't save my settings with the project.  I can't seem to find what I'm looking for in the manual, probably because I'm a bit sketchy on the correct terminology.  I'd be grateful if someone could steer me in the right direction.

Many thanks,
RR  

2007\03\07@024118 by Nigel Duckworth

picon face
This is how I do it in Hi-Tech C  Rob;

// pre-assign values to EEPROM memory
__EEPROM_DATA(1,154,120,200,120,5,60,0);   // EEPROM addresses 0 to 7
__EEPROM_DATA(50,1,0,0,0,0,0,0);   // EEPROM addresses 8 to 15

Nigel

Rob Robson wrote:
>  
> I'm wondering if there's a way to use some lines of program code to pre-load various EEPROM locations in an 18F452, in the same way that configuration bits can be pre-set using __CONFIG.  I've been using Modify under the Window menu in MPLAB each time I burn a chip, but it doesn't save my settings with the project.  I can't seem to find what I'm looking for in the manual, probably because I'm a bit sketchy on the correct terminology.  I'd be grateful if someone could steer me in the right direction.
>
> Many thanks,
> RR  
>  

2007\03\07@031017 by Jinx

face picon face


> I'm wondering if there's a way to use some lines of program code to
> pre-load various EEPROM locations in an 18F452

de. Have a look in Assembler Help under EEPROM  Data Byte

2007\03\07@191439 by Andre Abelian

flavicon
face
RR,

I use it all the time.
Hi-Tech C example:
put this line before main that is not going to effect your checksum

__EEPROM_DATA(0x01,0x02,and so on);

in CCS C example:
#ROM 0x2100={0x01,0x02,and so on}
address 0x2100 is for 16f876a it might be different for 452.
I am sure it can be done in assembly too.

In MPLAB you have to select "Preserve EEPROM on Program"


Andre Abelian  




{Original Message removed}

2007\03\08@074246 by Gerhard Fiedler

picon face
Andre Abelian wrote:

> Hi-Tech C example:
> __EEPROM_DATA(0x01,0x02,and so on);
>
> in CCS C example:
> #ROM 0x2100={0x01,0x02,and so on}
> address 0x2100 is for 16f876a it might be different for 452.

These options place EEPROM content in the hex file.


> In MPLAB you have to select "Preserve EEPROM on Program"

If you select this option, the above directives will not have any effect.

When "Preserve EEPROM on Program" is selected, MPLAB reads the EEPROM
contents into the EEPROM buffer before programming, overwriting whatever
was in your hex file, and then programs the previous contents back.

If you want your hex file contents programmed, do /not/ select this option.

Gerhard

2007\03\08@165549 by Andre Abelian

flavicon
face
Gerhard,

I use ICD2 without enabling "Preserve EEPROM on Program"
I couldn't program EEPROM Data. Do you use ICD2?
How do you program EEPROM data?

thanks

Andre



{Original Message removed}

2007\03\08@182752 by Harold Hallikainen

face
flavicon
face
Here's what I do on an 18LF6722 with Microchip C18:

// default eeprom data
#include "types.h"

#pragma romdata eedata_scn=0xf00000  // Load default eeprom
rom u8b eedata_values[] = {
0xFF, 0x01, 0x09, 0x10, 0x55, 0x6C, 0x74, 0x72, 0x61, 0x20, 0x53, 0x74,
0x65, 0x72, 0x65, 0x6F,
0x20, 0x4A, 0x53, 0x44, 0x2D, 0x38, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,

0x41, 0x6E, 0x61, 0x6C, 0x6F, 0x67, 0x20, 0x32,
0x63, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x03, 0x10,
0x41, 0x6E, 0x61, 0x6C, 0x6F, 0x67, 0x20, 0x36, 0x63, 0x68, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x20, 0x44, 0x69, 0x67, 0x69,
0x74, 0x61, 0x6C, 0x20,
0x38, 0x63, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x09, 0x30,
0x54, 0x6F, 0x73, 0x6C, 0x69, 0x6E, 0x6B, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x40, 0x53, 0x2F, 0x50, 0x44,
0x49, 0x46, 0x20, 0x31,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x21, 0x50,
0x53, 0x2F, 0x50, 0x44, 0x49, 0x46, 0x20, 0x32, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x60, 0x52, 0x65, 0x73, 0x65,
0x72, 0x76, 0x65, 0x64,
0x20, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x20, 0x32, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x35, 0x33, 0x34, 0x30,
0x62, 0x33, 0x34, 0x39,
0x2D, 0x32, 0x66, 0x31, 0x63, 0x2D, 0x34, 0x30, 0x36, 0x61, 0x2D, 0x62,
0x64, 0x33, 0x37, 0x2D,
0x34, 0x39, 0x38, 0x62, 0x61, 0x34, 0x31, 0x66, 0x34, 0x35, 0x39, 0x30,
0xFF, 0xFF, 0xFF, 0xFF
};
#pragma romdata



My types.h defines u8b as an unsigned char .

Harold


{Quote hidden}

> {Original Message removed}

2007\03\08@213130 by T. Uzri

picon face
This is how EEPROM is set in MPASM

    org 0xF000000     ;EEPROM start address
    de 0x59,0x43,0xFF,0x67,0xFF,0x77,0xFF,0x76
    de 0xF5F,0x65,0xFF,0xFF,0xFF,0x55,0xAA,0xAB

----- Original Message -----
From: "Andre Abelian" <spam_OUTaabelianTakeThisOuTspammason-electric.com>
To: "Microcontroller discussion list - Public." <.....piclistKILLspamspam@spam@mit.edu>
Sent: Thursday, March 08, 2007 9:31 AM
Subject: RE: [PIC]: EEPROM pre-setting directives


{Quote hidden}

> {Original Message removed}

2007\03\09@034648 by Alan B. Pearce

face picon face
> I use ICD2 without enabling "Preserve EEPROM on Program"
> I couldn't program EEPROM Data. Do you use ICD2?
> How do you program EEPROM data?

Some of the small chips use an I2C interface to the EEPROM, and this cannot
transfer data from the programmer, it has to be done under program control.

Just what chip are you attempting to program?

2007\03\09@041235 by wouter van ooijen

face picon face
> Some of the small chips use an I2C interface to the EEPROM, and this
cannot
> transfer data from the programmer, it has to be done under program
control.

IIRC only the 12CE chips had this funny configuration. In the window of
the JW chips you could see that they actually contained two dies!

Wouter van Ooijen

-- -------------------------------------------
Van Ooijen Technische Informatica: http://www.voti.nl
consultancy, development, PICmicro products
docent Hogeschool van Utrecht: http://www.voti.nl/hvu



2007\03\09@085043 by Gerhard Fiedler

picon face
Andre Abelian wrote:

> I use ICD2 without enabling "Preserve EEPROM on Program"
> I couldn't program EEPROM Data. Do you use ICD2?
> How do you program EEPROM data?

I use the HiTech PIC C compiler. So I use the __EEPROM_DATA() macro they
provide. This macro results in the given data being placed in the hex file
at the address that is associated with the EEPROM data space. This address
may be dependent on the processor you're working with. (For the 16F6xx, it
is 0x2100. You find this information in the programming spec; look for
"data memory".)

Other compilers/assemblers/linkers have other means to achieve the same
result.

You'd have to verify that there is some data at the appropriate address in
your hex file. Note that you usually have to double the given address to
get the hex file address. This is because the address is given as a word
address, whereas the hex file contains byte addresses. (For 16F6xx
processors, EEPROM data would be in records starting with ":nn42aa". nn is
the number of bytes in the record, aa is the least significant part of the
address of the first byte in the record.)

Gerhard

2007\03\09@121021 by Andre Abelian

flavicon
face
Gerhard,

I was wondering can I use your assembly code before main()?

    #asm
    org 0xF000000     ;EEPROM start address
    de 0x59,0x43,0xFF,0x67,0xFF,0x77,0xFF,0x76
    de 0xF5F,0x65,0xFF,0xFF,0xFF,0x55,0xAA,0xAB
    #endasm

for some reason Mplab doesn't recognize
#ROM 0x2100={0x01,0x02,and so on} using CCS compiler
I was wondering to replace it with assembly it looks
pretty good.


thanks

Andre






{Original Message removed}

2007\03\09@121817 by Andre Abelian

flavicon
face
I do not we ware talking about external EEPROM.
my understanding was internal Data EEPROM.


Andre


{Original Message removed}

2007\03\09@165113 by Gerhard Fiedler

picon face
Andre Abelian wrote:

> I was wondering can I use your assembly code before main()?
>
>      #asm
>      org 0xF000000     ;EEPROM start address
>      de 0x59,0x43,0xFF,0x67,0xFF,0x77,0xFF,0x76
>      de 0xF5F,0x65,0xFF,0xFF,0xFF,0x55,0xAA,0xAB
>      #endasm
>
> for some reason Mplab doesn't recognize
> #ROM 0x2100={0x01,0x02,and so on} using CCS compiler
> I was wondering to replace it with assembly it looks
> pretty good.

I don't know the CCS compiler. If it doesn't work, their support should be
able to help you.

In the end, the hex file is where you can check whether the compiler does
it right, either using #ROM or #asm or whatever.

No matter how you do it, make sure you use the correct address. In the two
examples above, you used different addresses. If one works but the other
not, that may be the problem :)

In general, it should not matter where you place these directives as long
as it is outside of a function. (Again, the CCS compiler may have some
special restrictions.)

Gerhard

2007\03\09@213222 by William Chops Westfield

face picon face

>> for some reason Mplab doesn't recognize
>> #ROM 0x2100={0x01,0x02,and so on} using CCS compiler
>>
That's what the reference manual says to use (it's downloadable from
ccs.)  Did you try both "#ROM" and "#rom"?  The manual has different
cases in different places (not so impressive.)

BillW

More... (looser matching)
- Last day of these posts
- In 2007 , 2008 only
- Today
- New search...