|
|
View previous topic :: View next topic |
Author |
Message |
pcmguy
Joined: 24 Oct 2005 Posts: 5
|
internal eeprom problem |
Posted: Mon Oct 24, 2005 8:40 am |
|
|
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
|
|
Posted: Mon Oct 24, 2005 11:33 am |
|
|
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. |
|
|
|
|
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
|