02-09-2010 05:10 PM
I have an application that has two modes of operation: Delivered, with two NI boards, DAQmx installed; and a simulation mode with no boards and DaqMX runtime installed
How can I tell if a boards is installed, to determine if the mode should be delivered or simulated?
Right now on my desktop I have the application installed, both DAQmx and the runtime installed, but no cards. The first call teh DAQmxCreateTask goes off to never-never land, and the app completely hangs. (BTW, why is there no timeout in DaqMx calls? )
Help will be appreciated...
Running CVI 2009, DaqMx 8.9.5.
02-10-2010 05:17 PM
If you happen to know the exact name of your device you could query if it is a real board or a simulated one with
DAQmxGetDeviceAttribute ("DeviceName", DAQmx_Dev_IsSimulated, &sim, 0);
If you don't know how the devices are named, daqmx can list all available devices in the system, next you can scan this list. See this post for reference.
02-10-2010 05:38 PM
02-11-2010 09:18 AM
You folks have brought up a couple interesting points. But first, just to clarify, the application needs to operate whether or not the boards are present. The boards are NI6518's, two of them. So the best thing for my app would be a test -- the very first thing done -- to see whether or not they are installed. If not, execution branches to a simulation section of code.
You askedabout error handling. I am testing the return value for every DAQmx call, but I don't expect a DAQmx call to go away and just hang, which it does with no boards present. Is there some switch I need to set to ensure that I receive a failure code back even for a TaskCreate call when no boards are present?
02-11-2010 10:21 AM
Ok, so what you can do in your program if to execute something like this:
// Get informations from the system
size = DAQmxGetSystemInfoAttribute (DAQmx_Sys_DevNames, msg, 0); // Get size of string to allocate
msg = malloc (size);
DAQmxGetSystemInfoAttribute (DAQmx_Sys_DevNames, msg, size);
DebugPrintf ("%s\n", msg);
// Scan the returned, comma-separated string
// Free resources
free (msg);
Y cannot test here since I have some devices installed on my system but you may test with an empty system wether in this case the required space to allocate is 0, in which case you may directly switch to simulated code. Otherwise scan the list and verify if the installed devices are actual or simulated boards and decide what to do afterwards.
Regarding your CreateTask notation, I never tested it in an empty system so I cannot comment anything on that. It surely is strange and it should be fixed if this instruction hangs up the system in this case.
02-11-2010 02:50 PM
Roberto (and NI support people, if you are reading),
Thank you for the suggestion. I used a fixed buffer size, installed the function call, stepped through it and when the function is called, execution goes off to who knows where and the application hangs. 0% CPU load during this time. It did return after more than 5 minutes, with this error message (dang I have to type this, there doesn't seem to be any way to copy it): "The client process cannot communicate with the configuration server process. If this problem persists, please note the steps you performed that led to this error and contact technical support."
One other interesting and very distressing thing: When I select the function call DAQmxGetSystemInfoAttribute, right click and select to show the function panel, CVI hangs and I have to force quit. Other DAQmx functions do not do this. Do these problems sound like bugs?
Before the above tests, I wiped NI software off this desktop, all of it, going back to 8.1, and reinstalled 2009 and the Device Drivers.