> I am trying to interface a ds1624 to a pic 16f84. Here is my problem.. > picbasic wants to send a control byte the highest bit of which says whether > the following address variable is to be sent as 8 or 16 bits. The example > they give is using an eeprom. The control variable for it is %01010000 the > device code is the 1010 and the pin straps are the 000 on the end. They add > a 0 on the front end because the address to be sent is only 8 bits. A > ds1624 however has a device code of 1001. I have my straps set to 010. But > it needs one more bit(the least significant) to tell it whether the command > is to be writen or read to the ds1624. The "control" variable is only 8 > bits so my byte would look like %1001010x. I am pretty sure the address for > the ds1624 is 8 bits. but this would configure it to 16. How can I fix > this? Has anyone out there interfaced a ds1624 and picbasic? > I took a quick look at the datasheet and I would try the following The control byte contains a 4 bit control code which is '1001' for read and write operations. The next 3 bits are the device select bits, in your case '010' (A2/A1/A0). The last bit is a '1' when a read operation will be performed, else '0' for write. So to start you send a 'start' condition on th I2C bus High SDA High SCL Low SDA Low SCL Now we send the control byte Send out %10010100 (Meaning 1001 = control code / 010 = device select / 0 = write operation) Wait for ack .... Send command to DS1624 ... Hope this helps, Thierry Vanmarcke