Shop OBEX P1 Docs P2 Docs Learn Events
I2C and Ds1307 direction bit question — Parallax Forums

I2C and Ds1307 direction bit question

DigitalCDigitalC Posts: 1
edited 2012-05-19 15:53 in BASIC Stamp
I am practicing with the I2C protocal using the stampworks SW21-Ex33 program with the DS1307 real-time clock.
I was reading the Ds1307 data sheet and it states that the last bit of the address byte is the direction bit (1 for read and 0 for write)
The stamp works program uses the same device ID for both the read and write subroutines using I2COUT and I2CIN. I see how the device ID byte will work for the write mode but do not see the 1 bit that would be required for a read mode. Is this bit handled by the I2Cin and I2COUT commands automaticaly?
Thank you for your help

DigitalC

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2012-05-19 15:53
    Yes, the direction bit is handled by the I2CIN and I2COUT statements. The reason is that a read operation (I2CIN) actually consists of a write operation that provides the address followed by a read operation as specified in the statement. The PBasic interpreter has to force write mode, then read mode to get the work done.
Sign In or Register to comment.