[bascom] DS1307 Real Time Clock and I2C with Bascom
Hi,
My name is Greg White and this is my first posting to the list.
Can someone out there tell me if the DS1307 RTC from Dallas is really an I2C
device.
I am trying to get it working using the I2C routines in Bascom and am having
no success at all.
I have successfully been able to get other I2C devices such as the PCF8574
I/O expander going using Bascom.
>From what I have found out there are a few hardware catches with the DS1307.
I have got the Vbat connected to ground so it cannot float, and 4.7K pullup
resistors on the SCL and SDA lines. The 32Khz crystal is connected to pins 1
and 2, Still no go.
First I want to enable the oscillator output on SQW/OUT and then be able to
read the time.
I have used the following code to try and get SQW/OUT working but it doesn't
seem to work:
Config Scl = Portb.0
Config Sda = Portb.1
'Turn on oscillator
I2cstart
I2cwbyte &HD0
I2cwbyte 0
I2cwbyte 0
I2cstop
'Enable SQW/OUT
I2cstart
I2cwbyte &HD0
I2cwbyte 7
I2cwbyte &B00010011
I2cstop
Thanks in advance for any help.
Regards
Greg White
Australia