Discussion:
Writing a Program using Labview and USB-6009
(too old to reply)
Matt @ ICS
2008-07-14 20:40:11 UTC
Permalink
I recently installed the USB-6009 device and I am trying to use it in a LabView program.  I am trying to operate an electronic shutter which accepts a TTL signal via a BNC connector.  I have connected the BNC cable to the USB-6009 by cutting the cable open at one end and attaching the ground lead to terminal 32 and the positive lead to terminal 17.  I am trying to generate a 5 volt digital TTL signal that will cycle on for 15 minutes and off for 30 minutes.  On the block diagram screen, I have selected the DAQ Assistant.  When the DAQ Assistant opened I selected "Generate Signal," followed by "Digital Output."  At this point I must either chose "Line" or "Port," and I am not sure which to choose.  Also, after I choose Line or Port, what is the next step after that?  Both take me to a large configuration screen which I am unfamiliar with. 
Jaime F
2008-07-15 20:10:09 UTC
Permalink
Hi Matt,


A line refers to only bit on the 6009 a port is s group of
lines, so depending on what you want to accomplish you will select, lines or
port. The best suggestion I can give you is to try both so you can learn what the
differences are.


Another option instead of using the DAQ assistant you can
use the same low level VIs that are use when the DAQ assistant is created, giving
you a little bit more freedom on things to do. Best place to play with these
would be: help->find examples->Hardware Input and Output->Digital
Generation. Examples like: ?Write Dig Chan.vi?.


What I?m going to do is to point you out to a couple of
articles you can find online (please let me know if they are helpful), <a href="http://zone.ni.com/devzone/cda/tut/p/id/5467" target="_blank">Getting Started with
NI-DAQmx: Using the DAQ Assistant</a> and <a href="http://zone.ni.com/devzone/cda/tut/p/id/2835" target="_blank">Learn 10 Functions in
NI-DAQmx and Handle 80 Percent of Your Data Acquisition Applications</a>.
I hope it helps
Matt @ ICS
2008-07-24 13:10:08 UTC
Permalink
I'm having trouble putting together a program that will work with the USB-6009.&nbsp; How do I go about building a program to send the TTL signal in a cycle of 15 minutes on and 30 minutes off?
Dennis Knutson
2008-07-24 14:40:10 UTC
Permalink
Can you be a little specific about the 'trouble' you are having? You've gotten links to the basic tutorials and I would assume that you've looked at the examples in LabVIEW. Are you having problems writing a 0 or 1 or do you not know how to do the timing? Posting what you have written will help someone understand the issues you are having.
Matt @ ICS
2008-07-29 15:10:08 UTC
Permalink
Let me be a little more specific.&nbsp; I'm trying to control a shutter that can be controlled using a TTL signal.&nbsp; I have it hooked up to my USB-6009 device.&nbsp; I want the shutter activated for 15 minutes and closed for thrity, and this must take place 500 times.&nbsp; I think the best way to get this control is through DAQ Assistant.&nbsp; So I open the DAQ Assistant and click Generate Signal.&nbsp; Because I want a pulse output, I select Counter Output, followed by Pulse Output.&nbsp; However, I get a message that says No Supported Devices Found.&nbsp; So I go back and then select Digital Output followed by Line Output.&nbsp; I select the line that my cable is attached to (Screw Terminal #17 - Port0,Line0).&nbsp;
&nbsp;
Now I'm at the DAQ Assistant main setup screen.&nbsp; Since I want a pulse output I want to select N Pulses from the Timing Settings pull-down menu.&nbsp; However, there are only 3 options for me to chose from: 1 Sample (On Demand), N Samples, and Continuous Samples.&nbsp; And, even though I have 3 options, the only one that I can select without an error message is 1 Sample (One Demand).&nbsp; The other 2 options give me an error message that says "This task currently has an error.&nbsp; You can continue, but it will not run until all errors have been fixed."&nbsp; When I click on the button that says show error, I get this message
&nbsp;
Error -200077 occurred at DAQ AssistantPossible Reason(s):Measurements: Requested value is not a supported value for this property.Property: SampTimingTypeYou Have Requested: Sample ClockYou Can Select: On Demand
&nbsp;
How can I use the DAQ Assistant to generate a pulse TTL signal that is high for 15 minutes, low for 30 minutes, and cycles 500 times?&nbsp;
Dennis Knutson
2008-07-29 15:40:07 UTC
Permalink
You don't have the correct hardware to do timed output. You can only do software timed I/O. Here's a real basic example of a state machine with the DAQ Assistant and Elapsed Time Express VIs.
You'll want to modify it some if you need to stop it early.


