LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to trigger analog signal with digital signal using digital edge

Solved!
Go to solution

Hi,

I am having trouble wiring my digital trigger to the analog output. I am attaching a portion of the labview program I am modifying...in short, trying to get Dev1/ctr2 to control Dev1/ao1. The top portion does not make sense nor work, but it is my attempt to incorporate the digital edge module.

 

Thank you.

 

Edit - the analog waveform I am triggering is being read from a data file (table) that I've created outside the program. Ultimately, I want a 1 second square pulse wave (digital) aligned with a 3 second custom waveform (analog).

0 Kudos
Message 1 of 6
(3,488 Views)

First off, please attach code as we cannot debug pictures.

 

Next, it's unclear as to what you're doing. Are you generating the square wave, or is it coming from somewhere else? If you're generating it, you can share a StartTrigger between the two tasks. If it's coming from somewhere else, you can use the Start on digital edge trigger. For that, you'll need to wire the trigger source (i.e., which pin you want to use) to the Start- Digital Edge trigger.

 

I recommend looking in Help -> Find Examples, then Hardware and DAQmx. There are many very good examples there. I would recommend you start with one of those and modify it to meet your needs.

0 Kudos
Message 2 of 6
(3,460 Views)

I've attached our entire code here. 

 

To answer your questions: yes, we are generating both the square wave and analog wave. I'm having trouble understanding how to properly wire the Start Trigger module, or another method of synchronization between the digital and analog signal.

 

If you could direct me to an example, that would be helpful as well. I have yet to find something that matches our needs, so I'm looking for any lead.

 

Thank you so much in advance.

 

Edit - I'm also attaching the excel file required to run the program here.

Download All
0 Kudos
Message 3 of 6
(3,452 Views)
Solution
Accepted by topic author moyashi1

Ok, a set of possible changes. Hopefully you can try them and see if they work - I only checked they don't have errors:

  1. Your Read from Spreadsheet File uses the default "tab" as a delimiter, but your file is a CSV. Wire a string constant with a "," to the delimiter input on the bottom
  2. Set the Rate input for the DAQmx Timing node at the top. You can use "Reciprocal" on your dt value to get 100 (and to make sure they stay in sync).
  3. Add a DAQmx Write node after the Timing node, and then via the dropdowns choose Analog Output >> Single Channel >> Multiple Samples >> Waveform. Connect your waveform. In the downloaded VI, it was connected to the "units" input of the Create Virtual Channel, which makes no sense and causes an error.
  4. Add a DAQmx Export Signal node to the counter that you're interested in. Wire a constant value of "Counter Output Event" to the type, and then choose a PFI terminal for the output location. Connect the same value to your Start Digital Trigger for the AO task.
  5. Right click on the For loop edge and choose "Conditional Terminal". Get rid of the "Stop" node (which kills LabVIEW) and connect the Stop button to the new conditional terminal. (edit - I added a constant here - you should keep the control of course!)

changes.png

 

There are other improvements that could be made, but hopefully that will get you started.


GCentral
Message 4 of 6
(3,422 Views)

Wow thank you!! Much appreciate your help. I will try this tomorrow.

0 Kudos
Message 5 of 6
(3,406 Views)

One more improvement for you:

 

Be sure the AI task gets started before the counter task that's going to trigger it. 

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
Message 6 of 6
(3,369 Views)