need help in correcting errors urgently

Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.
hi,

i m working on a DS1307 RTC program. i am using MPLAB IDE/C18 compiler. while trying to build the program, there are errors in it. can anyone help mi with the errors? i nid to get it done soon... the line in red is a syntax error...thanx

#define DS1307_SDA PIN_B1
#define DS1307_SCL PIN_B0
void boot_up(void);
void rtc_programming(void);
void read_rtc(void);

//==========================
// initial DS1307
//==========================
void init_DS1307()
{
output_float(DS1307_SCL);
output_float(DS1307_SDA);
}
//==========================
// write data one byte to
// DS1307
//==========================
void rtc_set(unsigned char rtcreg)
{
short int status;
i2c_start();
i2c_write(0xd0);
i2c_write(address);
i2c_write(data);
i2c_stop();
i2c_start();
status=i2c_write(0xd0);
while(status==1)
{
i2c_start();
status=i2c_write(0xd0);
}
}
//==========================
// read data one byte from DS1307
//==========================
byte read_DS1307(byte address)
{
byte data;
i2c_start();
i2c_write(0xd0);
i2c_write(address);
i2c_start();
i2c_write(0xd1);
data=i2c_read(0);
i2c_stop();
return(data);
}:(
 
In the previous function void rtc_set(unsigned char rtcreg)
you use the variable names "address" and "data". The variable names are not defined and values are not assigned to them. Are they then global variables?
If the variable name "address" is a global variable then using it
as a variable name in your problem function might give you problems.???

Also in the function void rtc_set(unsigned char rtcreg) ,
the variable rtcreg is not used???

Are the names "address or data" reserved words?

I'm out of ideas. Back to power jfets.

Tom
 
Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.