Hello, I am wanting to write a counter that writes to the FRAM chip Ic2, so if I lose power I will be able to recover the last count. I found splitting the value into 2 pieces works great but I am still limited, and I am wondering what do I do with strings of text. Is there any elegant way to read and write to the FRAM chip other than what I am doing already.
void writeMem(int address, long value) {
unsigned int MSB = value / 256L; // Break the value into 2 Byte-parts for storing
unsigned int LSB = value % 256L; // Above is MSB, remainder (Modulo) is LSB
fram.write8(address, MSB); // Store the value MSB at address add1
fram.write8(address + 1, LSB); // Store the value LSB at address add1 + 1
}