LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

End User Interface--Help!

It has become apparent that there are fundamental coding issues that I really don't understand.  This was brought up by wiring that's regarding both tunnels on a case structure as inputs, which raised the questions, "Do you actually need shift registers?  Can't you make some sort of variable?  Why is there even a while loop around all of this, isn't it just tying up processing time?"

I'm designing what will eventually be full programs that users at other locations will not be able to edit at all (we're making remote-operation instruments and training people on them at distance).  I have no idea what an actual, running program does or looks like, beyond assuming that they'll see the front panel.  I've been putting everything I make in a while loop (because otherwise it stops running when I try to test it, and values aren't saved between iterations if I hit "run continuously").  Is this necessary for a real program?

Really, can anyone just give me a general overview of what the program does while running, and what my users will see?
0 Kudos
Message 1 of 11
(3,391 Views)
It would be great to actually see the program, else we cannot really comment. 😄
 
"Run continuously" is a debugging tool, not a valid way to run a program.
0 Kudos
Message 2 of 11
(3,378 Views)
Well, the actual project is currently a jumbled mess, but okay...

Also, my tunnel problem fixed itself upon LabVIEW restart.
0 Kudos
Message 3 of 11
(3,374 Views)
The lvproj file does not help us at all, we need the VIs.
0 Kudos
Message 4 of 11
(3,362 Views)
Haha, oops, sorry.  Smiley Surprised


0 Kudos
Message 5 of 11
(3,356 Views)
Some generic answers to your questions.

@DJDDA wrote:
"Do you actually need shift registers?  Can't you make some sort of variable?  Why is there even a while loop around all of this, isn't it just tying up processing time?"

Shift registers are often useful, but not always needed. Depends what you are doing.

LabVIEW has local and global variables. They break dataflow and can thus lead to race conditions. They can also cause extra data copies in memory. Typically, the wire is the variable. 😉

A loop is NOT tying up processing time unless it is spinning. A properly designed while loop only spins when needed (e.g. a control changes, in timed intervals, etc.). A typical beginner mistake is to make a while loop that does not contain any wait primitive oe event structure. This means the loop will spin as fast as the processor allows, using 100% CPU doing absolutely nothing useful.


@DJDDA wrote:
I've been putting everything I make in a while loop (because otherwise it stops running when I try to test it, and values aren't saved between iterations if I hit "run continuously"). 
If your data is in shift registers, and the old data disappears when you restart the code, it means you are using initialized shift registers. If you want to retain data in shift registers, don't initialize them.


@DJDDA wrote:
Is this necessary for a real program?

Yes, a typical toplevel program that interacts with the user needs a while loop. Often a state machine architecture is a good design template. There is nothing wrong with that!


@DJDDA wrote:
Really, can anyone just give me a general overview of what the program does while running, and what my users will see?

For that we need to see the code.

What happens currently when you run it?  The user sees the front panel of the toplevel VI and any other panels of subVIs that are configured to show the panel. Do you know who designed the code?

These are all very basic issues. I would recommend to start with a LabVIEW tutorial.

0 Kudos
Message 6 of 11
(3,350 Views)

"Often a state machine architecture is a good design template."

State machine architecture?


"For that we need to see the code.  What happens currently when you run it?"

It runs like I want it to, but I don't know whether the running of a program by an end user has the same functionality as me hitting the "Run" button, as a general rule.  While I posted my VI, I'm really asking "in general" here.


"Do you know who designed the code?"

You designed about 2/3 of it, I did the rest.


"These are all very basic issues. I would recommend to start with a LabVIEW tutorial."

I did the tutorials that came with the program, I'm just not clear on what my VI's will look like while being used.  I thought that the while loops should be running constantly, albeit with time delays and such, but someone else suggested that perhaps there should be no while loop and the program should stop completely when not being touched.

0 Kudos
Message 7 of 11
(3,347 Views)


@DJDDA wrote:

"Often a state machine architecture is a good design template."

State machine architecture?


"For that we need to see the code.  What happens currently when you run it?"

It runs like I want it to, but I don't know whether the running of a program by an end user has the same functionality as me hitting the "Run" button, as a general rule.  While I posted my VI, I'm really asking "in general" here.


"Do you know who designed the code?"

You designed about 2/3 of it, I did the rest.


"These are all very basic issues. I would recommend to start with a LabVIEW tutorial."

I did the tutorials that came with the program, I'm just not clear on what my VI's will look like while being used.  I thought that the while loops should be running constantly, albeit with time delays and such, but someone else suggested that perhaps there should be no while loop and the program should stop completely when not being touched.



Wow Altenbach, perhaps you should have designed Three thirds of the application.  Smiley Surprised
0 Kudos
Message 8 of 11
(3,336 Views)
You have a weird mix of event structures, delays, and parallel code all in one loop. it makes little sense to have an event timeout of 4 ms and and delay of 8 ms, the longer always wins.
 
Once everything is in an event structure, the loop no longer needs to spin unless something changes. Here's a quick draft on how you could do it. It seems you want to duplicate the look of a real instrument. I would make some changes, e.g. the standby know seems a bit clumsy for a virtual UI and is hard to operate with a mouse. I would use a checkbox, for example.
 
You don't need any local variables.
 
When you built an application, the users sees exactly the same front panel, but he has no access to the diagram. You can further customize the apperance (e.g. hide the menu or toolbar, the scrollbars, etc.). The appication should be set to "run when opened".
 
Here's a quick draft.
0 Kudos
Message 9 of 11
(3,335 Views)

Hi,

I'm glad everyone has been so helpful with debugging your application. Sounds like you have been learning a lot! I hope that you've enjoyed programming in LabVIEW. If you'd like to become more proficient in LabVIEW, we do offer customer education courses, offered in many locations. You can check them out here. More specifically, I would recommend our LabVIEW Basics course to get up to speed on LabVIEW programming architecture and lingo.

 
Amanda Howard
Americas Services and Support Recruiting Manager
National Instruments
0 Kudos
Message 10 of 11
(3,312 Views)