I am trying to pass a string from one function to another and am going around in circles. PLEASE HELP!!!
The following function is where I call the function
void readRTC()
{
char RTC[6];
RTC = Read_RTC(&RTC);
cout<<RTC;
}
Calling the function below.
??????? Read_RTC(char* Buffer)
{
unsigned int i;
unsigned char sec,ten_sec,time1,time1_ten,time2,time2_ten;
char Buffer[6];
cout<<"RTC Time";
if(RTC_ready()) //check status of rtc
{
RaiseSS_RTC();
SendByte(0x00); //send start address, this will auto inc
//read addresses 0x00 - 0x10 this includes all time/date and alarm0&1 and regs
for(i=0;i<17;i++)
{
RTC_RX_data[i]=SendByte(0x00); //send dummy byte to read from address
}
LowerSS_RTC();
time2_ten =(RTC_RX_data[2]>>4)&0x0f;
cout<<(unsigned int)(unsigned char) time2_ten;
time2 =(RTC_RX_data[2])&0x0f;
cout<<(unsigned int)(unsigned char) time2;
time1_ten =(RTC_RX_data[1]>>4)&0x0f;
cout<<(unsigned int)(unsigned char) time1_ten;
time1 =(RTC_RX_data[1])&0x0f;
cout<<(unsigned int)(unsigned char) time1;
ten_sec=(RTC_RX_data[0]>>4)&0x0f;
cout<<(unsigned int)(unsigned char) ten_sec;
sec=(RTC_RX_data[0])&0x0f;
cout<<(unsigned int)(unsigned char) sec;
sprintf(Buffer, "%d%d"":""%d%d"":""%d%d",time2_ten,time2,time1_ten ,time1,ten_sec,sec);
cout<<Buffer;
return Buffer;
}
else
{
cout<<"RTC initialise failure"<<endl;
return 0;
}
}