04-11-2022 10:16 AM
Good morning, I am making a LabVIEW program using the NI 6363 USB X. The program basically reads 9 analog channels simultaneously while outputting an analog output that is a triangle wave every 100ms. All inside a while loop where I also record the data read into a binary file. But for some reason, the graph jitters (shifts left and right) on the x axis every cycle. I am using a sampling rate of 50000, and the analog output should take 100ms. Any idea of why this happens? Or how to make the graph stop jittering?
Solved! Go to Solution.
04-11-2022 11:04 AM
First of all, it helps if you clean up your block diagram before posting. It's very unorganized with lots of unnessecary sequence diagrams, wire bends and local variables.
Can you make video what you mean? I ran your code and I don't see what you describe. The video shows some random data of a DAQmx device I had lying around.
If you mean that the axes themselves are moving around you can right-click a graph go to advanced and disable Auto Adjust Scales.
04-11-2022 11:44 AM
Hi, sorry for the clutter, it is my first post here. In the video below if you look at the triangle waveform it is shifting left and right. That is what I want to stop. Because I want each cycle to be the same. So that the triangle always starts at 30ms for example. I am using min(V) = -0.2, max(V) = 0.6, and Ramp rate = 300 on the analog output tab.
Thank you in advance and have a nice day.
04-11-2022 11:46 AM
Apparently the attachment didn't stay. Here is the video.
04-11-2022 12:09 PM
This behaviour happens because you aren't using any kind of hardware trigger. The software can jitter for all kinds of reasons, it'll never be exactly timed.
I'm not sure what you need to do with your software. But you need to at least synchronize the output and input by, for example, setting the analog input to start reading on the analog write start trigger.
04-11-2022 12:46 PM
Ok, so is there a way to make it so when the analog output reaches -0.1V for example, it would read some samples before and after that? I was reading this page after what you said. https://www.ni.com/en-us/support/documentation/supplemental/21/ni-daqmx-data-acquisition-triggering-.... Or how would you do it if your interest is to just read the waveform? Because the other thing I am doing because of the jitter is to use threshold detection to know when the triangle starts.
04-12-2022 03:48 AM
As I understood from your program, you want to peridiodically send a triangle and then measure the response. You can use this simple triggered measurement where reading is synchronized with writing.
The data to write can be like this, where you can modifiy the time before and after the triangle.
Consider that both in your example and mine, the periodicity will not be exactly peridiodic, since there is still the software starting and stopping of the tasks. If you want exact perdiodicity, modifiy the above code with this:
Hope this helps, if you have more question, I'd be happy to answer them.
04-12-2022 05:13 AM
You really should clean up your diagram, it's 90% empty space.
And what is this monstrosity?
04-12-2022 05:33 AM
@AeroSoul wrote:
You really should clean up your diagram, it's 90% empty space.
And what is this monstrosity?
...
You know, we all started somewhere, he mentioned that this is his first post. Constructive criticism is good, but just saying that his code is bad doesn't help at all and discourages people from coming back to this forum.
With experience comes better code.
04-12-2022 05:52 AM
Kudos for the really nice illustration from Basjong53!
Tidbit: because the tasks share a sample clock (and are started in the correct sequence), there's no need for the start trigger. It doesn't hurt, but you'll find that if you remove it you get the exact same sync & behavior.
-Kevin P