LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

programmaticaly configure I/O during execution

Hi ,
 I'd like to know if it is possible to configure Input and outputs during execution to make a bidirectionnal line for an I2C protocol on a I/O line of a PCI card 6534
Thanks
Olivier
0 Kudos
Message 1 of 4
(2,934 Views)
I2c needs open collector driving.
add a cheap ls04 and you are ready.

greetings from the Netherlands
0 Kudos
Message 2 of 4
(2,927 Views)
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
Message 3 of 4
(2,896 Views)

Hi Oliver,

 

I am working on implementing I2C using 6534 .As for the progress ,i could not able to get the acknowledgement from the chip  and the SCL clock is around 1kHz with some variations.I like to know if your code worked for 6534 and if so can you kindly send the source code and how the external connections are made.

 

With regards,

JeyZ

0 Kudos
Message 4 of 4
(2,596 Views)