04-20-2014 01:05 AM - edited 04-20-2014 01:06 AM
Dears,
I'm using USB -6009 to control pumps , valves, DO and two Mass Flow Control . Every two cycle i'm getting error 50405 . I tried to solve the problems by the existing solution in this forum but the error still showing every 2 cycle from operation . I'm attaching my completed VI for the expertise, wondering if its design issue ?. Attached screen shoot for the error . thank you.
Solved! Go to Solution.
04-20-2014 06:34 AM
You certainly have some design issues.
The stacked sequence structure tends to create more problems than it solves. I have not used it in new programs since version 1.2 of LabVIEW (in 1989). A state machine is a much better choice of architecture.
Local variables can cause race conditions, extra data copies, slower performance, and hard to debug code. There are specific cases where they should be used, but those conditions are not in your code. Just wire directly from the control terminals to the places the data will be used.
My guess about the likely cause of your error is the use of multiple DAQ Assistants to perform the same task (with different data values) in each frame of the sequence structure. With the state machine arcitecture I suggested above you would only need one. The DAQ Assistant tries to be smart about configuring and closing tasks, but the different instances do not talk to each other, so they do not know when to release resources. You might be able to make it work if you used the standard DAQmx VIs as you did with the Digital Output task. You do not wire the error out lines from the DAQ Assistants so you may be missing errors.
Unlabeled controls and indicators can be a troubleshooting nightmare. Please give each control and indicator a unique label. If you do not want the label visible on the front panel, you can use the control properties to hide it. If you want multiple controls to have the same text visible to the operator, use the Caption.
Learn to use subVIs. Most of the code in the 6 frames of the inner sequence structure is identical. By converting that to a subVI, you would reduce the size of the diagram drastically and if you ever needed to change that code, it would only need to be changed in one place - the subVI.
The while loop in frame 0 of the outer sequence structure is a "greedy" loop. It will run as fast as possible and grab all available CPU resources while waiting for the user to press a button. Put a Wait (ms) function in the loop with ~100 ms wait. Better, learn to use the Event Structure for User Input.
The second while loop inside the inner case structure does nothing and can be removed.
Many of these items hint that you have a programming background using text-based programming language. LabVIEW uses a dataflow paradigm which largely eliminates the need for such things as the sequence structure and local variables. I recommend you work through the on-line tutorials on Getting Started with LabVIEW.
Lynn
04-22-2014 10:19 AM
05-01-2014 12:49 PM
Hi Lynn,
"Thank you very much for the detailed solution .
I'm modifying the design following your suggestion step by step . Will back to post the updated vi soon . Thank you."
I modified the vi as you suggested except some points which it's welcomed from expertise person such as you .
My aim is to solve the error in this vi which its cause critical interrupt to my experiment . As i have a basic knowledge in labview i made this vi to keep my planktons a live.
Your suggestion to remove the DAQ Assistants is powerful as it's gave me a time to let the experiment running for long period than before .
It's hard to catch new planktons and replace it with new . However the same error showing up ,but after long running cycles .The error pointing on DAQmx Read (Analog DBL 1 channel 1 sample) !?. This analog input connected to Dissolved Oxygen Transmitter -Eutech Instruments (specification attached) .Which it's trigger a Mass flow controller . As you can see there is set point in each stage when the DO increased over the set point in water the MFC will open the gate allowing pass set quantity of gas .
Kindly for you suggestion and support .
05-08-2014 08:31 AM
05-09-2014 05:21 PM
That error (50405) on the DAQmx Read.vi might be related to a timeout. The DAQmx Read.vi has a default timeout of 10s. You can wire a -1 numeric constant to the timeout terminal from the vi and if the problem is that it is timming out, that should fix it. Please check the following document for additional information.
http://www.ni.com/example/31172/en/
05-10-2014 02:42 AM
05-12-2014 07:02 PM
I want to ask you how did you find that your VI stops the output after 5 loops. I actually tested it today and I don't see the same behavior on my system.
Can you give me more details about this?
05-26-2014 01:59 PM
Thank you Cavarval and everybody who tried to solve my problem.
I changed the PC with another. Its working without interrupt now 🙂 . The problem was is the computer setting e.g. USB and its serves setting .
05-26-2014 04:26 PM
Glad you got the problem solved. USB devices can be very difficult because the OS sometimes shuts them down to conserve power. Jeff Bohrer has put together a list of things to do to deal with USB issues, specifically on Windows OS, but good advice in general. I do not have a link but searching for USB shut down should find it.
Lynn