Yofumo Mimoto wrote: > >>>Do you know how to read a half duplex line and know, by hardware, how > >>>to tell who is sending data, if master or slave ?? Yes, I know how. The better way to ask the question would be 'How would one read a half duplex signal...' > >I've used hardware in the past, to set them to different pulldown currents, so that the master out-drove the slave. (or vice-versa) > >Then the different voltage levels tell you who is talking, but you need an oscilloscope to see this. > > > That thing is interesting, but i wanted to do it with a pic16f628 and a > memory I2C, i guess is not something easy, might you capture current > with A/D or some other parts of a PIC to try to do this ? Use a comparator to measure the direction of the voltage drop of a low value resistor placed in series between the master and slave. The I*R drop will be of different polarity depending on who is driving the line. Record the comparator output during bit low times (or stuff it into a D flip flop (with R/C delay) and latch it with the rising edge of the bus). Alternatively, add the series resistance, but use the comparator to sense whether the pulldown was right to ground (near side of R) or nearly ground (far side). You have to pick an R value that won't adversely affect your bus, but gives you enough difference that you can easily sense who pulled the bus low. Since both devices are CMOS, I'd suggest back to back schottky diodes for a 0.3V drop and still have good current drive. Robert -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.