structures

I'm new to this, so bare with me.....

I have the following structs in RTC.h

typedef struct
{
BYTE sec;
BYTE min;
BYTE hour; // (24 hour format)
BYTE day;
}RTCtime;

typedef struct
{
BYTE day; // day of week (1 to 7)
BYTE date; // day of month (1 to 31)
BYTE month; // 1 to 12
WORD year; // 1997 to 2096
}RTCdate;

void RTCGetTime(RTCtime* t);
void RTCSetTime(RTCtime* t);
void RTCGetDate(RTCdate* d);
void RTCSetDate(RTCdate* d);

in RTC.c I have the functions

void RTCGetTime(RTCtime* t)
{

t->sec = FromBCD(RTCReadByteReg(SECONDS_REG));
t->min = FromBCD(RTCReadByteReg(MINUTES_REG));
t->hour = FromBCD(RTCReadByteReg(HOURS_REG));
}

void RTCGetDate(RTCdate* d)
{
d->day = FromBCD(RTCReadByteReg(DAY_REG));
d->date = FromBCD(RTCReadByteReg(DATE_REG));
d->month = FromBCD(RTCReadByteReg(MONTH_REG));
d->year = 2000 + FromBCD(RTCReadByteReg(YEAR_REG));
}


ok, so I didn't write those, but I need to use them. So how can I use those structs in another file to get the date and time and output it? I already did the #include "RTC.h", but I'm not familiar with how to call the functions to get the date and time.

I was trying to do something like:

RTCtime *time;
RTCGetTime(time);

and then to get the values something like:

unsigned char hour = time.hour;

any help please....
Last edited on
Topic archived. No new replies allowed.