I am using the USB-6009 to control a motor. I am able to set 1 output value, but in my case I will need to set up 2 output values which automatically are able to work alternately ... first value to work for 2 seconds then the other value works for 2 seconds. Can anyone kindly help me with this?
the attached VI will do the job for you.
I am waiting for your feedback or questions.
For doing anything other than the most simple (some might say "trivial") examples of DAQ I/O, you should learn how (easy it is) to use DAQmx and really get control of your hardware. There is an excellent White Paper available -- do a Web Search for "Learn 10 Functions in NI-DAQmx and Handle 80 Percent of your Data Acquisition Applications". Another good source for help and inspiration are the Examples that ship with LabVIEW, one of which Akos_43 used as a "solution", but without giving credit to NI nor explaining how it worked.
It is often a good idea to think what you want to do, and to figure out, sometimes with the help of MAX, how you might do it. Have you used MAX to "explore" your device? [I think the White Paper mentioned above discusses this].
Think about what you want to do. One way to describe your output signal is that it has voltage V1 for 2 seconds and voltage V2 for 2 seconds, then repeats. This could be described as a waveform having two points, V1 and V2, and an update rate of 1/(2 sec) or 0.5 Hz. There are numerous ways to create such a signal, a Waveform being the most compact (you can ignore t0, set dt, the update time, to 2 (seconds), and set the Y array of values to the two-element array [V1, V2]). Now, using the 3-5 VIs that you learned about in the "Learn 10 Functions" White Paper, you can write very simple DAQmx code that will play out this Waveform until you push the Stop button. Note that the While Loop will play out "entire cycles", so it might output what seems like an "extra" cycle -- if you need things to "stop immediately", you will need to "rethink" this method.
Both of the previous hints will not work since you can only set digital (or analog) outputs on a USB-6009 with software-timing.
You are correct. I actually tried to generate a DAQmx Task to do this and plugged in a USB-6009, but I also had a USB-6002 plugged into the same PC, and chose the wrong USB device for my test. My apologies.
So the problem definitely simplifies (though you run into other problems that are "solved" by LabVIEW's Data Flow model, one that allows the "Pulse Train Loop" to run independently, and in parallel with all the rest of the code.
So let's just concentrate on generating a two-state DC signal, switching every 2 seconds.
Write the code, try it out, if it works, come back and let us know (and say "Thank you"), and if it doesn't, feel free to return and post your code (no pictures!).
thank you for your help. I figured out another way to make it work, I really appreciate you help.
thank you all for your help. At the end I was able to manage it someway by using Elapsed time with a case structure as shown in the attached picture.