LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Digital-SW-Timed Output using a 'waveform' data

Hi. I'm trying to send a waveform data to a digital channel.

I slightly modified the example 'Digital - SW-Timed Output', which is for a single data, to accommodate a waveform data. The code is attached.

The modified code doesn't look to output any signal (checked with an oscilloscope). Can you please tell what I am missing?

 

0 Kudos
Message 1 of 8
(2,169 Views)

Hi 3doptics,

 

it doesn't make sense to output a whole waveform to a SW-timed DO pin.

 

Try this to output one sample after the other:

(Maybe you need to set the autostart flag at DAQmxWrite or reposition the DAQmxStart call: usually you write a waveform before starting the task.)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 8
(2,111 Views)

Hi GerdW,

 

Thank you for providing the solution.

I believe the solution you suggested achieves a different goal from what I was trying to do.

I was trying to send a trigger signal (defined as a waveform '010') from the Labview program to an external device through a DO channel. The time interval between the data points of the waveform (dt) should be different from the time interval between the trigger signals, which is set by the 'Wait' function in the for loop. 

Could the 'Digial-SW-Timed Output' be used (after some modification) for this purpose, or would I have to use a completely different approach?

 

Best regards,

3doptics

 

0 Kudos
Message 3 of 8
(2,102 Views)

Hi 3doptics,

 


@3doptics wrote:

I was trying to send a trigger signal (defined as a waveform '010') from the Labview program to an external device through a DO channel. The time interval between the data points of the waveform (dt) should be different from the time interval between the trigger signals, which is set by the 'Wait' function in the for loop. 

Could the 'Digial-SW-Timed Output' be used (after some modification) for this purpose, or would I have to use a completely different approach?


I guess you need to use a different approach: the DAQmx task will output the waveform again and again (by default) independently how often (and when) you rewrite the data buffer! When you want to output a short waveform at defined times you need to

  1. output the data one time
  2. then stop the task and restart when needed (this will takes it's own time for reconfiguring!)
  3. or put the DAQmx task on hold and re-arm when needed (less time needed because you don't need to reconfigure the DAQmx task)
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 8
(2,085 Views)

 

Hi GerdW,

 

Thank you for your time and suggestion.

Could you please tell which functions allow to "put the DAQmx task on hold and re-arm"?

 

To illustrate what I was trying to do, I have uploaded a vi (and a screen capture). With this, I could go up to 500 Hz. It solves my problem, although it's far from being elegant.

 

Best regards,

3doptics

 

Download All
0 Kudos
Message 5 of 8
(2,073 Views)

Hi 3doptics,

 


@3doptics wrote:

To illustrate what I was trying to do, I have uploaded a vi (and a screen capture). With this, I could go up to 500 Hz


Having a loop spinning 100k times for 4ms per iteration lets the user wait for 400s (or ~7mins). Quite a long time…

 

Your device is connected via USB and you are trying to send commands at 1kHz command rate (1ms wait for each frame): this will not work reliable using the USB2 connection of your DAQ device on a standard Windows computer…

 

Read this article from LabVIEW help on DAQmx task state model. (It's linked from the DAQmxControlTask function description…)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 8
(2,069 Views)

Hi GerdW,

 

Yeah, that was an example file written for a demonstration purpose. The parameters will be adjusted when the code is incorporated into another main code. I'm using a NI DAQ board, so I assume 1 kHz may be OK, even though I'm not sure how the Windows will handle it. It looks OK at least on an oscilloscope. 

Thank yo for sending the link.

 

Best regards,

3doptics

0 Kudos
Message 7 of 8
(2,058 Views)

Hi 3doptics,

 


@3doptics wrote:

I'm using a NI DAQ board, so I assume 1 kHz may be OK,


I was mixing this with some other discussion in a different thread: is your DAQ device connected by USB or do you use some built-in DAQ card (PCI(e))?

In case of USB this would be the bottleneck…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 8
(2,053 Views)