[En-Nut-Discussion] TWI and Philips PCF8583 Real Time Clock

Pearless Douglas.Pearless at pearless.co.nz
Fri May 16 10:34:37 CEST 2003


Hi,

I have:

	TwInit(128);
	fprintf(uart, "\nTwInit RC = %d!\n", TwMasterError());
	fflush(uart);
	TWI_speed = 100;
	TwIOCtl(TWI_SETSPEED,&TWI_speed);
	fprintf(uart, "\nTWI_SETSPEED RC = %u!\n", TwMasterError());
	fflush(uart);
	// check the speed
	TwIOCtl(TWI_GETSPEED,&TWI_speed);
	fprintf(uart, "\nTWI_GETSPEED RC = %d! %lu\n", TwMasterError(),TWI_speed);
	fflush(uart);

which gives:

TwInit RC = 0!

TWI_SETSPEED RC = 0!

TWI_GETSPEED RC = 0! 28800

I am now getting pulses on the SCL and SDA, but any attempts to read or
write give rc = 4 (TWERR_SLA_NAK).

I am suspicious of the 28800 reply from TWI_GETSPEED, should this have
100???

Thanks for the help to date,

Cheers Douglas
-----Original Message-----
From: en-nut-discussion-admin at egnite.de
[mailto:en-nut-discussion-admin at egnite.de]On Behalf Of Gediminas
Simanskis
Sent: Friday, 16 May 2003 4:36 p.m.
To: en-nut-discussion at egnite.de
Subject: Re: [En-Nut-Discussion] TWI and Philips PCF8583 Real Time Clock





> Hi Again,
>
> Thanks for the code.
>
> I have been trying to write to the PCF8583, but I always get a rc=-1 from
my
> initRTC routine, I am puzzled!
>

You init TWI ?:

   TwInit(128);
    ltmp = 400;
    TwIOCtl(TWI_SETSPEED,&ltmp);

_______________________________________________
En-Nut-Discussion mailing list
En-Nut-Discussion at egnite.de
http://www.egnite.de/mailman/listinfo/en-nut-discussion

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.481 / Virus Database: 277 - Release Date: 13/05/2003

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.481 / Virus Database: 277 - Release Date: 13/05/2003




More information about the En-Nut-Discussion mailing list