LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Volunteer at the American Museum of Natural History

Ravens Fan.

That's old code for an old instrument and I only wrote a small section. It ran the old instrument; that's not to say it was either good code or efficent.

I'm now starting to write for a new instrument and I'm trying to solve the following problem: I want to enter a string; terminate with a line feed; recover some information from a file and/or the internet; do it again with out having to hit and start, stop or runs buttons. The line feed needs to be the signal that starts the program again. Maybe a while loop with shift registers checking each time for a line feed?

thanks
0 Kudos
Message 21 of 26
(867 Views)

May I make a few suggestions:

Your front panel looks very cluttered.  Use a Tab Control to break up the front panel controls and indicators into different sections.  Put a set of related controls/indicators on one tab, and another set on the next tab, and so on.  This will help the user tremendously, and adding another button won't be so painful.

Your front panel background color should be a light color.  That's why Ravens Fan said it hurt his eyes.  The current color blends in with too many item's background colors.

You must have one gigantic monitor to see the block diagram, or you have to do a lot of scrolling.  It boils down to being very hard to read the program flow.  Organize sections into subvi's.  Your main can be just a series of subvi calls, and the screen should scroll in one direction only, usually horizontally.

You make use of way too many local variables.  Try to use wires instead.  An acceptable way to create local variables is to place constants for each variable you want to create in a cluster.  Then wire that cluster into a shift register in the main loop.  Use unbundle to read a variable and bundle to write to a variable.  Se picture:

 

- tbob

Inventor of the WORM Global
Message 22 of 26
(864 Views)
Thanks, I will definitely keep these things in mind as new program involves.
0 Kudos
Message 23 of 26
(858 Views)


@exo wrote:
old code for an old instrument and I only wrote a small section. It ran the old instrument; that's not to say it was either good code or efficent.

I'm now starting to write for a new instrument and I'm trying to solve the following problem: I want to enter a string; terminate with a line feed; recover some information from a file and/or the internet; do it again with out having to hit and start, stop or run buttons. The line feed needs to be the signal that starts the program again. Maybe a while loop with shift registers checking each time for a line feed?


I am going to assume that the buttons you DON'T want to use are the run, run continuous and abort buttons of Labview.  (Other than the run button to initially start the program.)  You do want to have a Master stop button that you code for that ends all loops, closes all references, and allows the program to end.  (Never use "Abort")

So to do what you want such as "start the program again" (and I assume that means a particular section of code and not the entire Labview main VI) would be a button in the code that executes a case statement when it goes true.  This could either be a button that is polled frequently and the TO DO code is in the True statement of the case structure attached to it,  Nothing in the false case.  Or it could be a Value change event for that button, and the TO DO code is in the particular case of the event structure.  You would use the shift registers to maintain the values of the wires from one iteration to the next.

I'm not sure what you mean by "checking for a line feed".  Where is this line feed getting generated?  You could certainly run a loop and wait for the line feed character, but there may be other program structures that could do this better.

Message 24 of 26
(840 Views)
This is what I wanted. You probably have to be on a Mac. Otherwise you may have to modify the sub vi. Make sure you have the path to ObservedObjects.txt right. Simbad is an astronomical data base which you can access once you have input an object. Objects in the ObservedObjects.txt file are HIP22910 and HR4796. Just hit run to run not run continously.

Thanks
I'll probably be back to you next time I get stumped.
Download All
0 Kudos
Message 25 of 26
(837 Views)

Hi Exo,

It sure sounds like you have made some type of progress.

Since all of the people that have helped so far probably won't be able to use those tickets, could I ask that you award those that helped you with 5-star ratings (see bottom right corner, Do not give les than 5-stars)?

It is the only mechanism we have for awarding our volunteers.

Thank you,

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 26 of 26
(831 Views)