LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

analog output response: USB-6009

I am hoping to use my USB-6009 device to measure an analog input, and generate an analog output based on the input.  The analog input will be a single pulse, and I would like to generate a pulse of variable length depending on what I set (with a delay between the two pulses).

I've been looking on the Find Examples in the Help section, and found some Multi function - AI/AO examples.  However, none of them are compatible with the USB-6009, according to the list.  If I select only those which are able to run on my device, there are none.

Is my device incapable of doing this?  Anyone have any directions on this?

I also read a post on here that was doing an analog output based on a discrete input, and thought that would be applicable too - but I couldn't open the attached vi's because I only have LabView 7.0 Student Edition to work with. Smiley Sad

Any help would be greatly appreciated!
0 Kudos
Message 1 of 11
(4,229 Views)
Hey kineta,

Thanks for contacting National Instruments support.  The Analog output is not hardware-timed on the USB-6009, which is why you can't just specify a trigger to start the Analog Output, and why most of the examples aren't for the USB-6009.  You can specify a trigger to the input, but that won't help you much. Basically you would have one AI task that is looking for the pulse.  When it receives it you stop the task and start the Analog output task.  I would focus on making the application that generates the pulse like you want and you can easily add the AI portion once that is finished.

Let me know if you have specific questions about making the pulses on the output.  All of this will be software-timed so don't expect perfect timing, but it shouldn't be too bad, it just depends on what you are wanting to control.

Regards,
Kenn North
Principal Product Manager - Search, Digital Analytics
http://ni.com/search
0 Kudos
Message 2 of 11
(4,201 Views)
I was looking at this page: http://digital.ni.com/public.nsf/websearch/6F2C2B49A89D685C8625711D007BDD64?OpenDocument  on software timed outputs, but could not download the VI attached as I only have the student edition (7.0).  However, it said that the "Mult Volt Updates - SW Timed" example was used, and only the array, min and max were changed.  So I did this (see attached file).  Are these all the changes that need to be made to make this work for my device?

So now, I figure I need to add a timer so the loop doesn't continue forever, but stops after a few seconds as desired.  This would require attaching a condition to the stop, that counted the time and passed true if it reached that time (thus stopping the while loop).  I've been going through the palettes, but I don't know that there is something that exists that will accomplish this.  Could I please have some further direction?

As for adding the analog input, I've made a basic "read in analog input" vi, but placing a condition on it so that it moves from inputing to outputing will be something more...

All the direction and help you could possibly give me would be absolutely wonderful! Smiley Happy
0 Kudos
Message 3 of 11
(4,179 Views)
Hey kineta,

There is a function that will output a true when the time is reached, it is the Elapsed Time Express vi.  You can use that true to stop the loop.  You can do this manually as well, but this should suit your needs.  It is located in the Timing pallette in LabVIEW 7.0, but just do a search for "Elapsed Time". 

I was thinking that you could place, either a DAQ Assistant, or a simple set of DAQmx vi's to acquire an Analog Input, once it occrurs, you would stop that task and clear, and just move onto the Analog output, usign the Error cluster to force sequence.

Let me know if you have further questions.

Regards,
Kenn North
Principal Product Manager - Search, Digital Analytics
http://ni.com/search
0 Kudos
Message 4 of 11
(4,164 Views)
Using all of your wonderful suggestions and tips, the attached file is what I came out with.  Without attaching any equipment to the device (generators, meters), it seems to work excellent.  You hit the first stop button (simulating the error ending the input loop) and the output loop will run for the Target Time (in seconds) before returning to the input loop.  So, everything works fabulous...

Until I add a sine, square or dc voltage (I was trying everything) to the input.  For one, hitting stop will not go to the ouput voltage.  For two, even if my input voltage surpasses the min/max channel settings, all it does is clip the signal, instead of triggering an error to end the loop.

If I don't put an input in, and hit stop (to check the output loop), it does output my desired voltage - only it doesn't drop the voltage back to zero,, but continues to output the same voltage even after we are reading an input again.  I only want a voltage to be output when we are in the ouput loop (thus simulating a pulse of variable length).

Could you take a look at my vi, and help me get it to work from here?

Thanks so much!
0 Kudos
Message 5 of 11
(4,142 Views)
Hey kineta,

Your vi looks ok.  There are few things to note.  It's true that the vi's will not give an error if you exceed the max or min, you will have either handle this yourself or not provide a voltage that is higher than you expect.  It is also true that the device will begin output where ever the last voltage output left off, but to fix this, just call the write function again outside the loop after you are done writing 4.8V to set it back to zero.  That should take care of that problem.

You are providing 1000 samples to the write function, but you may run longer than that if your time to wait is longer than it takes to write 1000 samples.  You may have already considered this, but just to be sure you did I thought I'sd metion it.  And finally, I did not see the behavior that no output occurs after I hit the upper stop button, but I had to change the input to the Elapsed time vi to something greater than zero. 

Let me know if you have further questions.

Regards,
Kenn North
Principal Product Manager - Search, Digital Analytics
http://ni.com/search
0 Kudos
Message 6 of 11
(4,132 Views)
I modified the vi (see attached) and made my own "max" error detecting system, and added the second write .vi to clear the signal - which worked absolutely fantastic (thank you so much for your help!) except for one thing...

If I attached a DC voltage supply to the analog input instead of a function generator, the loop wouldn't trip.  This I find very confusing.  The DAQ if obviously reading the data in correctly, as it's displaying it on the display in the front panel, but it's not going through my "max and min" system correctly to trip the error.  Why would this be?  As a switch is more a change in DC voltage than an analog signal, I need this to work.  Could you help me out with this final problem please 🙂

Thank you for all your help.  You've really been a lifesaver.
0 Kudos
Message 7 of 11
(4,112 Views)
Hey kineta

The reason it doesn't work is that the AC amplitude of a DC signal is 0, so the max is always going to be zero.  So if you are providing a DC signal you can use the method I have laid out.  You had selected Nsample NChannel for your AI read, but I changed it to NSampl 1Channel for this to work, but if you are only reading one AI channel it should be fine.

I also changed your output loop to take advantage of indexing.  Your math was a bit odd and I think it actually reversed your array, but that may have been what you wanted and you would want to change it back, but this way is less code.  Let me know what you think.

Regards,

Message Edited by Kenn N on 04-11-2007 12:59 PM

Kenn North
Principal Product Manager - Search, Digital Analytics
http://ni.com/search
0 Kudos
Message 8 of 11
(4,105 Views)
Yes, DC signals have no AC components... I just didn't realize it only read AC when it was, infact, showing the changing DC voltage on the graph when I changed the AC voltage.  But no matter, makes sense.

Thank you for helping me out with the file, only there's one problem --- the file you attached is in 8.2 and I only have the student version (7.0), so my labview won't load the file you've attached!  Smiley Sad
0 Kudos
Message 9 of 11
(4,100 Views)
Hey kineta,

Here is a screen shot of what it looks like.  That vi in the input loop with the Y is the Get Waveform Component's vi.  To get the loop tunnel on the output loop to be indexed, simply right-click on the tunnel and select Enable Indexing. 

Let me know if you have further questions.




Regards,

Message Edited by Kenn N on 04-11-2007 02:06 PM

Kenn North
Principal Product Manager - Search, Digital Analytics
http://ni.com/search
Download All
0 Kudos
Message 10 of 11
(4,091 Views)