I do not want square signal. I am using analog input to read the signal, but somehow I kept getting square wave looking signal. I tried to play with scaling; I kept getting same results.
This below is what I am getting:
I want curvy/smooth signal similar to this one below:
Thanks in advance for your help guys!
Solved! Go to Solution.
Right click on the plot then in visible items select plot legend, then right click on the plot legend and select common plots and select one that shows the points.
Then you can see where all the samples are. You can also adjust the interpolation style from the plot legend menu.
We cannot know how things are hooked up and how the signal actually looks like. These steps are so small that you are probably looking at the digitizer quantization.
(Sorry, I don't have your drivers. Do you have documentation? What MCC device do you use for AI?)
Your code has still glaring problems:
I believe I pointed this out before. I don't believe this will work the way you think it will.
You will probably have a race condition between which VI will run first Set duty cycle or Digital read...
Because as I said the Arduino is neither multi threading nor multitasking.
Since your program is one big loop you are speed limited by the slowest part of that loop.
An Arduino running Linx has loop rate somewhere around 200 loops per second maybe even lower depending on Linx code complexity.
You can't expect 200Hz sampling to make a smooth sinewave graph unless the signal frequency is < 20Hz.
For a laugh you can try this, some smooooth plots : )
As others have mentioned there are going to be timing issues running everything in one loop. You can separate out the MCC Daq from the Arduino stuff to get faster readings on the MCC Daq. It looks like you also want to see the PWM signal, but the rate at which the serial communication for that happens it's not going to be meaningful data (might see half a dozen points per second).
Here's a better program structure to start with. UI and Linx are handled in the top loop. The MCC Daq runs separately in the lower loop.