I thank you again for all the replies.
I did some swatting up on all the relevant topics. I had got it working the easy way but I wanted to master arrays and unions so I stuck at it, A couple of late nights and I worked it out in the end.
Just wanted to post my workings for you and say thanks. A great introduction to a great community.
Suggestion to the code always welcome. Amazing how long a tiny code can take to condense.
//----------------------------------SRAM WRITE Function---------------------------------------------------//
void sramWrite(uint32_t intVal){
union {
uint32_t splitInt;
byte byteVal[4];
} intAsBytes;
intAsBytes.splitInt = intVal;
RTC.writeEN(true);
if(RTC.writeEN())
Serial.println("ready");
else
Serial.println("No write");
for (int i=0;i<4;i++){
RTC.writeRTC(DS1302_RAM_START+(i << 1),intAsBytes.byteVal[i]);
}
}
//------------------------------------SRAM READ Function-----------------------------------------------//
uint32_t sramRead()
{
union {
uint8_t readBuffer[4];
uint32_t merge_var;
}result;
for (int x=0;x<4;x++){
result.readBuffer[x]= RTC.readRTC(DS1302_RAM_START+(x << 1));
}
uint32_t ram_read = result.merge_var;
return ram_read;
}