Basic Software Timed Digital.vi:
http://forums.ni.com/attachments/ni/70/9264/1/Basic Software Timed Digital.vi
Matt @ ICS
2008-07-29 19:40:10 UTC
Permalink
Dennis,
Thank you for your help.&nbsp; That program, <a href="http://forums.ni.com/attachments/ni/70/9264/1/Basic%20Software%20Timed%20Digital.vi" target="_blank"> Basic Software Timed Digital.vi</a> , is what I need.&nbsp; I've been modifying it slightly, and I have it the exact way that I need it.&nbsp; However, the ratio seems to be unchangeable.&nbsp; That's fine for now, because I need it as it is, but if i need to change the ratio of activated&nbsp;time and unactivated time, how do I go about that?
Dennis Knutson
2008-07-29 21:10:08 UTC
Permalink
Change the value that is wired to the Elapsed Time function. One has a value of 900 sec (15 min) and the other has a value of 1800 seconds (30 minutes). If you want, make them into a control. If you want, make an array of values and pass it through the for loop. You could have a different time for each cycle.
Matt @ ICS
2008-07-31 19:10:15 UTC
Permalink
I think there might be something wrong with that program.&nbsp; It works fine for small intervals; anywhere from .5s to 3 minutes.&nbsp; However, something goes wrong when the times is set for 15 minutes.&nbsp; It works fine at first; 15 minutes on and 30 minutes off.&nbsp; Somewhere around the 2nd or 3rd cycle the signal turn on and never goes back down.&nbsp;
&nbsp;
Either the shutter is reading the USB-6009 incorrectly, or the USB-6009 stops working correctly.&nbsp; Using a voltmeter I found that during the time when the shutter refuses to close, the USB-6009 voltage remains high.&nbsp; This leads me to believe that the problem is not with the shutter but witht the USB-6009 or the LabView program.&nbsp; How can I fix this?
G Lo
2008-08-01 18:40:22 UTC
Permalink
Matt,
&nbsp;
Could you attach the code that you are talking about?&nbsp; I opened the example that was posted earlier but this does not seem to be what you are referring to.&nbsp; Would a counter output&nbsp;be feasible?&nbsp; You could output at a chosen frequency (not the exact frequency) but would have to do some kind of software processing to stop after a certain amount of time.&nbsp; &nbsp;
Matt @ ICS
2008-08-04 13:10:10 UTC
Permalink
The example that was posted earlier IS the program that I am referring&nbsp;to.&nbsp; I've made a few cosmetic changes, but the program is mostly the same.&nbsp; Here it is:


Photochromic Program Cycle Locked2.vi:
http://forums.ni.com/attachments/ni/70/9313/1/Photochromic Program Cycle Locked2.vi
G Lo
2008-08-05 23:40:06 UTC
Permalink
Hi Matt,
I tried that code that you sent me and it does not seem to function like you stated.&nbsp; Also, I tried changing the code but it seems that there is some strange behavior with two Elapsed Time vis used.&nbsp; I have not found a way around this yet but you could utilize a flat sequence structure inside of your for loop which would make the line high, hold it for some time, drive the line low, hold it for some time.&nbsp; This is not very elegant but should get the job done.&nbsp; Once again, I tried this code out with some slight modifications and found that it ran once with no problems but would keep the previously stored value of the Elapsed Time.&nbsp; I will check into this a little bit further but please let me know if the sequency structure will do or if something like a counter could work in this application as well.&nbsp;
Matt @ ICS
2008-08-15 21:10:07 UTC
Permalink
Let me try this again.&nbsp; I was give a program by one of the NI engineers named Dennis.&nbsp; The program is <a href="http://forums.ni.com/ni/attachments/ni/70/9264/1/Basic%20Software%20Timed%20Digital.vi" target="_blank"> Basic Software Timed Digital.vi</a>, and it is exacty what I need except for one small problem.&nbsp; This is a program to control a TTL signal, and it is programmed so that the low signal lasts twice as long as the high signal.&nbsp; This works for times under 5 minutes, but at 5 minutes and greater, the signal will cycle once, and then freeze at the high signal.&nbsp; I need to run the program for 15 minutes on high and 30 minutes on low.&nbsp; &nbsp;Please help.&nbsp;Here is the program that I have been running.


Photochromic Program Cycle Locked.vi:
http://forums.ni.com/ni/attachments/ni/70/9392/1/Photochromic Program Cycle Locked.vi
Loading...