LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

stop error caused by device driver?

Dear all:

I am a first time user of labwindows. I attempted to write a program for my experiment controlling two scan mirrors, a motion controller and data acqusition card. It used to work for a while. However, recently when I run the program a few times (stop and scan again), the computer will restart by itself (or blue screen, before I did a reinstallation of windows). I have no idea whether the problem is caused by memory leak or device driver. The windows error report give me a message of "You received this message because a device driver installed on your computer caused the Windows operating system to stop unexpectedly. This type of error is referred to as a "stop error." A stop error requires you to restart your computer."

I have both DAQmx7.5 and DAQ legacy7.4 installed. However, currently I am only using DAQmx. I posted a snapshot of the program and also the main code here. The main function of the program is to output two sawtooth waveform to the scan mirrors (two output channels on DAQ card), and then record data from the 2-4 input channels on the DAQ card. Other functions include control a motion controller after each frame; averaging data; change the scan parameters (bascially change the output waveform to the scan mirror) etc.

If somebody can take a look at the figure out the main problem here, I would really appreciate it. Thank you for your time.

Best Regards,

Dan
Duke University
Download All
0 Kudos
Message 1 of 6
(4,060 Views)
Hi Dan,

I don't think there is an issue with your code as far as the DAQmx function calls go, so I think it would be best to focus on the DAQmx driver for the moment and the possibility that there is a corruption with the driver installation.  Can you run test panels in Measurement and Automation Explorer for your DAQ device with no errors?  What data acquisition device and version of LabWindows/CVI are you using?  I found a discussion forum post here that mentions this was an issue in DAQmx 7.3, and it is possible that something was missed in 7.5.  My first recommendation would be to upgrade to the latest version of the DAQmx driver that has support for your device and version of CVI.  The latest version of the NI-DAQmx driver is 8.6 and it can be downloaded here:
NI-DAQmx 8.6 - Windows 2000/Vista x64/Vista x86/XP

Regards,
Andrew W
National Instruments
0 Kudos
Message 2 of 6
(4,041 Views)
Hi Andrew,

Thanks for your reply. I used PXI 6115 and DAQmx 7.5. MAX explorer doesn't show any error when I ran the test panel. I haven't tried updating the NI-DAQmx driver yet. However, I read through the whole program carefully one more time. Some changes were made to the DAQmx functions and it now works again.

The changes are made to the stop function, where I cleared the inputtask and outputtask in addition to stop them. Also in the parklaser function I create the outputtask again just to return the mirror to a certain position and later clear the task.

So I think the crash problem still has something to do with how I used the DAQmx tasks. When I press the FOCUS button (run focus function), I created an outputtask and inputtask. Those tasks are not cleared after I hit stop, because I also want to use those tasks for returning the mirror to original position (called parklaser ) after I stopped the mirror scanning process. I guess this is where confusion comes in. The outputtask I am using in parklaser has a different timing configuration (it only output single points and doesn't have to be sychronized with the inputtask). I don't know if using the same task created from the very beginning again and again for different purpose will cause problems like crash without prewarning. Anyway, the reason I am doing that is because I use the function focus and parklaser a lot of times so I don't want to create and clear the tasks every 5 seconds, which probably will take up a lot of system resources (The program is already running very slow).

I don't know if I explained it clearly. If anybody has similar experience to share or any suggestions to change the program to make it more efficient, that would be great.
Thanks again for your time and attention.

Sincerely,
Dan

0 Kudos
Message 3 of 6
(4,021 Views)
Hi Dan,

I would have expected a different error given what you have described, but my recommendation on how you should architect this (and you may have done this already) is as follows:

1.  create and configure task handles for the first types of output and input that you need (A)
2.  create and configure task handles for the second types of output and input that you need (B)
3.  when you need A, start those tasks and stop them when they are finished
4.  when you need B, start those tasks and stop them when they are finished

You should not need to clear any of the tasks during this process.  You cannot use a task after you clear it unless you recreate the task.  I hope this helps out, but let us know if you have any other questions.

Regards,
Andrew
0 Kudos
Message 4 of 6
(3,987 Views)
Hi Andrew,

I am doing the clear and recreate task thing every time I need to use the task.Your approach would be a much more efficient way. I have one question though: can you create different tasks for the same output channel of the DAQ device at the same time? Does that mean creating the task does not establish the communication with the device, but only when you start the task the communication starts?

Thanks again for your input.

Best,
Dan
0 Kudos
Message 5 of 6
(3,984 Views)
Dan,

You are correct.  You can create multiple tasks for the same channel of the DAQ device, but the resources needed to run a particular task are not reserved until you call the DAQmx Start.  This architecture is what allows a user to create and save tasks in MAX and then call them from an application when needed.  Creating the tasks programmatically (versus in MAX) works the same way. Smiley Happy

Regards,
Andrew
0 Kudos
Message 6 of 6
(3,981 Views)