07-26-2007 03:14 PM
07-26-2007 11:23 PM
07-27-2007 01:13 AM
You could do something like this, but I would advise against it for something like this because it's ambigous and a potential source of bugs.
I would suggest creating a get and set VI for each one, just like NI does with its DAQmx Write and DAQmx Read and various other configuration options.
To save yourself work, check out any of the available object oriented implementations - OpenGOOP, dqGOOP, Sciware GOOP, Endevo GOOP, LVOOP (if you're using 8.2) or any others I may have forgot. These will allow you to create your basic functions and you just create a palette of configuration VIs.
07-27-2007 03:21 AM - edited 07-27-2007 03:21 AM
Hi Marc,
This may be over-kill for your application, but it's a structure that works well for most devices, and might work well for yours. Ravens Fan mentioned enums lending clarity to code, I too [really] like enums because of this - but they also make this driver "extensible" with respect to adding new functions without breaking existing code - as long as the function-type is a typedef. This driver also buffers the VISAResource - encapsulating it in the driver (think "object") - so there are less references to pass and less wires stretching across diagrams. If the driver needs to "remember" what state it's in, variables can be added to "buffered" - the device-specific "attributes". The "Enabled" boolean is very useful for debugging in the absence of actual hardware, and IMHO that having all the device-specific syntax in a single place is a good thing. ![]()
Not that you'll want to, but this structure can be wrapped, made reentrant, and called dynamically, so different devices of the same type can be substituted easily, or multiple identical devices can use exactly the same driver.
Asking "what's the best driver" might be like asking "what's the best beer", try a few and then decide! ![]()
Cheers!
Message Edited by tbd on 07-27-2007 03:25 AM
07-27-2007 07:51 AM
07-27-2007 08:03 AM
To some extent an Action Engine structure may be useful. ![]()
While they are often billed as a way to protect data from conflits, they can also control and coordinate hardware devices as well.
You could use different actions to read the values in the various units you desire.
Just my 2 cents ![]()
Ben
07-27-2007 08:19 AM
07-27-2007 08:34 AM
I use action engines all over the place, I love them. However, I'm really trying to adhere to the guidelines on this one. One thing that is required is that multiple instruments can be controlled with the drivers, so USRs and global variables should be avoided.
I'm going to use 2 enums in each VI that can read or write a configuration parameter. One for the parameter, and one for the read/write action. I think this will be the most user friendly way to go.
07-27-2007 09:21 AM
Bill,
I use the term AE rather than Functional Global, or LV2 global because the same construct (single iteration loop with cases) can be used to "protect" more than just the data in a SR.
Marc,
An AE that uses dynamically instaciated AE templates can do that but .... it does get complicated.
Ben
07-27-2007 10:14 AM