LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using a voltage input to trigger a waveform

Solved!
Go to solution

Hi, everyone.

 

I am completely new to LabView, and pretty new to programming in general, and am having some issues creating this VI. We are trying to create a waveform, then excite an analog port, which will trigger our camera. The camera will then provide a voltage output every time it captures a frame. I would like the actual playing of the waveform to be triggered by this output. I am getting an error message when I try to run my VI and I'm not very confident about the conditional formatting I've put together.

 

Another thought was to create a variable, which would change in value according to whether our conditional statement is satisfied. Basically:

X=0

If *trigger conditions* = true then

X=1

If X=1 then

*play waveform*

X=0 (until we run the VI again)

 

 

Appreciate all feedback! Thanks!

0 Kudos
Message 1 of 6
(3,258 Views)
Solution
Accepted by topic author EDUBOUE

What error message are you getting?
I could not run your program because some dlls are missing, but you can see that there are some broken wires...

Regards,

Renato Giovanini
Product Engineer
AVIBRAS Aerospace
0 Kudos
Message 2 of 6
(3,249 Views)

Possible reason(s):

Write cannot be performed when the task is not started, the sample timing type is something other than On Demand, and the output buffer size is zero.

Call DAQmx Start before DAQmx Write, set auto start to true on DAQmx Write, modify the sample timing type, or change the output buffer size.

Task Name: _unnamedTask<23>

 

0 Kudos
Message 3 of 6
(3,247 Views)

Thank you for the help. I am not seeing any obvious broken wires, is it possible you could provide me with an example of where? Thank you again, new to labview!

0 Kudos
Message 4 of 6
(3,241 Views)

Try to use a Start Task function between Trigger Configuration and Output array for loop.

 

"Call DAQmx Start before DAQmx Write"

Regards,

Renato Giovanini
Product Engineer
AVIBRAS Aerospace
0 Kudos
Message 5 of 6
(3,237 Views)

You mention problems "creating this VI".  The VI you attached is one that NI created as a "Do Everything" example -- you want to Start Simple and make As Messy As Necessary (but no messier!).

 

There are several things going on in your description, most of which are not in the Example code, and are not so well described or thought out.  Sometimes it helps just to make a list of the things you want to do, then to think about how you might do them.

  • You want to create a "waveform".  Describe it.  How rapidly will it be "played" (how many points/sec, or Hz), how long will it last, and how many points will you need to generate?  [I hope you know that these three numbers are "related").l
  • What action starts everything going?  Do you want to push a button on the Front Panel?  Do you want something to automatically happen once an hour?
  • You have a camera that will take images of something (not specified, might not be important).  What are the specifications of the Camera?  Describe the Image format (Grey Scale, RGB, etc.), the Camera's Image Size, and the Frame Rate (if you are recording videos instead of a single image).
  • What starts the Camera?  You mention a Trigger, but also mention an Analog Port.  Most "Triggers" use Digital Ports, sometimes called TTL (for Transistor-Transistor Logic, where 0v is False, 5v is True, and somewhere around 2.8v is "ambiguous" -- the circuitry does its very best to see it only "sits" at 0 or 5v, and switches very quickly).  How do you plan to generate this (voltage) signal?  Do you have some additional hardware plugged into your Computer that can generate Analog or Digital Output voltages?
  • You mention that the Camera generates a voltage output every time it captures a frame.  This is almost certainly a TTL pulse that can be read with either a Digital or Analog input.  Do you know the specifications of this pulse?  Does it "switch" between 0 and 5v (like a TTL signal)?  How long is it "high"?  Note that if it is a very brief pulse (a fraction of a millisecond), you might want/need additional circuitry to make sure LabVIEW can "see" it when it flies by.
  • You say you want the Waveform to be played by "this output", which I think means the Camera's "Capture-a-Frame" pulse.  Do you know if this Pulse occurs at the start of the capture or at the end of the Capture?  [I would think you would want the Waveform to be played at the start of the capture ...].

Juggling these multiple conditions may sound complicated, but once you have them written down and spelled out (please don't take shortcuts -- open a Text Editor and make a (formatted) list that you can post to the Forum), you can think about how to organize the various pieces.  I would suggest starting without a Camera, without a DAQ Device for generating/recording pulses and other waveforms, but with simple logic and "dummy" (or "simulation") VIs for the Camera, Pulse Generator, etc. so you can test out your logic and simulate the timing.

 

Speaking of timing, the last Bullet point talked about playing the Waveform at the end (or beginning?) of each Frame.  If you are taking a Video at, say, 30 fps, and are playing an audible sound (say a 1KHz tone), then it needs to be pretty short, as a new frame occurs every 33 ms (beep, not beeeeeeeeeeeep).

 

Looking forward to your responses.

 

Bob Schor

Message 6 of 6
(3,218 Views)