LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Exception within the external code called by Call Library Function Node Problem

Solved!
Go to solution

Greetings, I am a complete newbie at LabVIEW and require some assistance. I am doing reliability testing and am getting this error around 2000 cycles. The code sends digital output to a actuator which drives the actuator down, it reads a signal from the thing I am testing. Then if there is a signal it should then drive the actuator back up and repeat. After roughly 2000 cycles I get the error:

 

 [LABVIEW: An exception occurred within the external code called by a Call Library Function Node. This might have corrupted LabViews's memory. Save any work to a new location and restart LabView. VI "Footswitch.vi" was stopped at node 0x0 of subVI "DAQmx Start Task.vi 7"].

 

I created this code without any prior knowledge of LabView so I know its not good, but it does function (somehow). Any help would be greatly appreciated. Thanks in advance. Also I have attached the VI.

0 Kudos
Message 1 of 5
(4,691 Views)
Solution
Accepted by cstemm

cstemm,

 

There are a few obvious errors in the code that need to be addressed.  First of all, I am unsure how your code even survived 2000 cycles, as you have a boolean value going into these while loops:

 

cos.JPG

 

What happens if you read a false value? The loops will be stuck in an infinite loop...as the value read in through the tunnel will never change, and the stop condition will always be 'false.'   I think what you meant to do...was keep reading the digital value until it is true, so this is what needs to be in a while loop.

 

Now, the problem you are experiencing is most likely a result of mass overload of start/stop tasks.  For these digital reads, you only need to  start the task once and stop the task once. Run the start task before your main loop runs...pass the task reference in and read whenever you want. Then, when the main loop is done, pass that task wire outside the while loop to the stop and clear tasks.

 

Programming paradigm is usually(there are exceptions):

Initialize(start tasks, set initial value of controls, etc)->Main Loop(most code goes here, reads/writes/computations)->Close References(stop tasks, clear data, close any open file references)

 

You are not doing any buffered reads of the digital lines, so no need to ever stop or restart the task, it jsut gives you a value whenever you call the read vi.

Rob K
Measurements Mechanical Engineer (C-Series, USB X-Series)
National Instruments
CompactRIO Developers Guide
CompactRIO Out of the Box Video
Message 2 of 5
(4,665 Views)

Robbob,

 

Thanks for your help, I know that this code is terrible, and I wonder how it worked myself. I did some of the things your recommended. I am just not fimiliar enough with the program to write acceptable code. I brought the digital reads outside of the loop and that is functioning correctly. I am not sure how I can bring out the other start and stop functions. I am still getting the same error code around 2000 cycles. So that makes me assume that the start and stop tasks is what is killing the memory. As for boolean value going into the while loops. I'm not quite sure what to do, I just need a generic counter that can count whether or not the signal has been read, but I don't have any counter lines left in my box. I looked for some examples and couldn't find anything suitable, and when I did I couldn't open the VI because I'm running LabVIEW 8 and it is an old version. I appreciate your help and your patience. If you could give me some suggestions on the digital counter and how to get the digital output tasks outside of the loop, it would be a tremendous help. Thanks again.

 

Curt 

0 Kudos
Message 3 of 5
(4,627 Views)
Try using the example in NI Example Finder > Hardware Input and Output > DAQmx > Digital Meausrements > Read Dig Chan.vi as a starting point for re-writing your application.
0 Kudos
Message 4 of 5
(4,603 Views)

Thank you both for your suggestions. Robbob, you were correct I was completely overloading and using up all the memory. I took all the digital reads to outside the loop. Then when that did not correct the problem I used the clear function instead of the stop function for the digital outputs. this cleared up the cycling issue. I changed the counting while loops to conditional loops and I believe I have the program working well. Thank you both for your help.

 

Regards,

 

cstemm 

0 Kudos
Message 5 of 5
(4,556 Views)