Jump to content
Sign in to follow this  
zoom

Initialization Of Eeprom Data

Recommended Posts

Hi,

 

I cannot get the #pragma DATA _EEPROM, nn, nn, nn directive to work.

 

EEPROM remains unchanged.

Also, PICkit2 tells me the hex file is bigger that the device memory.

 

I don't think I have data protection on anywhere.

 

Is there anything else I need to be aware of?

 

Thanks a lot,

Colin

Share this post


Link to post
Share on other sites

Colin,

I cannot get the #pragma DATA _EEPROM, nn, nn, nn directive to work.

 

EEPROM remains unchanged.

Also, PICkit2 tells me the hex file is bigger that the device memory.

 

I don't think I have data protection on anywhere.

Sounds like the _EEPROM does not have the correct address for the device you are programming.

You can check it in the devices header file. You find the address required in the Microchip programming data sheet for the device.

 

Let us know how you get on.

 

Regards

Dave

Share this post


Link to post
Share on other sites

Colin,

Sounds like the _EEPROM does not have the correct address for the device you are programming.

You can check it in the devices header file. You find the address required in the Microchip programming data sheet for the device.

 

Let us know how you get on.

 

Regards

Dave

Thanks a lot Dave. The Microchip programming data sheet for the 16F1933 says:

The physical address range of the 256 data memory is

0000h-00FFh. However, these addresses are logically

mapped to address 1E000h-1E1FFh in the hex file.

.

My header file had 1E000h but the new one I just downloaded has 0xF000.

0xF000 works. Don't quite understand it, but it works.

 

Thanks again,

Colin.

Share this post


Link to post
Share on other sites

Colin,

I cannot get the #pragma DATA _EEPROM, nn, nn, nn directive to work.

...

 

Sounds like the _EEPROM does not have the correct address for the device you are programming.

You can check it in the devices header file. You find the address required in the Microchip programming data sheet for the device.

 

Let us know how you get on.

 

Regards

Dave

 

Reviving this old thread because I'm having the same problem. I looked in the header file for the device and _EEPROM is not defined at all so of course I get an error when I try to use the directive #pragma DATA _EEPROM, xx, xx, ... Was this an omission? Or am I supposed to include another header? The BoostC v7 Compiler Reference Manual still recommends this directive to initialize EEPROM.

 

The device is PIC18F45K50 and it includes the header pic18F45k50.h. I'm porting from a PIC18F4550 which has _EEPROM defined in its header. The new header also contains no _CONFIG defs.

Share this post


Link to post
Share on other sites

I don't find a header file for the 18F45K50. I see one for the 18F45J50 and the 18F45K80 and K20, but not the K50. Are you sure you are not outside the applicable device list for sourceboost? Also, if you have selected the 18F45J50 as the target, it doesn't have any eeprom.

Share this post


Link to post
Share on other sites

I don't find a header file for the 18F45K50. I see one for the 18F45J50 and the 18F45K80 and K20, but not the K50. Are you sure you are not outside the applicable device list for sourceboost? Also, if you have selected the 18F45J50 as the target, it doesn't have any eeprom.

 

Thx for your reply. I just installed ver 7.30 and it's in there. I'll send you a screenshot of my include dir if you really want to see it. B)

The file date is 04/30/15 and the size is 33k which is very small compared to similar devices. It's on the device list and no, I did not select 45J50.

 

I'll try to attach it to this post.

 

PIC18F45K50.h

Share this post


Link to post
Share on other sites

About eeprom issue, you may use this in your code:

#ifndef _EEPROM
    #define _EEPROM   0xF00000
#endif

#pragma DATA _EEPROM, 0x10, 0x11, 0x12, 0x13

or you may just insert "#define _EEPROM 0xF00000" in the pic18f45k50.h

 

don't use 0xF000 as i saw in a previous post.

 

I have imported a snipet to mplab 8.92 with #defines as showed above and saw all four values ok in the eeprom watch window.

 

The section related with fuses, etc, you may try to copy them from a closest model... ideally verifing values with datasheet and after check them within mplab.

 

br

Edited by joli

Share this post


Link to post
Share on other sites

About eeprom issue, you may use this in your code:

#ifndef _EEPROM
    #define _EEPROM   0xF00000
#endif

#pragma DATA _EEPROM, 0x10, 0x11, 0x12, 0x13

or you may just insert "#define _EEPROM 0xF00000" in the pic18f45k50.h

 

don't use 0xF000 as i saw in a previous post.

 

I have imported a snipet to mplab 8.92 with #defines as showed above and saw all four values ok in the eeprom watch window.

 

The section related with fuses, etc, you may try to copy them from a closest model... ideally verifing values with datasheet and after check them within mplab.

 

br

 

Thanks for your help. I tried adding it to my own code but it didn't work so I added it to the device header. The problem with that is it will be lost when I install the next SourceBoost update. There are a LOT of things missing from the device header file so I think I'm going to create a header with all the missing items and then add a line to the device header like #include missing_stuff.h at the end of the device header.

 

Dave and/or Pavel really need to take a look at this header because it's missing multiple items and has no configuration data.

Share this post


Link to post
Share on other sites

Hi there,

 

Thats weird.. it works ok here. tested again minutes ago.

The missing defs you saw on your header file, is missed on mine too.

There are another files with missing stuff... good luck

 

 

this is the test i did:

#include <system.h>

#ifndef _EEPROM
    #define _EEPROM   0xF00000
#endif

#pragma DATA _EEPROM, 0x10, 0x11, 0x12, 0x13


void main( void )
{
    while(1);           // nothing to do
}

br

Edited by joli

Share this post


Link to post
Share on other sites

Thanks for testing it Joli. If I add the _EEPROM def right after system.h it appears to work. It may not have been working before because I wasn't defining it soon enough. Another header may have called #pragma DATA that I didn't know about... I'm defining it now in the device header where it's missing but I wish Dave or Pavel would finish this header.

 

best regards

Share this post


Link to post
Share on other sites

im glad you got it working.
about Dave and Pavel, i see no activity from him in here for a long time.
but company keep selling cause i brought a boostc++ pro weeks ago
i don't know what that absence means, i just know that in my oppinion they have a great product with a very competitive price

br

Edited by joli

Share this post


Link to post
Share on other sites

Your content will need to be approved by a moderator

Guest
You are commenting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoticons maximum are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×