PDA

View Full Version : I2C with 8564 RTC



suded
- 30th July 2008, 10:06
Hi,
I'm using I2C command with 8564 RTC .
I2Cwrite is working ok.
I2CREAD is not giving me what I want.

ADCON1=127
sda var portb.4
scl var portb.5
dt var byte
I2Cwrite sda,scl,$A2,$0D,[80] 'write 80 hex in register 0D.
I2Cread sda,scl,$A3,$0D,$A2,[dt] 'This command should put 80 hex in dt
write 0,dt 'this puts dt i.e.80 hex in EEPROM location 0.

according to the datasheet of 8564 I2CREAD should be written as above control address (read) ,reg address ,control address (write).

When compiling the above patch, no error appears in PBP.
Can you suggest where the problem is or how I can modify/rewrite/rearrange I2CREAD.
Processor is 18F1320. PBPv2.46 ,IDE MCSP
Thanks
Suded.

suded
- 30th July 2008, 10:16
RTC is RX-8564 EPSON with built in XTAL 32.768 kHz.

Darrel Taylor
- 30th July 2008, 10:32
This might help ...

I2CRead & I2CWrite not working as expected
http://www.picbasic.co.uk/forum/showthread.php?t=587
<br>

suded
- 30th July 2008, 12:03
Hi Darrel,
Thanks for your reply.
I checked the thread you suggested it has only I2Cwrite.
I aslo found some good software in Reynolds(Rentron) website for I2C comm. but that uses individual subroutines SHIFTIN,SHIFTOUT it will be good if the I2CREAD command can do the job by itself & will be more compact.
The Reynolds software deals with the same sitution that I have.
Regards.
Suded.

Darrel Taylor
- 30th July 2008, 18:51
I checked the thread you suggested it has only I2Cwrite.

That's true, she only used I2CWRITE in the examples.

But the problem she was describing applies to both I2CWRITE and I2CREAD.
And that problem is also in your code. (along with some extra stuff)
<br>

manwolf
- 31st July 2008, 03:20
This might help ...

I2CRead & I2CWrite not working as expected
http://www.picbasic.co.uk/forum/showthread.php?t=587
<br>

Darrel

You pointed me to the answer to my question before I asked. Man are you GOOD!

1. It pays to read all threads even if they are not about something you are doing or your own thread.

Was going to ask how to capture a broken wire, missing I2C device in a I2CRead.

F1CHF asked and answered it in the #2 post.

THANK YOU Darrel and F1CHF. and suded too.