07-05-2011 04:19 PM
07-05-2011 04:26 PM
07-05-2011 04:47 PM
Try attaching again - perhaps as a zip file. That site of yours requires registration.
The use of locals can be a problem. Also, you cannot run more than one task on the same hardware - i.e. an analog read.
07-05-2011 06:04 PM
07-05-2011 06:22 PM
Here's the above program attached as zip file. Seems to work OK.
(Sorry, I cannot efficiently work on this code, because my monitor is only 2048x1152 pixels and thus way too small)
07-05-2011 06:40 PM
07-06-2011 09:28 AM
Although ridiculously large, it's structured, well wired and you do use a few sub-vi's. You dont use many locals and the functions connected are wired so you shouldn't create any race conditions as far as i can see.
However, a few more sub-vi's would go a long way, specifically the case-structures in the middle where you clearly make the same thing at 5 places.
/Y
07-06-2011 10:21 AM
@Malakeh wrote:
So the use of the Local variables in this case is ok i guess?
The Locals can be problematic but, you have bigger problems. Those unwired tunnels with defaults feeding USRs scare me silly.
The Ke
Keilthly init where you bundle by name and pass the input to the output ignoring the new data scares me.
Initializing the keithley INSIDE the main loop every time Scares me (Keithley's especially like to hang up if re-initialized often)
Needing the Navagation window scares me.
I guess the locals are actually a "lesser included offense"
07-06-2011 03:48 PM
07-06-2011 04:19 PM
Well,
First- if it works it works. With code that approaches abstract art "fiddleing" with it garuntees headaches. This "Spaghetti code" occurs in more places than you think and is usually a project that grew in scope and complexity beyond the base archietecture's utility. So, with that said you asked for advice.
Look in the LabVIEW examples on design patterns and study them to avoid this type of code in the future.
Break the code into functional blocks on paper what are the inputs and outputs haw are they generated?
For your application , essentially, "Get ready- get data- display data- exit" I would probably chose a Producer- consumer template to start. I would have a Queued state machine driving the hardware. Think three states "Initialize resources", "Use resources (get data)" and "Close resources". You may need a "Read Filters" too. Since the user infrequently presses the "Get'r'Done" button I would have an event loop looking for operator activity (Exit and Get'r'Done) and looking at updates to the display to show system state (Initiallizing, Ready, At work, Closing...)
The shipping examples and the Large application development user group page are good places to start.