Re: How to prevent databse from being overwritten in xmem after a power cycle?

"[email protected] [rabbit-semi]" <[email protected]> 08 Aug 2015 06:59:56 -0700
Newsgroups gmane.comp.hardware.rabbit-semiconductor
Message-ID <[email protected]>
typedef struct {
    unsigned char name[20];
    unsigned int age;
    unsigned char address[50];
    float loan;
    long transaction_time;
}TL_DATA_REC

bbram far TL_DATA_REC Logs[TL_DEFAULT_LOGS]

I can copy Logs[10] to temprec by using:
ptr = Logs + index;
temprec = *ptr;

then modify their values, i.e.
strcpy(temprec.name, "example name");
temprec.age = 34;
strcpy(temprec.address, new_address); //new_address is an array containing the new address
temprec.loan = temprec.loan + 25.32; //add 25.32 to current value
temprec.transaction_time = MS_TIMER;

then store new values in database, simply by:  
//ptr = Logs + index;
*ptr = temprec;