Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

Writing a Program using Labview and USB-6009

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. 
0 Kudos
Message 1 of 23
(11,983 Views)

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), Getting Started with NI-DAQmx: Using the DAQ Assistant and Learn 10 Functions in NI-DAQmx and Handle 80 Percent of Your Data Acquisition Applications.

I hope it helps

Jaime Hoffiz
National Instruments
Product Expert
0 Kudos
Message 2 of 23
(11,969 Views)
I'm having trouble putting together a program that will work with the USB-6009.  How do I go about building a program to send the TTL signal in a cycle of 15 minutes on and 30 minutes off?
0 Kudos
Message 3 of 23
(11,921 Views)
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.
0 Kudos
Message 4 of 23
(11,914 Views)
Let me be a little more specific.  I'm trying to control a shutter that can be controlled using a TTL signal.  I have it hooked up to my USB-6009 device.  I want the shutter activated for 15 minutes and closed for thrity, and this must take place 500 times.  I think the best way to get this control is through DAQ Assistant.  So I open the DAQ Assistant and click Generate Signal.  Because I want a pulse output, I select Counter Output, followed by Pulse Output.  However, I get a message that says No Supported Devices Found.  So I go back and then select Digital Output followed by Line Output.  I select the line that my cable is attached to (Screw Terminal #17 - Port0,Line0). 
 
Now I'm at the DAQ Assistant main setup screen.  Since I want a pulse output I want to select N Pulses from the Timing Settings pull-down menu.  However, there are only 3 options for me to chose from: 1 Sample (On Demand), N Samples, and Continuous Samples.  And, even though I have 3 options, the only one that I can select without an error message is 1 Sample (One Demand).  The other 2 options give me an error message that says "This task currently has an error.  You can continue, but it will not run until all errors have been fixed."  When I click on the button that says show error, I get this message
 
Error -200077 occurred at DAQ Assistant

Possible Reason(s):


Measurements: Requested value is not a supported value for this property.

Property: SampTimingType
You Have Requested: Sample Clock
You Can Select: On Demand
 
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? 
0 Kudos
Message 5 of 23
(11,873 Views)

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.

Message 6 of 23
(11,870 Views)

Dennis,

Thank you for your help.  That program, Basic Software Timed Digital.vi , is what I need.  I've been modifying it slightly, and I have it the exact way that I need it.  However, the ratio seems to be unchangeable.  That's fine for now, because I need it as it is, but if i need to change the ratio of activated time and unactivated time, how do I go about that?

Message 7 of 23
(11,859 Views)
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.
0 Kudos
Message 8 of 23
(11,854 Views)
I think there might be something wrong with that program.  It works fine for small intervals; anywhere from .5s to 3 minutes.  However, something goes wrong when the times is set for 15 minutes.  It works fine at first; 15 minutes on and 30 minutes off.  Somewhere around the 2nd or 3rd cycle the signal turn on and never goes back down. 
 
Either the shutter is reading the USB-6009 incorrectly, or the USB-6009 stops working correctly.  Using a voltmeter I found that during the time when the shutter refuses to close, the USB-6009 voltage remains high.  This leads me to believe that the problem is not with the shutter but witht the USB-6009 or the LabView program.  How can I fix this?
0 Kudos
Message 9 of 23
(11,824 Views)
Matt,
 
Could you attach the code that you are talking about?  I opened the example that was posted earlier but this does not seem to be what you are referring to.  Would a counter output be feasible?  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.   
0 Kudos
Message 10 of 23
(11,805 Views)