Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

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);
}
 

alzomor

Advanced Member level 2
Joined
Jun 9, 2005
Messages
678
Helped
39
Reputation
78
Reaction score
8
Trophy points
1,298
Location
Cairo
Activity points
6,417
Hi

Excuse me

what's the keyword use s used for?

Salam
Hossam
 

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,

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

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,

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.
 

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,

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
//==========================
:cry: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.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top