Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

reading/writing digital lines without external hardware (besides daq device)

Hi,

I have a USB-6259 (mass termination).  I don't have any additional hardware, just the USB device.  I  am trying to use the MAX utility (4.2.1) with NIDAQmx (8.5).  I eventually want to program digital lines (read and write them) using the NIDAQmx API.  I ran some of the VB6 samples.  I thought how it works is that I could run the WriteDigChan VB code to set line(s) on or off, then use the ReadDigChan VB code to read those lines I changed.  However that did not work so I started created some tasks using MAX however that does not work either.  I hope this is not too stupid a question but I am not too familiar with the hardware.  Do I need some additional hardware connected to my 6259 to keep those digital lines in one state or another?  I don't need to know about VB but generally using MAX.

thanks, David
0 Kudos
Message 1 of 4
(3,620 Views)

Hi David,

Measurement and Automation Explorer (MAX) is a utility that allows us to configure and test our hardware without any programming. If you are trying to test your USB-6259, you can right click on your device under My System » Devices and Interfaces » NI-DAQmx Devices and run the Test Panels. The Test Panels will allow you to write to/read from your digital input/output.

Tasks in MAX are defined to be Digital Output or Digital Input. Are you trying to use the same lines for input and output?

In order to troubleshoot this problem there are a few tests that we can perform.

First, wire one of your digital output lines from one port, to one of your digital input lines on a second port. Once this is done, use the MAX Test Panels to verify the operation of your digital input/output. Once this has been verified, write some code in VB to output on one port and use the test panel to read in the data on a second port.

Keep me posted on your results.

Best regards,

Jordan D
Applications Engineering
National Instruments
0 Kudos
Message 2 of 4
(3,594 Views)
First, wire one of your digital output lines from one port, to one of your digital input lines on a second port. Once this is done, use the MAX Test Panels to verify the operation of your digital input/output. Once this has been verified, write some code in VB to output on one port and use the test panel to read in the data on a second port.

Jordan, Thanks for your reply.

I am trying to understand the concept of digital lines, I actually have been using measurement studio for a while.  I am doing some programming work for a friend who handles all the hardware.  All I have right now is the USB6259 box.  My knowledge with programming is limited in that I use very few acquisition types and are pretty simple to me.  The functions I use in MS 6 is:

to read:
CWDIO2.Ports.item(0).Lines.item(Channelx).SingleRead Result

to write:
CWDIO2.Ports.item(Portx).Lines.item(Channelx).SingleWrite False  (or TRUE)


I am not trying to use these now, I am just showing you what I am familiar with.

I initially was trying to use the VB6 code examples which did not appear to work (for me).  I was able to program my analog signal stuff so I am not a complete dumbass.   But for the DIO stuff I am not sure how it is supposed to work.  That is why I was am trying to read/write inside of MAX which also does not seem to work for me.  But I realize I may not understand how it works.  I created some tasks in MAX, one to write 1 (or more) digital line(s) on port 0.  Then I created a read task to read line 0-7 on port 0.  None of lights come on during the read.  Like I said I don't have anything plugged into my USB 6259 via a connector.

I read your part about: First, wire one of your digital output lines from one port, to one of your digital input lines on a second port..  I am not sure what you are talking about.

thanks, David
0 Kudos
Message 3 of 4
(3,581 Views)
Hi David,

The digital lines on your card can be configured as either inputs or outputs. The lines are grouped together into Ports. For your card, Port 0 has 32 lines, Port 1 has 8 lines and Port 2 has 8 lines.

Try this:

1. Wire Port 0.0 (pin 52) to Port 1.0 (pin 11) externally.
2. Open up MAX
3. Go to My System » Devices and Interfaces » NI-DAQmx Devices and run the Test Panels
4. Switch to the Digital I/O tab click on the Start button.
5. By default, all of your digital ports should be set to read.
6. Now switch to Port 1 in the pull down menu.
7. Click on the all output button.
8. Click on the All High button.
9.
Now switch back to Port 0 in the pull down menu.
10. Look at the LED for Port 0.0.
11. Now switch back to Port 1 in the pull down menu.
12. Click on the All Low button.
13. Now switch back to Port 0 in the pull down menu.
14. Look at the LED for Port 0.0.

This should allow you to see the changing states of your digital output on Port 1.0.

Once you have finished this test. Click on the stop button and set all of the Port 1 digital lines back to All Input.

At this point I recommend trying to use the test panel to read or write while using the VB examples to perform the other operation (write or read).

Message Edited by Jordan D on 09-06-2007 11:01 AM

Best regards,

Jordan D
Applications Engineering
National Instruments
0 Kudos
Message 4 of 4
(3,567 Views)