Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Programming Digital port read and write.

The below Vi was used to interface a digital IC for one of my setups. I am using USB 6009 DAQ digital port. Channel 0 is read while channel 1 is written. Channel numbers may vary but read and write operations are done on two different channels. My problem is that even though channel 0 is configured as input, when that is connected to a LED, LED illuminates. Why is that my channel does not go to high impedance state ?
In my final work channel zero may be used to read and write using a one wire device. Is there are any other methods to handle this ?

- Pubudu
0 Kudos
Message 1 of 15
(5,012 Views)

Hi Pubudu,

The reason the lights up is because there are some pull-up resistors on USB-6009. These pull-up resistors are connected to 5V. Depending on the way you are controlling your LED. This 5V connected to pull-up resistors will drive the voltage.

Attached manual for USB-6008 can help us look at the circuit for DIO line of 6009 closely on page 17:

http://www.ni.com/pdf/manuals/371303f.pdf

However, when it is connected to IC. If the IC drives it low ---> the value will be read as 0 (because in this scenario it is equivalent to shorting the digital line to ground). If the IC drives the digital line high -- the voltage on the line will be read as high (because the voltage drop across the pull-up resistor is zero).

Hope this helps.

Kalyan

Kalyanramu Vemishetty
Automated Test Systems Engineer
National Instruments
0 Kudos
Message 2 of 15
(4,991 Views)
Hi,

Thanks for the information. I understood that now.
How can I use USB 6009 to read and write through the same channel line. i.e. I shold be able to configure the same line as a input but sometimes as a output line. THis is to be used with 1 wire devices. I searched every where but could not find anything so far.

Pubudu
0 Kudos
Message 3 of 15
(4,942 Views)
This is what I want.

I need to use 3 lines.

Line 1 : Clock signal.
Line 2 : Data (read and write)
Line 3 : Reset.

Line 3 : High
Line 3 : Low (reset)

When reading data,

1. Clock High
2. Clock Low
3. Read Line 2
4. Clock High
5. Clock Low
6. Read Line 2
7. . . . . .
This repeats . . . .

When writing
1. Clock High
2. Clock Low
3. Write Line 2
4. Clock High
5. Clock Low
6. Write Line 2
7. . . . . .
This repeats . . . .

How can I set line direction programmatically . . . . if possible example would be great. . . !
0 Kudos
Message 4 of 15
(4,938 Views)

Hi Pubudu,

I was wondering if you can post some more information about the chip you are trying to use? Is the chip communicating in I2C Mode?

Attached is an example which demonstrates how to perform simultaneous read and write on the same channel.

The example works for 8 lines, but you can tweak it to make it work for single line.

If you are looking for a card which can communicate easily with an I2C chip, you can look for further information here.

http://sine.ni.com/nips/cds/view/p/lang/en/nid/202368

Thanks,

Kalyan

Kalyanramu Vemishetty
Automated Test Systems Engineer
National Instruments
0 Kudos
Message 5 of 15
(4,924 Views)
Hi Kalyan,

I am trying to use DS1620 temperature sensor.
Data sheet : http://www.maxim-ic.com/reliability/dallas/DS1620.pdf

Its not I2C I guess.

I am looking at the example u sent. Thanks a lot for that

Pubudu
0 Kudos
Message 6 of 15
(4,919 Views)
Hi Kalyan,

This is what I am looking for. TriState thing. I searched everywhere but I could not find this. Now I think I can handle it. Thanks again for the help.

Pubudu
0 Kudos
Message 7 of 15
(4,918 Views)
HI Kalyan,

Simple question. The port I use has 4 lines (port 1). How can I write 4 bits instead of 8.

Thank you,
Pubudu
0 Kudos
Message 8 of 15
(4,917 Views)

Hi Pubudu,

Each element inside the array corresponds data for a line/channel.

If you want to do write only 4 lines,

modify configure lines to test as: <devicename>/port0/line0:3.

Then, modify the array to hold only 4 elements and delete rest of the elements inside the array. To delete an element from an array, right click on the element to delete and navigate to Data Operations >> Delete Element. Attached screenshot in zip file demonstrates it.

Please take a look at the attached modified example. I would recommend playing with regular digital write and read examples and then use this example.

Thanks,

Kalyan

Kalyanramu Vemishetty
Automated Test Systems Engineer
National Instruments
0 Kudos
Message 9 of 15
(4,906 Views)
Sorry, Attached a wrong one. Please refer to the attached zip file.
 
Kalyan
Kalyanramu Vemishetty
Automated Test Systems Engineer
National Instruments
0 Kudos
Message 10 of 15
(4,904 Views)