LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Adding functionality to preexisting, primitive VISA test program. I've written a program with several case structures, but I know there has to be a more elegant solution.

Hello Everyone,

 

I'm new to the forums and (farely) new to LabVIEW. Used it for a couple simple lab exercises in school, but never took a strong interest until now. I am admittedly aweful at LabVIEW and am trying my best, but need some quick help here. The front panel is not organized as I've just finished the block diagram.

 

A quick explanation of my code is as follows:

1. I ask the user to input strings, which are used to automate file naming.

2. The start and stop frequencies are inputs since we aren't able to read that info from our equipment.

3. The ring I have is to allow the user to choose what type of measurement they're taking. 

4. My program takes the input and changes one of the inputs based on their choice.

 

The "Screen Pull and Write" VI takes these inputs and saves a CSV file to a default directory. I know that the only real difference between each structure is what type of measurement I'm taking, but I couldn't find a way to do this with an Event Structure. 

 

Please feel free to be as critical as possible. I'm learning and it's all helpful. If you hurt my feelings, shame on me for putting emotion into it.

0 Kudos
Message 1 of 6
(2,893 Views)

Hi chopeter,

 

why do you use local variables instead of wire?

Why do you use local variables when the terminals are unused?

Why do you use 4 case structures when just one is needed?

Why put constant code into structures at all?

How will you ever iterate the outer loop when the inner loop never exits?

 

THINK DATAFLOW!

(Maybe you should start to take some of those free beginner courses offered by NI on their website? :))

 

Just to give an idea:

check.png

Best regards,
GerdW


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

Hey GerdW,

 

I appreciate the feedback and I agree my code is ugly. The four case structures were because the value "0" in the picture you attached changes depending on the "Measurement Type" chosen by the user. For the case of "IL", I put a 0 since the user should not have any reference level, but for the other options, I need to make the value positive or negative depending on "Measurement Type". I want the program not to care whether they input a positive or negative number to avoid an added level of confusion.

 

I found some threads on similar issues and think something like the attached photo should work for me.

 

Just want to reiterate that I do appreciate the feedback and I will be going through the beginner guides, but wanted to get some quick code going to help process improvements at work.

0 Kudos
Message 3 of 6
(2,873 Views)

Hi chopeter,

 

why don't you wire the "Ring" value directly to the case structure selector?

Best regards,
GerdW


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

@GerdW wrote:

Hi chopeter,

 

why don't you wire the "Ring" value directly to the case structure selector?


Better yet, replace the ring with an enumerated control (I8 representation) then wire THAT to the case selector.Smiley Wink  Then just groove to some Three Dog Night


"Should be" isn't "Is" -Jay
0 Kudos
Message 6 of 6
(2,794 Views)