06-20-2020 01:19 PM
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?
06-21-2020 11:05 AM - edited 06-21-2020 11:06 AM
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.)
06-21-2020 07:03 PM
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
06-22-2020 12:49 AM
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
06-22-2020 01:29 PM
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
06-22-2020 02:08 PM - edited 06-22-2020 02:09 PM
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…)
06-22-2020 02:30 PM
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
06-22-2020 02:41 PM
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…