04-14-2007 11:25 AM
04-14-2007 11:47 AM - edited 04-14-2007 11:47 AM
Message Edited by bmunden on 04-14-2007 11:48 AM
04-14-2007 01:01 PM
First get your thought clear to the point that you can explain it someone.
Draw it up and walk through it asking yourself "what if" questions and revise as you see fit.
If they are interdependent, code them together.
If they are independent, code tham that way.
THEN code it.
Ben
04-14-2007 04:43 PM
04-15-2007 12:48 AM
Hi bmunden,
I read your pseudo-code from top to bottom and it was very clear. You could implement this on one G-diagram "plane" - from left to right, and I think it would be similarly easy to read. You could also use a "state-machine" which allows arbitrary jumps from one section of logic to another - very much like the "GOTO" statement (long ago abandoned.) The "State-machine" stacks planes of logic "hiding" them - making code less easy to read. I think NI's state-diagramming tools help clarify what a "State-machine" does, though that's another layer of documentation to explain what the LabVIEW code is doing! I'd avoid state-machines as a general-solution, though I'm certain Ben will disagree.
Cheers!
04-15-2007 12:32 PM - edited 04-15-2007 12:32 PM
Message Edited by bmunden on 04-15-2007 12:33 PM
04-19-2007 01:59 AM
Some potential hang-ups I'm aware of are the "default" values of some of the solenoid binaries.
I'd make a sub-VI to set all 5 solenoids at once. A "Configuration File" (AKA "INI file") would allow you freedom to change "defaults" without changing your program-logic. See "Configuration File VIs" on the File pallet (also search examples). There are also VIs for manipulating values stored in the Windows registry, but I don't recommend going there.
:
Also, when I run the test and save the file (in a while loop?), I certainly cannot have the while loop just hanging there with the solenoids shut while I'm waiting on the user to input a file name. How would I ensure that the file-save is ready to go?
One way might be to always save data, and postpone the save/discard decision until after critical-functions (solenoid operation) have completed. It's pretty simple to auto-generate a filename - see attached - (though calling this vi twice within one second may result in duplicate file-names!) This VI tries to create a unique file-name based on time, though you could just overwrite the same file[name] every run, and if you decide to "SAVE" just copy the temporary file to a new/unique path.
04-19-2007 11:29 AM
04-19-2007 01:41 PM
@bmunden wrote:
That sounds like a good idea. How would I do that, though?
Hopefully a VI is attached this time! It generates a Filepath (see warning above re: potential for duplicate paths.)
To copy one file to another, use "Advanced File Functions\Copy" function (it's pretty simple - -) - calling the attached VI should provide one (or both) of the two required (source, destination) path parameters!
(I don't think you were, but If you're asking how to create a sub-VI or how to use the "Configuration" VIs, please refer to the Examples under "Help". )
Cheers!
04-19-2007 06:30 PM