LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Issues with Express XY Graph

Solved!
Go to solution

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.

Download All
0 Kudos
Message 1 of 12
(606 Views)

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!)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 12
(592 Views)

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?

0 Kudos
Message 3 of 12
(575 Views)

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"…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 12
(562 Views)

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.

 

  • As a first step, you need to solve your serial issues and put everything in one loop.
  • Make sure all terminals have labels that are different from an empty string. If you don't want to see the labels on the front panel, use the caption or change label visibility. Never (NEVER!) delete the label text!
  • Learn about data types. Both your millisecond waits are incorrect. See the red coercion dots?
  • As has been said, learn about dataflow.
  • Sending text and termination characters separately is just plain silly. Bytes at port it probably incorrect, because there is very likely a termination character.
  • Where are the terminals for your local variables? Are you aware that these get written in parallel to the rest of the code and you cannot tell what happens first?
  • etc etc etc.
0 Kudos
Message 5 of 12
(553 Views)

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. 

0 Kudos
Message 6 of 12
(533 Views)
Solution
Accepted by MichaelMcalister

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…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 12
(520 Views)

... and instead of the array of clusters, a simple 1D complex array would be slightly cleaner. 😄

0 Kudos
Message 8 of 12
(499 Views)

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.

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 9 of 12
(490 Views)

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) 

0 Kudos
Message 10 of 12
(480 Views)