LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Why do I get less crashes when I put Wait (ms) vi in my control loop?

Since switching from LV 4.0 on W95 to LV 5.1 on NT, some exe's (made with the Application Builder) make other programs crash much more often. The vi's that cause the crash typically hog the CPU. The NT Performance Monitor shows near 100% CPU usage for the task. It is MS Excel which crashes, particularly while running a dialog box and associated VBA code I have written. The problem seems to virtually disappear (no more Excel crashes) if some Wait (ms) vi's are inserted in the vi to reduce CPU load. I've read that thread switching can cause crashes, but shouldn't the OS free me from worying about this?
0 Kudos
Message 1 of 2
(2,633 Views)
When you say crash, do you mean that the application stops responding? Or an application fault? By not putting a wait in the various while loops, you are causing some very tight spin loops within LV. This will peg the CPU utilization. The not responding may come from this "not playing nice". It is always good practice to "choke" various loops that needlessly consume CPU cycles. Leave computation loops alone, the typical culprit is user interface loops and slow instrument I/O loops.
Stu
0 Kudos
Message 2 of 2
(2,633 Views)