Hello Olivier,
Albert is correct in his assertion, the I2C protocol calls for
open-drain lines. I believe the IC that Albert referenced is the
74LS04; you can find the data sheet
here,
which discusses that this is a basic Hex inverter with open-collector
outputs. In regards to your question about bi-directional lines, there
are several implementations that would allow you to both read and write
digital data. If you want to use the same line for both input and
output, you'll need to reconfigure the line each time you want to
switch operations. This will involve stopping or clearing the NI-DAQmx
task and then creating a new task of the opposite type (ie clear input
and create output or clear output and create input). This operation
would be somewhat software intensive and you would have to add the
overhead of processing the data in software as well.
Alternately, you could use two channels for each signal (one input and
one output). In the case of I2C you would have the serial data (SDA)
and the serial clock (SCL), so you would need 4 channels. You would
then tie each input/output pair together to create one, bi-directional
line. When you want to write, you would simply write to the digital
write channel. When you want to read, you would set the write channel to
tri-state and then read from the read channel. This is important
because you do not want to drive the line with multiple devices at the
same time; which means you also need to be careful about making sure
that your IC only reads while the DAQ device is writing to the line.
Matt Anderson
Hardware Services Marketing Manager
National Instruments