LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Displaying Voltage Values from a Table to an XY Graph in LabVIEW

Hi everyone,
I'm currently working on a school project that uses LabVIEW.
Basically, the goal of my project is to measure battery voltage and display the data in a table and a graph on the LabVIEW front panel.

Once the data is stored in the table, I want to extract the voltage values and display them in an XY graph with two plots:

  • Plot 1 shows the relationship between cell number and its voltage.

  • Plot 2 is a reference line at 1 volt, which marks the minimum voltage for a cell to be considered good.

The problem is, based on the VI I made, the graph isn't showing the voltage values from the table.
Does anyone know what might be wrong? Or maybe someone could help me fix the VI?

Thanks in advance!

0 Kudos
Message 1 of 12
(567 Views)
  • None of your controls contain any data. Make sure that all have typical default values before posting.
  • For example the X, X2, any Y arrays are all empty. Your first graph cannot have more points than the X array. 
  • Your table reference is pointless, just branch from the wire in the shift register. That's where the data already is!
  • You can index out the third row without transposing the 2D array first.
  • Your shift register is not initialized, but it should probably be with an empty array so no old data is retained between runs
  • It is sufficient to initialize the serial port once before the loop, not with every iteration.
  • To just graph 1D array data vs. array index (or cell number), all you need is a plain waveform graph.
  • To graph a reference line, you can just position a suitable cursor programmatically.
  • Your table date is in the shift register. Your "reset table" button does not touch that at all. What do you expect that button to actually do?
0 Kudos
Message 2 of 12
(536 Views)

Hi Me,

 


@Me.03 wrote:

The problem is, based on the VI I made, the graph isn't showing the voltage values from the table.
Does anyone know what might be wrong? Or maybe someone could help me fix the VI?

Thanks in advance!


  • Why do you need a "value" property node of that table to read the data? You already use a shift register with wires to store the data!
  • Do you really read integer values from your DMM? Probably not: why do you use the DecimalStringToNumber function then? It gives just integer values - as written in the LabVIEW help and visible by the blue wire!
  • Your X, X2 and Y arrays are empty: empty array will result in empty plots…
  • Why do you open/initialize and close the COM port IN EACH iteration??? Open/Init once before the loop and close once after the loop…
  • The "Reset table" button DOES NOT reset the table…
Best regards,
GerdW


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

Here's q quick simulation draft using a table and a chart. Maybe it can give you some ideas....

 

 

altenbach_1-1746426528739.png

 

0 Kudos
Message 4 of 12
(526 Views)

Thanks for your reply.
But I got a bit confused when I tried running the VI you shared.

1. In my case, the data from VISA Read is still in string format, but the Waveform Chart needs data in double (DBL) format.

2. Also, the graph in your example uses time as the X-axis, but in my project, I want the X-axis to show cell numbers instead.
As far as I know, Waveform Charts only support time on the X-axis, which is why I decided to use an XY Graph.

Sorry if I misunderstood something. I’m still new to LabVIEW and currently learning to get the hang of it.

0 Kudos
Message 5 of 12
(511 Views)

Hi Me,

 


@Me.03 wrote:

1. In my case, the data from VISA Read is still in string format, but the Waveform Chart needs data in double (DBL) format.

2. Also, the graph in your example uses time as the X-axis, but in my project, I want the X-axis to show cell numbers instead.
As far as I know, Waveform Charts only support time on the X-axis, which is why I decided to use an XY Graph.


  1. Then you can convert that string into a DBL float value. In your VI you converted to an integer…
  2. You can use a waveform graph instead as it supports plots with same X distance between points - no need for a XY graph…
    (Charts can show "time" on their X axis, but mainly support only "counting up" the number of points in the plot.)

@Me.03 wrote:

Sorry if I misunderstood something. I’m still new to LabVIEW and currently learning to get the hang of it.


LabVIEW comes with a huge example library, and there are example VIs for charts and graphs…

Best regards,
GerdW


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

 

  • Is it correct to use the Fract/Exp String To Number function? Because when I tried using it, the VI gave me an error.

  • Based on the image I attached, the point where X = 2 (the second data point) doesn't seem to be at the correct voltage position. Is that how it’s supposed to be, or did I misunderstand something? 

 

Download All
0 Kudos
Message 7 of 12
(490 Views)

Hi Me,

 


@Me.03 wrote:

 

  • Is it correct to use the Fract/Exp String To Number function? Because when I tried using it, the VI gave me an error.

  • Based on the image I attached, the point where X = 2 (the second data point) doesn't seem to be at the correct voltage position. Is that how it’s supposed to be, or did I misunderstand something? 


  • Which error did you get? Apparently there are float values shown in your table (image)…
  • The 3rd value is ~0.85 and it is shown as 3rd point in the plot. Why do you think it should look different???

 

Best regards,
GerdW


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

Sorry if I confused you, Gerd. The screenshot I attached earlier was the result from the example VI that was provided previously. However, when I applied it to the VI I created, the graph did not appear as it should. Here, I’m attaching my VI and a screenshot of the graph from my VI when it is run.

Download All
0 Kudos
Message 9 of 12
(452 Views)

Hi Me,

 

this time you forgot do downconvert your VI before uploading.

I prefer LV2019…

Best regards,
GerdW


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