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 CCS Technical Support

Can't view modified program memory using MPLAB

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



Joined: 07 Feb 2008
Posts: 167

View user's profile Send private message

Can't view modified program memory using MPLAB
PostPosted: Fri Oct 01, 2010 12:01 pm     Reply with quote

I executed a small section of code to read, then write, and, finally, read back a small block of data in Program Memory on a 18F2580. The data is read back as expected from program memory, but I can't seem to be able to view it in MPLAB (View-Program Memory). When viewing the addresses which should have been modified, I read FFs.

What am I missing?

Thanks!
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Oct 02, 2010 12:32 pm     Reply with quote

This may be a question for the Microchip MPLAB forum. But for help on
this type of question, you need to tell us your test environment. Are you
testing this in MPLAB simulator ? Or are you testing it with the ICD2 (etc)
on a hardware board, while running the ICD2 as a debugger ?
You need to post an extremely short but compilable test program.
And also post the compiler version and MPLAB version.
JerryR



Joined: 07 Feb 2008
Posts: 167

View user's profile Send private message

PostPosted: Mon Oct 04, 2010 6:10 am     Reply with quote

Hello PCM:

Yes, Microchip's forum might be the best place to go, however I'm using CCS PCWH v3.249 and a snippet of your code for the test. Therefore, I'm assuming this forum might be the place to go.

More information:

Using version 8.53 MPLab
PCWH: version 3.249
Debugger: Microchip Real ICE
Microcontroller: PIC18F2580

Test code called from MAIN. Runs successfully as it prints out stored 3,3,3,3,1,1,1,1 correctly after demonstrating it has successfully erased program memory to "FF".

Problem is that after code has run to breakpoint at bottom of code, change is not apparent in View > Program Memory at addresses around 0x4200.

Any suggestions?

Thanks!

Test code (look familiar?):
Code:



void Mem_Write(void)
{
int8 i;
int8 write_data[8] = {3,3,3,3,1,1,1,1};
int8 read_data[8]  = {0,0,0,0,0,0,0,0};


#define ROM_ADDR  0x4200


printf("Flash write size = %u\n\r", getenv("FLASH_WRITE_SIZE"));
printf("\n\r");

// Erase flash memory.
erase_program_eeprom(ROM_ADDR);

// Read flash memory.
read_program_memory(ROM_ADDR, read_data, sizeof(read_data));

// Display it, to show it's erased.
printf("Flash memory after being erased: ");
for(i = 0; i < sizeof(read_data); i++)
    printf("%X ", read_data[i]);
printf("\n\r");
printf("\n\r");
}

// Now write 8 bytes.
write_program_memory(ROM_ADDR, write_data, sizeof(write_data));

// Read them back.
read_program_memory(ROM_ADDR, read_data, sizeof(read_data));

// Display data read from Flash memory.
printf("Flash memory after being written: ");
for(i = 0; i < sizeof(read_data); i++)
    printf("%X ", read_data[i]);
printf("\n\r");
printf("\n\r");

Ttelmah



Joined: 11 Mar 2010
Posts: 19552

View user's profile Send private message

PostPosted: Mon Oct 04, 2010 9:15 am     Reply with quote

Er.
What you have posted, will never execute the lines after the fourth printf. There is a terminating '}', so the code beyond here will never be run, leaving the memory erased....

Best Wishes
JerryR



Joined: 07 Feb 2008
Posts: 167

View user's profile Send private message

PostPosted: Mon Oct 04, 2010 10:04 am     Reply with quote

Hi: Thanks for your response. No the code works as planned, I didn't copy the final "}". The code as executed produces the intended results, I just can't view the modified program memory locations in MPLAB. MP Lab reports those modified locations as all "FF".

Any ideas?

Thanks!
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Oct 04, 2010 1:55 pm     Reply with quote

Test it with a different programmer/debugger such as ICD2. If it works,
then it's a problem with Real Ice, or MPLAB & Real Ice, or their configuration.
JerryR



Joined: 07 Feb 2008
Posts: 167

View user's profile Send private message

Program memory read (SOLVED)
PostPosted: Mon Oct 04, 2010 2:36 pm     Reply with quote

Simple fix. Have to DEBUGGER > READ to update program memory display.
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