I'm suddenly getting this error when I try to run my program. I've looked at the following page for guidance:
I've followed the steps for case 1 (resetting the traditional DAQ driver), but I'm still getting the error. All the other cases involve problems with the program itself, and this can't be my cause because my program was running fine when I left it before the holidays! Does anyone know if there's anything else not involving my program that could be causing this error?
Solved! Go to Solution.
this error usually occurs when you run the task from one place, and you run the same kind of task on the same device from other place.
For example, you are running AI measurement in MAX, and you try to run your application with AI. To, you run one DAQ Assistant in one part of your code, and somewhere else you call other DAQ Assistant which calls the same kind of task on the same device.
In your case, if you didn't change your program, close any other application accessign the DAQ board - especially measurement in MAX.
I can't see anywhere else where the device is being used. Let me provide some more details now that I've been messing around with it this afternoon. I'm sending signals to two analog channels in a for loop. If the first iteration sends a signal to both channels, they work fine, but if I only send a signal to one of the two channels on the next iteration I get the error. Similarly, if the first iteration sends a signal to channel 0 and not channel 1 (or vice versa) this works fine, but if I try to send a signal to the unused channel in the next iteration I get the error. I know this sounds like a problem with not properly starting or clearing the DAQmx, but I swear this loop has worked fine for months! I've attached the code for reference, even though it's unchanged from when it worked...
At glance I don't see anything in your program. I guess some other program might be running.
However, I would definitely create and clear tasks just once. At the beginning and at the end - this could theoretically help you. I would also suggest you to split your big for loop into 2 loops.
btw, which task throws you the error?
When I changed the program such that I only create and clear the task once I'm miraculously no longer getting the error! I have no idea why my program worked before and only now required this change, but I'm just happy that it's working again :-) Thanks so much for your help!
hm, it seems that task wasn't cleared properly. This can happen sometimes, though it shouldn't. In general it is good idea to keep opening and closing references as rarely as possible. Beside you eliminate some potentional issues, rour code might run much faster.
i'm glad it works,