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

internal eeprom problem

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



Joined: 24 Oct 2005
Posts: 5

View user's profile Send private message

internal eeprom problem
PostPosted: Mon Oct 24, 2005 8:40 am     Reply with quote

Hi I'm trying to save and load eeprom data using 16f876, pcm 2.73, my program only works fine when I store data in eeprom less than 100, but when I use until 127 and 255 the pic hang.

As in datasheet, eeprom in 16f876 is 256 byte, so why it hang?

This is my source code:

#include<16f876.h>
#use delay (clock=20000000)
#fuses hs, noprotect, nolvp, nowdt

#byte portb=6

main()
{
byte i, mydata;
set_tris_b(0x00);

for(i=0; i<=50; i++)
{write_eeprom(i, i);}

for(i=0; i<=50; i++)
{mydata=read_eeprom(i);
portb=mydata;
delay_ms(500);}
}

This program works fine, but when I change the 'i' limit to e.g. 127 or 255 the pic hang.

Please advice, thanks!
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Oct 24, 2005 11:33 am     Reply with quote

It will hang if you set the limit value to 255, because "i" is in the
range of 0 to 255 and is always "less than or equal" to 255.
It will stay in the loop forever.

However, it shouldn't hang with a limit of 127.

Post the full version of your compiler. The version is not 2.73.
It will have three digits after the decimal point, like 2.730, 2.731, etc.
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