Page 1 of 1

need help in correcting errors urgently

PostPosted: Thu Feb 09, 2006 7:39 am
by weifeng
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 caps 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);
}


i knew that byte was not an integer type for C18 compiler.
i tried using unsigned char, but still the same syntax error....



Re: need help in correcting errors urgently

PostPosted: Wed Feb 15, 2006 11:56 am
by zoomcityzoom
Hopefully you have this fixed by now, but if not, what does your function prototype for
READ_DS1307() look like?
What is the specific compiler error you are receiveing?

[This message has been edited by zoomcityzoom (edited February 15, 2006).]