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