need help in correcting errors

Status
Not open for further replies.

weifeng

Junior Member level 1
Joined
Dec 8, 2005
Messages
17
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,497
hi,

can anyone help mi to modify this RTC program?

there is an error when i build it in MPLAB IDE. I am using C18 compiler.
the 3rd line in red is an error....


#define DS1307_SDA PIN_B1
#define DS1307_SCL PIN_B0
#use i2c(master, sda=DS1307_SDA, scl=DS1307_SCL)

//==========================
// initial DS1307
//==========================
void init_DS1307()
{
output_float(DS1307_SCL);
output_float(DS1307_SDA);
}
//==========================
// write data one byte to
// DS1307
//==========================
void write_DS1307(byte address, BYTE data)
{
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);
}
 

Hi

Excuse me

what's the keyword use s used for?

Salam
Hossam
 

hi,

i duno wat is it use for oso, tat's y i asking for help...
 

hi,

i reali hope sum one could help mi wif this program. i nid to get it done urgently.
i reali appreciate if sumone can offer help. thanx.
 

hi,

i tried correcting sum errors in this program alreadi, but stil the line in red is wrong... does anyone knows the 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);
}
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…