CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

MPLAB EEPROM Window, Cannot see 16F877 Internal EEPROM val's

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
robroy_1



Joined: 10 Sep 2003
Posts: 9

View user's profile Send private message

MPLAB EEPROM Window, Cannot see 16F877 Internal EEPROM val's
PostPosted: Tue Oct 07, 2003 6:44 pm     Reply with quote

Hello;

I do not think I have a problem writing/reading to EEPROM with PIC16F877 in PICDEM2+ however when I look at the EEPROM window in MPLAB I cannot see the real (or my imagined) contents of the 16F877internal EEPROM. I am sure this is a simple oversight on my part, is there anyone out there that can see what I have overlooked?

Here are the particulars:

CCS PCWH 3.178
MPLAB Plugin
MPLAB 6.30
Device Selected PIC16F877
In debugger mode
ICD2
PIC16F877 (Target is in PICDEM2+)
VCC = 5V

Here is the code:

#include <16F877.h>
#use delay(clock=4000000)
#fuses XT,NOWDT,NOPUT,NOBROWNOUT, LVP, NOPROTECT,CPD,WRT ,DEBUG

//
void main(void);
unsigned int8 entry(void);


//
//-------------MAIN PROGRAM---------------------------------------
//
void main(void) {
unsigned int8 DUMMY = 0;
unsigned int8 TESTY = 0;
DUMMY = entry();
switch (DUMMY)
{
case 4:
output_b(0x0C);
break;
case 3:
output_b(0x06);
break;
default:
output_b(0x03);
break;
}
delay_ms(2000);
output_b(0x00);
delay_ms(1000);
write_eeprom(0,DUMMY);
TESTY=read_eeprom(0);
output_b(TESTY); // correct value here but not on the EEPROM window in MPLAB 6.30
}
//
//-------------END OF MAIN PROGRAM---------------------------------------
//

unsigned int8 entry(void)
{
unsigned int8 USER_PROFILE = 5;

do {
write_eeprom(USER_PROFILE,0x55); // this should write 55 to mem loc 5-AE
USER_PROFILE+=1;
} while (USER_PROFILE<0xAF);

USER_PROFILE=5;
do {
if (read_eeprom(USER_PROFILE)!=0x55) // This never executes so the function reads correctly?
{
output_b(USER_PROFILE);
delay_ms(500);
}
USER_PROFILE+=1;
} while (USER_PROFILE<0xAF);

USER_PROFILE=5;

if (input(PIN_A4)==0) // this is how I change the value stored in the EEPROM loc 0.
USER_PROFILE=1;
else
USER_PROFILE=0;
USER_PROFILE+=3;
RETURN (USER_PROFILE);

}


Thanks...
_________________
Rob
Haplo



Joined: 06 Sep 2003
Posts: 659
Location: Sydney, Australia

View user's profile Send private message

PostPosted: Tue Oct 07, 2003 7:06 pm     Reply with quote

I remember I had the exact same problem; never could get the EEPROM window to update. Actually I asked about it on this forum and didn't get any answers either. I had to use 'Window/Modify' in the menus to read the EEPROM contents.

The MPLAB help files states: "The EEPROM window displays the data/opcode hex information of the particular processor being emulated. When an EEPROM register value changes or the processor is halted, the data in the EEPROM window is updated.", but it doesn't work that way. Maybe that's only for the emulators and not for the ICD.
robroy_1



Joined: 10 Sep 2003
Posts: 9

View user's profile Send private message

Of course I would figure it out just after posting......oh w
PostPosted: Tue Oct 07, 2003 7:20 pm     Reply with quote

Thanks for reading. Hope this helps anyone who is interested.

Apparently when the MPLAB folks say to need to read the EEPROM they are talking about reading it with the PROGRAMMER. So after you program the device, then execute the code, then you have to read the parts memory back into MPLAB using the programmer that you have setup. In my case it is the ICD2 so I have MPLAB set to use the debugger = ICD2 and the Programmer to ICD2. The settings are common between the two so if you only want to read back the eeprom, you have to change either the debugger or the programmer settings to only the EEPROM under the program tab. If I have not been clear repost any questions and I will elucidate as necessary.

Thanks...Keep Prog...ing



Haplo wrote:
I remember I had the exact same problem; never could get the EEPROM window to update. Actually I asked about it on this forum and didn't get any answers either. I had to use 'Window/Modify' in the menus to read the EEPROM contents.

The MPLAB help files states: "The EEPROM window displays the data/opcode hex information of the particular processor being emulated. When an EEPROM register value changes or the processor is halted, the data in the EEPROM window is updated.", but it doesn't work that way. Maybe that's only for the emulators and not for the ICD.

_________________
Rob
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group