Continue to Site

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.

Writing variable on DS1307 ?

Status
Not open for further replies.

bianchi77

Advanced Member level 4
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
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top