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

read program memory problem

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







read program memory problem
PostPosted: Thu Jun 15, 2006 2:54 pm     Reply with quote

Hi, I'm trying to read program memory of 16F877 half
way through the program memory where values are all
0xFF. I'm using the line

read_program_memory(0x1000,&g_ucTestRead[0],2);

I seem to be reading back random values. Am I
misunderstanding how to use this function?

Thank's Tom
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Jun 15, 2006 3:45 pm     Reply with quote

Quote:
I seem to be reading back random values

I made the test program below, and compiled it with PCM vs. 3.249.
It worked OK. It displayed the following output:
Quote:
ff 3f

That's the LSB and the MSB of the program word at ROM address 0x1000.
I used the ICD2 to erase the PIC before I programmed it, so I know
that it will have 0x3FFF in all erased locations. Is it possible that you
have old code left in most of your PIC ? Try erasing it first. Then
run the test program.
Code:

#include <16F877.H>
#fuses XT, NOWDT, NOPROTECT, NOBROWNOUT, PUT, NOLVP
#use delay(clock = 4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)

int8 g_ucTestRead[10];

//======================
void main()
{
read_program_memory(0x1000, &g_ucTestRead[0], 2);

printf("%x %x \n\r", g_ucTestRead[0], g_ucTestRead[1]);

while(1);
}
 
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