From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Button to Record Elapsed Time

Solved!
Go to solution

I am new to LabVIEW and creating a program to measure eight thermocouples simultaneously during a welding procedure. I am appending the data to a .csv file because we are running for multiple hours, and once the file size of an .xlsx gets too big, the sample rate slows down. However, this makes it more difficult to determine the exact time of certain temperatures, which we would like to know so we can denote certain processes (preheat, interpass, etc.).

 

My current goal is to create a button that will read the current value of the "Elapsed Time" indicator and write it down somewhere on the front panel, and subsequent presses continue to add to this list of saved times. The button will act like the "Lap" button on a stopwatch, saving timestamps when pressed.

 

Thank you,

0 Kudos
Message 1 of 10
(3,768 Views)

In order to show multiple times, you'll need to change your elapsed time indicator to an array. You can store this array in a shift register. If you press record time, put your new time first so it is at the top of your array. You already have the while loop, you just need to add the shift registers, build array, and case structure.

 

Also, if you have time it would be good to look into some LabVIEW basics and design patterns. Many projects start out small, and then you add little features here and there and they become a nightmare to maintain. If you learn how to use State Machines and Producer / Consumer (events) patterns it will make your life much easier!

 

temp.png

Message 2 of 10
(3,752 Views)

Thanks for the help!

 

I now am able to record the times into the array, but is there any way to get them to go into a list box instead? That way I could keep all of the points in a small, neat area with its own scroll bar, rather than guessing how many times I will need to record a time during a given session and making the array that large.

 

Thanks again!

0 Kudos
Message 3 of 10
(3,728 Views)

Hi tyount,

 

is there any way to get them to go into a list box instead?

Yes, sure! That's what listboxes are used for!

 

Did you look at the example VIs coming with LabVIEW? They most often explain such things…

(I just verified: There are examples for listboxes!)

Best regards,
GerdW


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

@tyount19 wrote:

I now am able to record the times into the array, but is there any way to get them to go into a list box instead?


Listboxes are nothing more than a fancy way of displaying arrays.  The datatype of a listbox is a 1D array of strings so you will need to convert your array of timestamps to an array of strings.  Then look at the property nodes for the listbox, specifically the ItemNames property. 

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 5 of 10
(3,699 Views)

Hi Aputman,

 

The datatype of a listbox is a 1D array of strings

Wrong: the datatype is either I32 or an array of I32…

You need to set objects using propertynodes!

Best regards,
GerdW


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

You are correct.  That's what I get for responding before having my morning coffee.  Smiley Very Happy

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 7 of 10
(3,688 Views)
Solution
Accepted by topic author tyount19

@tyount19 wrote:

Thanks for the help!

 

I now am able to record the times into the array, but is there any way to get them to go into a list box instead? That way I could keep all of the points in a small, neat area with its own scroll bar, rather than guessing how many times I will need to record a time during a given session and making the array that large.

 

Thanks again!


Increase the array in the vertical direction, you can then use a vertical scroll bar. Notice how I never set the array size, I just keep appending elements to beginning of it, so you don't need to do any guessing.

 

If you're talking about the array indicator, it is no different than a listbox. A listbox has finite size. If you want, you can change the number of elements in the array using a property node, but the way I have shown you will put the most recent time at the top.

Message 8 of 10
(3,679 Views)

@Gregory wrote:


Increase the array in the vertical direction, you can then use a vertical scroll bar. Notice how I never set the array size, I just keep appending elements to beginning of it, so you don't need to do any guessing.

 

If you're talking about the array indicator, it is no different than a listbox. A listbox has finite size. If you want, you can change the number of elements in the array using a property node, but the way I have shown you will put the most recent time at the top.


Ahh, perfect! I had to decrease the array to a 1x1 and then re-expand it for the vertical scrollbar to become an option.

 

Thanks for your help and patience, I definitely have a lot of learning ahead of me!

0 Kudos
Message 9 of 10
(3,673 Views)

Sure thing. For 1D arrays, if you are showing multiple elements in the vertical direction, you can right click >> visible items >> scroll bar, to show the vertical scroll bar. For some reason, if you're only showing 1 element you can only show the horizontal scroll bar...

0 Kudos
Message 10 of 10
(3,671 Views)