Motion Control and Motor Drives

cancel
Showing results for 
Search instead for 
Did you mean: 

General Protection Fault related to Timer

I'm using LabWindows 7.1.0 under XP Pro. I got the General Protection Fault when I did the following. Attached is the snapshot of the crime scene:
I ran the application in debug mode to line 2651, and got the prompt. At the moment, "idx" equalled to 2;
Enter numbers including 1 and 2 several times to prove the logic in the forever loop (started at line 2649);
Stopped the execution, then set the next statement to line 2670, press F10 to step over it;
Got fatal run-time error as shown at the bottom.

I have a timer with callback function named OffsetTesterTimer. It's activated every .2 seconds. Looks like it has something to do with it, bacause:
1) From the Stack Trace on the right bottom, you can see it's pointing to my timer callback function OffsetTesterTimer;
2) If I disabled the timer and reran the sequece above, I didn't get any error.

Could somebody explain what's going on?
Thank you very much.
Jason

0 Kudos
Message 1 of 4
(3,643 Views)
Hi Jason,

First, the DAQmxCreateAIVoltageChan function appears to be throwing an error.  I would fix that first to see if it also fixes the General Protection Fault error.  If you still get the GPF error, comment out all of the code in the OffsetTesterTimer callback.  Also, change the timer callback to be 1 second.  Let me know how that functions. 
0 Kudos
Message 2 of 4
(3,621 Views)
Hi Terry,
 
Thanks for the reply.
I fixed the DAQ error by removing it, problem remained;
I commented out all the code in the timer, problem remained;
I changed timer to be 1 second, problem remained.
 
I did one more thing: try my project on CVI 8.0, and got the same GPF problem.
 
Looks to me it has something to do with line 2670 which has sprintf there. Because if I put another new line before this line like "i=i+1;", I could run through this line without error;
I also tried to replace "s" on line 2670 with another string var "ss", and got the same error.
 
Pls let me know. Thanks.
Jason
0 Kudos
Message 3 of 4
(3,616 Views)
Hi Jason,

Do you still get the GPF error when you comment out the sprintf line?  If so, could you post a small example of your code that demonstrates the behavior?  Try to remove as much functionality as possible, but still have the error occur.  We'll take a look at this example and see if we can determine where the GPF error is occurring.
0 Kudos
Message 4 of 4
(3,605 Views)