07-17-2013 04:13 PM
Hello,
Does any have a sample code for the NI USB-6501? I need to set 24 DO to High/Low in my code.
The sample codes under Help>Find Example>Hardware input and out>... are not working. I need to control these IO independently.
Thanks!
Solved! Go to Solution.
07-17-2013 04:26 PM
07-17-2013 04:27 PM
@tian66 wrote:
Hello,
Does any have a sample code for the NI USB-6501? I need to set 24 DO to High/Low in my code.
The sample codes under Help>Find Example>Hardware input and out>... are not working. I need to control these IO independently.
Thanks!
Have you made sure that the NI-DAQmx drivers are installed properly? (http://joule.ni.com/nidu/cds/view/p/id/2337/lang/en) You should be able to search for examples by hardware. For me, NI USB-6501 did not show up on the list, but if the drivers are good, you should be able to find examples.
07-17-2013 04:47 PM
Hello,
From the NI MAX, it shows the driver I installed.
The driver might not be installed properly. Do you know how to check it?
Thanks!
07-17-2013 04:52 PM
Hello GerdW,
I need to find an example that can set each output to high/low.
I have installed the USB-6501 driver(9.7.0f0) and I can use the Test Panels in the MAX. It works very well.
But when I go the Help>Find Example> Hardware Input and Output>Digital Output>example, it seems no sample code to do the fuction I am expecting. Besides, those code cannot even regonize the device.
Thanks!
07-17-2013 04:57 PM
@tian66 wrote:
I have installed the USB-6501 driver(9.7.0f0) and I can use the Test Panels in the MAX. It works very well.
But when I go the Help>Find Example> Hardware Input and Output>Digital Output>example, it seems no sample code to do the fuction I am expecting. Besides, those code cannot even regonize the device.
Have you tried searching by device? Help > Find Examples… > Find Hardware (lower left corner) should give you examples specific to the NI USB-6501.
07-17-2013 05:08 PM
Got it!
It is a good example to modify. Thank you!
Right now it is using an array of switch.
Do you know how do I seperate the array of switches since I need to set the output individually in a loop with other functions? (e.g set DO1 DO3 DO5... to high one by one)
07-17-2013 05:16 PM - edited 07-17-2013 05:17 PM
@tian66 wrote:
Got it!
It is a good example to modify. Thank you!
Right now it is using an array of switch.
Do you know how do I seperate the array of switches since I need to set the output individually in a loop with other functions? (e.g set DO1 DO3 DO5... to high one by one)
You can index an array of switches just like you would any array. I've attached a sample VI showing how to replace the value of one switch (assuming array of booleans).
Usually, arrays can help keep the block diagram neater. Also, it's a good way to set all of the switches to some pre-defined value. (Say you need to set them all false or all true.)
If you're going to change them methodically, you can use the loop index to also index the array, if that's what you want.