Non volatile memory problems
| Newsgroups | gmane.comp.hardware.rabbit-semiconductor |
|---|---|
| Message-ID | <[email protected]> |
I'm used rcm5600w with DC 10.56. I try to store data in nonvolatile memory with the following code, the problem arise when I tried unplugging the power supply for a few minutes and turn on the power supply to read the data I stored, I lost the data. Is there any wrong with this program? Thanks.
#use "rcm56xxw.lib"
#define dataADDR 0x1B28BUL // physical address of nonvolatile memory
#define dataLength 12
char *const data = "this is data";
char *temp;
void main(){
brdInit();
// close this line and remove power supply
// for testing nonvolatile memory
// write data to nonvolatile memory
//root2xmem(dataADDR, &data, dataLength);
// read data from nonvolatile memory and store to temp array
xmem2root(&temp, dataADDR, dataLength);
if(memcmp(&temp, &data, dataLength)==0){
printf("data is equal with temp\n");
}
else {
printf("data isn't equal with temp\n");
printf("%s\n", temp);
}
}