07-11-2024 07:56 AM
Hello, I'm creating a project and am a little stuck, I am reading data from a force gauge and a micrometer and am hoping to graph those data to an express xy graph, so far when i try to do so, there is no plot but the axes change. I have attached the vi for the project and also I included a screenshot showing the two values that will serve as the x and y axes for the graph. (just in case I get asked, the reason why both values are in two different while loops is because whenever I try to read data from the first one with a wait time of 65ms or higher, the data starts to glitch and occasionally just drop to zero, and when i try to read data from the second one with a wait time of anything less than 220ms it does the exact same thing). If you also have a fix for that it'd help.
Solved! Go to Solution.
07-11-2024 08:45 AM
Hi Michael,
all your terminals miss their labels: how should anyone know their purpose???
Your stop condition doesn't follow the usual THINK DATAFLOW! mantra…
Simple solution: use a 3rd loop to read the X and Y values and build your XY graph in there. (You don't need an ExpressVI to create a XY plot!)
07-11-2024 09:25 AM
I don't really understand the "Think dataflow" thing, thats why i put the vi there, so people could help fix the things that aren't right there. Could you fix the Stop conditions and also include the 3rd loop with the XY graph?
07-11-2024 10:14 AM
Hi Michael,
@MichaelMcalister wrote:
I don't really understand the "Think dataflow" thing,
This is the first and most important thing to learn about LabVIEW: (mostly) everything is based on DATAFLOW!
Dataflow dictates when a control is read and when the data from that control are used:
Your stop button is located outside your loops and will be read BEFORE the loops start. Think about that on your own: what happens when you click the button after the loop have started?
@MichaelMcalister wrote:
thats why i put the vi there, so people could help fix the things that aren't right there. Could you fix the Stop conditions and also include the 3rd loop with the XY graph?
I could fix this, but these are very fundamental issues in your code and you will learn much better by doing the needed steps on your own!
We are not a "homework service", but we will provide help in terms of "providing the needed buzzwords so you can read the help on them and
learn to create better LabVIEW code on your own"…
07-11-2024 11:30 AM
If you have two loops running at different speeds creating x and y values, graphing them seems pointless because the values don't correspond to the same time point.
Unfortunately, you did not "save for previous" (2020 or below) before attaching, so I cannot look at your VI.
07-11-2024 02:19 PM
I Removed the second while loop and included it's contents into the first. The readings still glitch but I can solve that later on long as i'm getting the readings. I've reinstated all the labels and i no longer see the red coercion dot on the wait time. I also saved it to a previous version. I still am not able to create a graph.
07-12-2024 01:45 AM - edited 07-12-2024 01:48 AM
Hi Michael,
@MichaelMcalister wrote:
I Removed the second while loop and included it's contents into the first. The readings still glitch but I can solve that later on long as i'm getting the readings. I've reinstated all the labels and i no longer see the red coercion dot on the wait time.
You still forgot to show some labels and there still was a coercion dot at the Wait function!
You didn't cleanup the block diagram very well…
@MichaelMcalister wrote:
The readings still glitch but I can solve that later on long as i'm getting the readings.
Your serial devices are communicating rather slow at only 9600 baud. At this speed it takes ~1ms to transfer a single byte/char and your device responses clearly contain more than one byte. So don't expect "super fast" communication from your old devices!
@MichaelMcalister wrote:
I still am not able to create a graph.
I implemented the graph with a shift register and just two functions:
Quite easy, done within some seconds…
07-12-2024 09:28 AM
... and instead of the array of clusters, a simple 1D complex array would be slightly cleaner. 😄
07-12-2024 10:20 AM
Hi Christian,
@altenbach wrote:
... and instead of the array of clusters, a simple 1D complex array would be slightly cleaner. 😄
Well, yes!
But: being able to create an array of points also helps with other functions (Threshold1DArray…). And it is the very datatype that is mentioned in the context help of the XYgraph.
07-12-2024 12:56 PM
Of course I have complained for 10++ years that "interpolate array" and "threshold array" does not accept a complex array on top (example).
Even the fitting VIs should accept complex data arrays for the Y input and would then ignore the x input... Oh well....
(Nowadays we could make a vim, of course. :D)