![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
garyzheng
Joined: 22 Jul 2004 Posts: 25
|
how to use program memory to store and read data? |
Posted: Wed Jul 28, 2004 2:51 pm |
|
|
I use PIC16F873 to design a RF sensors. But the RAM space is to small for application. So i want to use ROM(program memory) for my data storage. But i am confused that what is the difference between read_program_eeprom and read_program_memory?
the follow is some part of my program to read or write program memory:
#ROM 0x0e00 = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}
#ROM 0x0e10 = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}
#ROM 0x0e20 = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}
#ROM 0x0e30 = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}
#ROM 0x0e40 = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}
#ROM 0x0e50 = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}
void read_rom()
{
int index;
printf("ID Number:");
index=0;
//read_program_memory(0x0e00,tx_buffer,11);
while(index<11)
{
putc(read_program_eeprom(index+0x0e00));
index++;
}
}
void write_rom()
{
index=0;
while(index<11)
{
//poll and delay for next character
write_program_eeprom(0x0e00+index,rx_buffer[index]);
// write_program_memory(0x0e00,rx_buffer,11);
index++;
}
}
please give me some idea on this topic, thank you:) |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah Guest
|
Re: how to use program memory to store and read data? |
Posted: Thu Jul 29, 2004 3:51 am |
|
|
garyzheng wrote: | I use PIC16F873 to design a RF sensors. But the RAM space is to small for application. So i want to use ROM(program memory) for my data storage. But i am confused that what is the difference between read_program_eeprom and read_program_memory?
the follow is some part of my program to read or write program memory:
#ROM 0x0e00 = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}
#ROM 0x0e10 = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}
#ROM 0x0e20 = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}
#ROM 0x0e30 = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}
#ROM 0x0e40 = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}
#ROM 0x0e50 = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}
void read_rom()
{
int index;
printf("ID Number:");
index=0;
//read_program_memory(0x0e00,tx_buffer,11);
while(index<11)
{
putc(read_program_eeprom(index+0x0e00));
index++;
}
}
void write_rom()
{
index=0;
while(index<11)
{
//poll and delay for next character
write_program_eeprom(0x0e00+index,rx_buffer[index]);
// write_program_memory(0x0e00,rx_buffer,11);
index++;
}
}
please give me some idea on this topic, thank you:) |
read_program_eeprom, is the correct/normal call. The latest include files for some procesors, have 'read_program_memory' defined as a 'psedonym' for the other call.
Use the 'eeprom' syntax, since this is portable to the older compilers.
Hopefully you have followed the thread about the limited life of the program eeprom?. It really is not suitable, if the data has to be updated more than very infrequently. Consider an external FRAM instead.
Best Wishes |
|
![](templates/subSilver/images/spacer.gif) |
|
|
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
|