LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Build a table - multicolumn listbox

Solved!
Go to solution

Hi everyone,

 

I want to build a table with some numeric controls and ring and enum. 

The values set above (in the numeric controls) should then be inserted into the multicolumn listbox (table) via the "Add" button. The "Change" button should allow the values entered in the table to be changed again. The "Delete" button should delete the row from the table.

Unfortunately, I am a beginner and don't know labview very well. I hope someone can help me and give me tips on how to create such a table.
In the attached picture you can see how the table should look at the end.

 

Thanks a lot!

 

Download All
0 Kudos
Message 1 of 13
(1,986 Views)

@Leamri wrote:

Unfortunately, I am a beginner and don't know labview very well. 


I recommend the learning resources listed at the top of the forum.

 

(I'll have a look at your VI later)

Message 2 of 13
(1,953 Views)

(OK, now I am at a computer where I can actually open VIs saved in LabVIEW 2021)

 

Your VI makes absolutely no sense. All you have is a greedy loop that consumes 100% of a CPU code doing nothing. Please never delete the label of front panel objects, you can hide the stop button label by "right-click...visible item...label". If you delete the label instead, you have terminal without the label, making the code potentially confusing and even prevents you from ever using locals or events in any reasonable way. Pressing a "stop" button to start the instrument IO is just not intuitive!

 

You need a proper state machine with a toplevel while loop, keeping the 2D string array in a shift register where you can add/change/delete rows based on the selection (the "value of a listbox" is the selected row!). Now you should use an event structure with events for the various buttons and modify the string array accordingly, then writing them to the listbox.

 

 

Message 3 of 13
(1,944 Views)
Solution
Accepted by topic author Leamri

See if this quick draft can give you some ideas (I am sure you want to customize the formatting to your exact needs). Make sure you fully understand every detail!:

 

altenbach_0-1654970461573.png

 

Message 4 of 13
(1,941 Views)

Thank you very much!

 

I reed your post about greedy loops. So if I'm using a while loop i need to add a time constant such as 10 ms. Right?

 

Now i need to use the values added to the table to transfer to my instrument driver (agilent signal generator). Can I then simply tap them via a second connection and connect them? (See VI)

But I think the connection is wrong because I want to use the data wish is listed in the table..

0 Kudos
Message 5 of 13
(1,893 Views)

Since this is an interactive loop, even 10ms is fast. How fast can you possibly enter new values 100x per second?

(But yes, a greedy loop will spin many millions of times per second using 100% of a CPU core (draining your battery, increasing your electric bill, and heating your room!), so if you reduce it to 100/second, CPU is <<0.1%. Big difference!)

 

Sorry, I can't look at your VI at the moment, but you have a table with multiple rows, but only one instrument (I guess). Do you want to sequence trough the table one row at a time? Do you want to pick a specific row? The "value" of the listbox is the selected row, so you have all the information to index that out.

 

The correct way would be to architect the code into a simple state machine. One state is where you add new values and another state might be where the communication with the instrument occurs. 

Message 6 of 13
(1,879 Views)

Thanks a lot!

Exactly I have an instrument (signal generator) that is connected to an oscilloscope. The lines are to be transmitted to the signal generator one after the other. So that an RF signal with several pulses is generated.

 

A state machine consists of a while loop and a case structure located within the loop. Should I then add a case structure to the event structure you created? Then the event structure and case would be next to each other in the while loop. Or can I also use a new event to control the instrument?

Unfortunately, my case structure has some errors. I know I have to create a default case but than I have to wire every selector value and I don’t know what I should connect them to.

0 Kudos
Message 7 of 13
(1,844 Views)

Dear Altenbach,

 

Now I have another question. I want to implement two buttons for the Burst signal. The first one is to turn on an “infinite cycle” for the Burst and the other one is to “Enable/Disable Burst”.

Since the already implemented buttons "add", "delete" and "change" refer to the table, I cannot add the new buttons to the same string. Do you have an idea where I could insert the new buttons? Just the “infinit cycle” button has to be placed in the table, the other “enable/disable” button is out of the table.

 

Later, the control elements (initialize, generate waveform, burst etc.) of the instrument (function generator) will be inserted and connected to the numeric controls such as frequency and the buttons so that I can control the signal generator.

 

Thanks in advance.

0 Kudos
Message 8 of 13
(1,761 Views)

Sorry, like many other top contributors here, I have no access to LabVIEW 2021 at the moment. If you want better chances at help, consider "save for previous" before attaching your code.

 

All you need is a flexible and scalable state machine. anything is possible! I have no idea what "adding buttons to a string" even means! Makes no sense!

0 Kudos
Message 9 of 13
(1,736 Views)

You can ignore the question about the buttons. I have attached the VI with the previous labview version.
I would like to connect my Vi to an instrument (signal generator from Agilent). I also created various numeric controls and rings to set the amplitude, frequency, etc..

 

On the one hand I want to control the instrument via the controls and on the other hand I want to be able to save the set values in the table at the same time. The instrument should adopt the values that are set on the controls. The table is only for saving the settings (I still have to create the logging unit).
The best thing would be to connect the states somehow. I had already tried this once and only got error messages.

Is there a way to connect the two processes? And does a state machine make any sense at all?

 

thanks in advance.

0 Kudos
Message 10 of 13
(1,715 Views)