09-08-2011 02:09 PM
Attached is an example of what I am talking about saved for LabVIEW 8.2. It also has a library that I use to stop multi loop applications which is what the red VIs are. More info about that here on the LabVIEW board. It is another example of using wrappers around private Action Engines.
The yellow VIs are a fake power supply driver library module that you can extend. I know that you already solved your problem with a semaphore so this is just for future reference. It seems like more work but I find these techniques are easier to maintain. Using wrappers allows you to have documentation specfic to the function. If you just use the AE then you end up with a huge monolith to document. This lets you break it up. You also get a specific icon and don't have to look at the AE "command enum". And finally you can have only inputs and outputs that are specific to your functions. It may be more work but you end up with higher quality and easier to read code.
Notice that you don't see any AE in the above diagram. There are no "command constants". The only place the AE is called from is in low level VIs which are initialize, close, write and read. There is another private VI "ask" which contains nothing but a write followed by a read.
The public functions are initialize, close, IDN, Set Voltage and Read Voltage.
Here is what the initialize VI looks like. Very simple. It contains the AE which I usually call "Core". I set the VISA resource name to Input Required.
Here is the diagram for the IDN vi. Nice and simple. You can tell from the icon and the context help exactly what the VI is for.
This is what the Set Voltage VI looks like and is what I was talking about when I said you create the commands. You will need to create a VI to set and read current, turn on or off the power supply, etc. All of these VIs will be very similar to the one below.
And this is what the Write VI looks like. Again these are all very simple SubVIs.
And here is the read voltage VI. This one creates the command and parses the results.
And finally the close VI. You can probably guess what it looks like.
09-09-2011 04:14 PM
09-10-2011 12:05 AM
Now I got it. That's a great idea. You create a vi for each functions, but within each function, you use the same vi, so executing sequence will be queued by LabVIEW. Right now, I have already coded each functions with out using common AE. I may go back and think about modifying them. Thanks!