LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Turn DAQmx task on and off with a waveform

Hi,

I am trying to create two DAQmx tasks that will alternate (one is ON while the other is OFF and vise versa) with a certain frequency, say, 1KHz. In my particular case the tasks are two pulse trains (a VI attached) with potentially different duty cycles and/or frequencies on two different counters on a DAQ. The frequencies of the pulse trains are much higher than the frequency of the switching between the two. 

I thought I'll create some sort of enable signal and feed a square wave into it that will turn the tasks on and off, but I am not able to make it work. I see triggerable examples, but am not sure how to make the tasks not only start with a trigger but also stop with the oppisite trigger, as needed in my case.

It is probably very simple but I am very new to LabView and after several hours of failed attemps I hope someone could give me a simple solution.

I attach the pulse train VI.  

Thanks a lot in advance.

0 Kudos
Message 1 of 5
(2,788 Views)

What hardware are you using to generate the pulse trains? The features of your hardware may have limited triggering capabilities.

 

Here is a community example that implements a software start and stop trigger. https://decibel.ni.com/content/docs/DOC-6471

 

Here is an example that implements the same feature, but using hardware. http://zone.ni.com/devzone/cda/epd/p/id/5016

Regards,

Anjelica W.
National Instruments
Product Marketing Manager
FlexLogger and TestStand
0 Kudos
Message 2 of 5
(2,761 Views)

Thanks a lot.

I am running this on USB X Series DAQ (USB-6636)

I am new to LabView, but looking at the examples, it seems to me that these solutions are not exactly what I need. The start and stop events there stop the acquisition/generation of the signal altoghether while I need the signals to be generated all the time with the switch between the two being of a certain high enough (say, 1Khz) frequency which is much lower than the frequency of the signals.

Here is what I mean: the 1Khz signal switches the faster train pulses on and off all the time.

Thanks a lot in advance for any help.PWM.jpg

0 Kudos
Message 3 of 5
(2,745 Views)

I also have the following example (attached) in which the pulse generation can be started and paused, but the signal to start/pause needs to come on one of the PFI lines. So, I guess if I found a way to generate a 1KHz square wave on a PFI line, I'd be done. However, I cannot figure out a way fo doing it. Using the DAQ assistant, for example, allows me to generate continuous sample only on port 0  - when I try to generate them on any of the other ports (and thus on PFI lines) I get an error that buffered operations are not supported. So, I am stuck.

Any help would be very appreciated.

0 Kudos
Message 4 of 5
(2,741 Views)

The output of your counters are connected to PFI lines. You can find out which pins these are in the Measurement and Automation Explorer by right clicking the device and selecting Device Pinouts. There are examples in the NI Example Finder in Hardware Input and Output >> DAQmx >> Generating Digital Pulses.

 

Regards,

Anjelica W.
National Instruments
Product Marketing Manager
FlexLogger and TestStand
0 Kudos
Message 5 of 5
(2,725 Views)