08-23-2012 07:39 AM
As always I want to do something absolutely trivial and am running into all sorts of issues
I define (through a control) a physical channel that I want to take data on. I want to be able to programmatically reset the device the channel is on. i.e. i don't want someone to have to open up the code and change the device on the reset vi if necessary. Even if there is only one device physically connected, you can’t guarantee the device will be Dev1, because Labview keeps a history of devices that have been plugged in. The obvious solution – extract the device name from the physical channel control which contains the channel(s) you have selcted. Can I find a trivial way to do it, NO! There is a property node called device but it does not (despite its name) return the device you have selected along with the physical channel. There are convoluted ways of doing this, but i'm hoping there is some easy way. Suggestions
Solved! Go to Solution.
08-23-2012 07:59 AM - edited 08-23-2012 08:00 AM
Hi!
Use a DAQmx Task Property Node and select "Devices" property.
This gives you a list of devices used in the task.
Regards,
Marco
08-23-2012 09:12 AM
That means I've got to create the task first and reset the device second. Can be done I guess, but I thought it made more sense to reset the device before defining tasks on it.
08-23-2012 09:38 AM
I think this might be the "trivial" way you're looking for: some string pattern matching and a simple
regular expression to extract the device name prefix from a physical channel name.
-Kevin P
08-23-2012 10:37 AM
That is indeed more like I had in mind. I wasn't sure I could fire what looked like an enumeration type into a string vi. I guess it isn't an enumeration, just a string after all (in which case why isn't the wire pink?). Thanks to both respondents. I've tried both and they work - great.
08-24-2012 04:45 AM
If you want you can mark the issue as solved and give Kudos to everyone 😉
Marco