02-04-2021 04:48 AM - edited 02-04-2021 04:51 AM
Hello,
I need to achieve continuous generation of signals about frequency from 1 to 200 Hz. The DO will goes to DAC and on the output became as analog signal on the same frequency. For convert to analog I use resistor-ladder. DAC working good as separated Vi. I tested AO single and double on one Vi. The problem is following:
I use DAQmx palette. But after generating I gets error 200621 (buffer underflow).
Is there method to achieve number of samples which cant give me signal with suitable smooth signal?
In the other sight isn´t that synchronization related problem?
For synchronization of 16 DO I use SW-timed synchronization.
For synchronization of 2 AO I use Continuous non-regeneration synchronization.
Any tips?
Thank you.
- Cuprum
02-17-2021 01:15 AM
Hi,
Have you tried running basic example Vis on your system?
Could you please share the code you are trying to run?
02-17-2021 03:56 AM - edited 02-17-2021 04:00 AM
Hi,
yes I tried examples from Help > Find examples >HW input and output > DAQmx.
Did not find any solution.
This error still occurs by one time from ten random deploy of code.
My specs of laptop: processor i7-7700HQ, 16 GB DDR4 ram, nvme 256 GB Samsung storage
The code is in attachment.
Kind Regards, Cuprum
02-17-2021 05:53 AM
Remove the 1000 msec wait from the loop. That should make the buffer underflow error go away. Once the loop iterates rapidly a few times at startup to fill the buffers, DAQmx will do the waiting for you. Since you're writing 1 sec worth of data per loop, you'll eventually settle into a 1 sec per iteration loop rate.
You're writing a multi-sample digital waveform to an unbuffered, software-timed DO task. I don't think your device supports hardware-timing for DO, so you should be writing just 1 DO sample (that can contain values for all 16 lines). I don't know what you'll get when you try to write a multi-sample waveform to a 1-sample-at-a-time task.
Then you have the problem of sync. Or rather, the lack of sync. And the basic impossibility of sync with that device. You're writing AO data to a buffer. There will be some latency delay as the data works through the task buffer and the device's own hardware buffer before it becomes a real world signal. Meanwhile, you'll have to write to DO with software timing where there will be no buffer and much less latency. And you'll only generate 1 DO state for every 1000 AO states. And that's just an average -- you won't actually have enough timing control for that 1 DO state to occur *exactly* every 1000 AO states.
In an earlier thread you were using a 6259 device. *That* one at least is capable of buffered DO and hardware-driven sync. It's a little indirect though as you'll need to understand and use "correlated DIO". Basically, the DO task will need to borrow its sample clock from the AO task.
-Kevin P
03-16-2021 06:52 AM
Dear Kevin Advice,
thank you for your reply which opened my eyes.
Now I got seriously problems with my digital output timing.
The project is cardiac pacemaker impulse tester. Those impulses will be reference for waveform located on the inside of heart muscles.
I need three analog outputs, based on three locations inside of heart.
Elvis II its not capable to gives three analog outputs, so I decided to bring third one by using 16x DO for
resistor ladder digital to analog convertor.
I used to generate that impulses by triangle pattern, with timing for analog outputs it works very good. I can set delay, amplitude, frequency & number of samples.
But for digital outputs, it doesnt works very well. It does not sync the impulses itself. Minimum DO I can use is 8x DO.
I sending here output on oscilloscope. The offset is not at zero (I am using differential amplifier for correcting this).
I tried to set DAQmx write (Digital > Single Channel > Multiple samples > 1D U32), there is difference that I am not using Analog to Digital vi.
Is there solution for this? Thank you.
03-16-2021 08:05 AM
I've never used any NI ELVIS hardware, but over in this thread, you seem to have confirmed that DIO can only be software-timed by marking that response as your solution.
That being the case, I don't think this particular device is capable of letting you accomplish what you want.
As I stated before, there are 2 buffers worth of latency in the AO task where sample timing is governed by a hardware clock, largely independent of your loop iteration rate. The DO task will have to be based on software timing where you can generate 1 sample per call to DAQmx Write, and sample timing depends almost *entirely* on loop iteration rate.
You're just not going to be able to get reliable sync this way. You need a more capable DAQ device. You certainly should not be expected to run tests on something as important as a pacemaker without also being equipped with a more suitable DAQ device.
There isn't a lot of point trying to give you small incremental help b/c it's all heading toward a dead end.
-Kevin P