Jump to content

Pic16f1827 #pragma Data _eeprom Not Working


Recommended Posts

Gents, I would like to ask for your support on this one pls, as I have checked the forum but could not find any references to this issue I see.

 

Background

I am changing my project target from a PIC16F648A to a PIC16F1827. I have changed the internal readback EEPROM routine to reflect the register difference and find that I read back 0xFF from EEPROM that should have been pre-loaded.

 

On debugging my issue, I looked at MPLAB IDE -> View -> EEPROM directly after the compile to see if the values were being setup correctly. I dont see these values being stored to EEPROM.

 


On the 648A the EEPROM is setup correctly


On the 1827 the EEPROM remains as 0xFF

 

The Issue

On a target PIC16F1827, using the #pragma statement to pre-load the EEPROM, I don't see any of the values defined by the pragma to be stored in the EEPROM data area.

 

Code Fragment :-

 

#pragma DATA _EEPROM, 13, 200

 

The results

When compiling, I then check the EEPROM values in MPLAB IDE using View->EEPROM and the values are all 0xFF (i.e unchanged). I have also programmed a target and check the EEPROM read back as 0xFF where I would expect my values.

 

- I have checked the PIC16F1827 include file and the symbol is defined correctly as 0x2100

 

My System details:-

 

MPLAB 8.56.00.00 Certified

Windows XP 5.1.2600.2 Service Pack 3n\a

Source Boost = BoostC Optimizing C Compiler Version 6.97 (for PIC16 architecture)

PIC16F1827

 

 

Any advise would be welcome.

Link to post
Share on other sites
Gents, I would like to ask for your support on this one pls, as I have checked the forum but could not find any references to this issue I see.

 

Background

I am changing my project target from a PIC16F648A to a PIC16F1827. I have changed the internal readback EEPROM routine to reflect the register difference and find that I read back 0xFF from EEPROM that should have been pre-loaded.

 

On debugging my issue, I looked at MPLAB IDE -> View -> EEPROM directly after the compile to see if the values were being setup correctly. I dont see these values being stored to EEPROM.

 


On the 648A the EEPROM is setup correctly


On the 1827 the EEPROM remains as 0xFF

 

The Issue

On a target PIC16F1827, using the #pragma statement to pre-load the EEPROM, I don't see any of the values defined by the pragma to be stored in the EEPROM data area.

 

Code Fragment :-

 

#pragma DATA _EEPROM, 13, 200

 

The results

When compiling, I then check the EEPROM values in MPLAB IDE using View->EEPROM and the values are all 0xFF (i.e unchanged). I have also programmed a target and check the EEPROM read back as 0xFF where I would expect my values.

 

- I have checked the PIC16F1827 include file and the symbol is defined correctly as 0x2100

 

My System details:-

 

MPLAB 8.56.00.00 Certified

Windows XP 5.1.2600.2 Service Pack 3n\a

Source Boost = BoostC Optimizing C Compiler Version 6.97 (for PIC16 architecture)

PIC16F1827

 

 

Any advise would be welcome.

 

After further thinking on this topic, I have found the answer. The header files supplied within the SourceBoost env. for 16F1827 is incorrect for _EEPROM symbol address.

 

The address should be set to 0xF000 and not 0x2100.

 

Forcing the address in the #pragma statement as shown below fixs the problem :-

 

#pragma DATA 0xF000, 253, 200

 

Therefore, this is clearly a bug in the header file define.

Link to post
Share on other sites

iank,

 

After further thinking on this topic, I have found the answer. The header files supplied within the SourceBoost env. for 16F1827 is incorrect for _EEPROM symbol address.

 

The address should be set to 0xF000 and not 0x2100.

 

Forcing the address in the #pragma statement as shown below fixs the problem :-

 

#pragma DATA 0xF000, 253, 200

 

Therefore, this is clearly a bug in the header file define.

Thanks for the update. Now we can correct the header file.

 

Regards

Dave

Link to post
Share on other sites
  • 5 weeks later...

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji 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...
×
×
  • Create New...