Quoting Olin Lathrop : > > After almost a whole day of trying to look at code and fixing mine, I > think I > > finally got somewhere. The procedure for obtaining the temperature for a > TC74 > > seems to be this (correct me if I'm wrong: > > > http://www.microchip.com/download/lit/pline/analog/thermal/tempsens/serial > /2146 > > 2c.pdf). Anyway, the way I'm doing it is: > > > > Send 7-bits of address (I have the part # with address 1001 000) and > then one > > bit of R/W. The first phase of transfer always seems to be write, so I > send a > > 0. > > First byte out then becomes: 1001 0000. > > I then get a successful ACK (I set SDA high intentionally, and the slave > > succesfully pulls it low). > > > > I then send the command to read the temperature, > > You should do a bus STOP here, followed by a bus START before the next > command. Regarding this, in the command sequence diagram, it shows just to just send a BUS Start bit, not stop and start. I was doing this, but neglected to mention it. > > > which is 00h. I also get a > > successful ACK on this. According to the datasheet, it says to re-send > the > > slave address accept with the R/W bit set this time, so I send: 1001 > 0001. > > And again, I get a successful ACK. > > > > Next, I should just send 8 clock pulses and be able to read the data on > SDA, > > but instead I get all 0's. > > Good. That's better than all 1s because somebody is at least pulling the > bus low. Did you make sure the master released SDA before sending the 8 > clocks? If it did, then the slave thinks it's addressed but probably > confused. That could be explained by the missing STOP/START. Or, is it > really cold in your office ? > And yes, on the ninth clock cycle, I set the TRIS bit so that SDA becomes an input. That's how it seems to get pulled low successfully. Reading the config register (0x01 instead of 0x00) also returns all 0's. And I know it's getting the TC74 correctly because I changed the address I was sending out just for kicks, and I ended up with no ACK. So I must be doing something right :-) > > ***************************************************************** > Embed Inc, embedded system specialists in Littleton Massachusetts > (978) 742-9014, http://www.embedinc.com > > -- > http://www.piclist.com hint: The PICList is archived three different > ways. See http://www.piclist.com/#archives for details. > ---------------------------------------- This mail sent through www.mywaterloo.ca -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.