Device Selection
kachy_89P
It' s possible to write a procedure that allow me to choose which device to perform an acquisition with my nationals boars?
I would select also the channels firstly to perform an acquisition.
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
December 11, 2015 at 03:08 pm - Permalink
but I wish that when I start my program, It asks me directly that devices use to make the acquisition, if e.g. the Dev1 or DEV2.
As command to make the acquisition I using "DAQmx_Scan / DEV =" dev1 "WAVES =" wave1, 2; "
Therefore I would like to have the possibility to choose which device to use.
In the NIDAQ manual, I found this command:
fDAQmx_DeviceNames ()
but when I start it, nothing happens, but you should see the list of devices in the system.
December 14, 2015 at 02:19 am - Permalink
print fDAQmx_DeviceNames()
You could feed this to a simple user input, store the name in a global string, and pass the string to the acquisition function.
HJ
December 14, 2015 at 06:15 am - Permalink
where am I wrong ?
December 14, 2015 at 06:20 am - Permalink
Following HJ's suggesting, in the command window enter:
print fDAQmx_DeviceNmaes()
December 14, 2015 at 06:52 am - Permalink
Perfect, now it lists the two devices I have in the system .
Now try to write a procedure for the selection and then the place :) thanks a lot
December 14, 2015 at 07:13 am - Permalink
It's a problem to select a single, specific device.
Why I don't Understand!!!uff
print fDAQmx_DeviceNames()
string/G DN
DN = fDAQmx_DeviceNames()
end
Function Scan()
string DN
make/O/N=100 wave1
setscale/P x, 0,0.1, "s", Wave1
DAQmx_SCAN/DEV= "DN" WAVES=" wave1, 2;"
ENd
December 14, 2015 at 07:39 am - Permalink
In the Scan() function, the global variable needs to be referenced by using this syntax:
SVAR DN = DN
But your are feeding the entire list to the fDAQmx command. Is this what you want? From your previous posts, you state that you want to choose the card to use. In that case, try the following code.
String/G DN = ""
String sSelected = ""
string DAQlist = ""
DAQlist = fDAQmx_DeviceNames()
print DAQlist
Prompt sSelected, "Device to Use:", popup, DAQlist
DoPrompt "Select a DAQ to use", sSelected
if( V_flag == 1 )
print "User Canceled"
return 1
endif
DN = sSelected
end
Function Scan()
SVAR DN = DN
make/O/N=100 wave1
setscale/P x, 0,0.1, "s", Wave1
DAQmx_SCAN/DEV= "DN" WAVES=" wave1, 2;"
End
Hope this helps.
December 15, 2015 at 07:23 am - Permalink
I just test your procedure, but, when Scan() is launched, appear this error (I lunch fDAQmx_ErrorString):
- print fDAQmx_ErrorString()
NI-DAQmx driver error while calling function DAQmxCreateAIVoltageChan; device DN:-200220: Device identifier is invalid.
Extended info:
Device identifier is invalid.
Device Specified: DN
Suggested Device(s): Dev3, Dev2
Task Name: DN
Status Code: -200220
NB: My two Dev are Simulated
December 15, 2015 at 09:17 am - Permalink
I'm not familiar with the NiDAQ functions and operations, so I'm not going to be much help here. However, from the error message quoted above, it appears that the flag:
/DEV="DN"
is being used incorrectly. I imagine that the syntax where the Device ID is quoted anticipates a literal string. You are using a string variable, so I would suggest trying the following to see which works...DAQmx_SCAN/DEV= DN WAVES=" wave1, 2;"
DAQmx_SCAN/DEV= (DN) WAVES=" wave1, 2;"
or possibly, bu less likely,
DAQmx_SCAN/DEV= $DN WAVES=" wave1, 2;"
Perhaps someone familiar with this function will offer more knowledgeable comments.
Also, edit the scan function to print DN so you can see exactly what value is has
SVAR DN = DN
print DN
...
December 15, 2015 at 03:22 pm - Permalink
yesterday I checked with the "print" command, and actually the variable is correctly assigned.
However, as you advance you in your post, being a variable you need to change the command SCAN, like:
DAQmx_SCAN / DEV = DN = WAVES "wave1, 2;"
or this one
DAQmx_SCAN / DEV = (DN) WAVES = "wave1, 2;"
and the system works.
Thanks so much!
Have a nice day!
December 16, 2015 at 02:01 am - Permalink