Digital output from DAQmx library error/inaccuracy #1838
Unanswered
rafinhafpb
asked this question in
Q&A
Replies: 1 comment 2 replies
-
I might be wrong, but judging by the error the problem is related with your device, not Bonsai. Are you sure your hardware is capable of generating digital output signals in buffered mode? |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello, Bonsai comunity!
I am using the DAQmx acquisition board USB-6210 and I want to create a TTL signal in which I can control the frequency, duration of the pulse, and duty cycle using the
FunctionGeneration
node from Bonsai. I am having some trouble when trying to use theDigitalOutput
node from the DAQmx library. Following the examples from the documentation page here, the node doesn't seem to accept the output from FunctionGenerator directly, regardless of the parameters I try, resulting in the error shown in the picture below.However, I managed to get a coherent response from the node after changing the workflow as shown below, as instructed by another documentation here and by setting the BufferSize to 1.
This method, as quoted by the last documentation, "seems to work well for
SamplingRate
<= 100 Hz". However, I need to work with wave frequencies up to 100 Hz. Therefore, aSamplingRate
of 1000 Hz would be ideal to achieve a better resolution of the wave, as each cycle would have 10 samples to define it (right?).I have been trying to use higher sampling rates, but the resulting wave seems to add a slight delay after some iterations, making the accuracy of the response worse for higher frequency values. Essentially, I am struggling to find an optimal
SampleRate
. Lower values result in better time accuracy, but the wave resolution is poor (the square waves do not have well-defined 50-50 on-off cycles). HigherSampleRate
values improve resolution, but time accuracy is lost for frequencies above 40 Hz. For example, running a 100 Hz wave for 1 second with a sample rate of 1000 Hz results in a wave of 100 cycles in 1.05 seconds instead of 1 second (a wave of 95 Hz instead of 100 Hz).My question is: Is there a more accurate method to produce these high-frequency waves without using the AnalogOutput node? I know this is the solution proposed by the last documentation I linked, but my acquisition board does not support analog outputs. Also, has anyone encountered the same error shown in the first picture and managed to solve it without changing the workflow?
I am also attaching my workflow, which I modified based on the Bonsai.Examples.PulseGenerator found in the Bonsai Gallery:
DAQmx test.zip
Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions