Writing variable on DS1307 ?

Status
Not open for further replies.

bianchi77

Advanced Member level 4
Joined
Jun 11, 2009
Messages
1,313
Helped
21
Reputation
44
Reaction score
20
Trophy points
1,318
Location
California
Visit site
Activity points
9,442
Guys,

Does anyone of you have experience on wrting into DS1307 ?
Here's my issue,
Any ideas will be very appreciated,

Thanks in advance
I did :
Code:
weekday_increase = ds1307_addr[3] +1;

but when :
Code:
i2c_write(weekday_increase);

it gave me a complain :

Code:
Error	142	conflicting types for 'i2c_write'	C:\Users\Antonius\Documents\Atmel Studio\6.1\Clock_DS1307_V1_0\Clock_DS1307_V1_0\Clock_DS1307_V2_0.c	777	6	Clock_DS1307_V1_0

I supposed to be able on writing it directly,
The function ,
Code:
char i2c_write(char data)
{
	unsigned char twi_status;
	char r_val = -1;

	// Send the Data to I2C Bus
	TWDR = data;

	// Transmit I2C Data
	twi_status=i2c_transmit(I2C_DATA);

	// Check the TWSR status
	if (twi_status != TW_MT_DATA_ACK) goto i2c_quit;

	r_val=0;

	i2c_quit:
	return r_val;
}

it works allright when I do :
Code:
ds1307_addr[0] = 0x00;
	i2c_write(ds1307_addr[0]);//second

Perhaps I need to convert :
Code:
weekday_increase = ds1307_addr[3] +1;
but I defined it already
Code:
char weekday_increase;

Do you guys have any clues ?
Thanks in advance....

Have a good day
 

I guess you must declare weekday_increase with same type was declared at ds1307_addr[] (=char)

+++
 

it's a char already
Code:
char ds1307_addr[7];
char weekday_increase;

What do I miss here ??
 

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…