LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

error -200429 DAQmx read (counter u32 1ch 1samp).vi -append- Edge count in for loop

I am receiving error -200429 DAQmx read (counter u32 1ch 1 samp).vi <append>. This is occuring on the second loop of a for loop.
 
I have a sequence inside the for loop that is using four DAQmx assistant vi's for edge count at various times in the sequence. All four of these count fine the first time through but at the beginning of the second loop the first edge count receives this error and does not count.
 
Any ideas?
 
 
0 Kudos
Message 1 of 10
(4,906 Views)
Hello AAM,

There are many ways to get this error, but based on your VI description, I'm not sure that any of them apply.  Could you post a very simple VI that shows the behavior you are seeing?

Thanks!
Micaela N
National Instruments
0 Kudos
Message 2 of 10
(4,900 Views)
 
Here is a shortend version of my current code that is causing error -2000429. The code runs for the first time through the
loop but the counter does not operate on the second loop.
 
 
When the DAQ assistant is converted to a subvi it shows the code is using a "first call" function to where the first call is
only true the first time through the loop and false after that causing an empty string.
 
I tried to substitute a true constant for the first calls but then there is an error that the task is empty. This appears to be occuring
because the(task to copy) or (global virtual channels) inputs to the DAQmx create task are empty.
 
Here is a copy of the Daq Assistant code after it was converted to a subvi
 
 
Thank you,
Jim Cheesebro
AAM
0 Kudos
Message 3 of 10
(4,889 Views)
Looks like free servers won't allow the .vi extension so go to www.cheeze.s5.com/ni and right click on the zip files to save

Message Edited by AAM on 06-06-2006 08:56 AM

0 Kudos
Message 4 of 10
(4,887 Views)
You can attach VI's to your post. You do not need to put them on a server someplace. Look at the bottom of the message body. There is a button called "browse". Point to your VI. Make sure that if you are using any subVIs that are not part of the LabVIEW distribution, to make an llb that includes the subVIs. You can do a development distribution.
0 Kudos
Message 5 of 10
(4,878 Views)
Do not call the Clear Task after every DAQ Assistant. Because of the the first call function, the task is only created the first time it is called but you clear the task afterwards and the next time the function is called, you get the error. As far as I can tell, each of your DAQ Assistant tasks are the same and if that's the case, get rid of the sequence structure and just put a for loop around a single DAQ Assistant with n=4. Sequence structures are something that are seldom required in any case and certainly not in this application.
0 Kudos
Message 6 of 10
(4,876 Views)

I am not receiving an error after each time the function is called but only after the loop completes (all 4 daq assistants run) and it tries to run the second iteration.

If the clear task is not called after every instance then the resource is not released causing the next Daq assistant not to execute. The sequence I attached is a simple example of my more complex 55 frame sequence that is controlling ac and dc motors with data acq and other functions. My example was the jist of the problem as was requested by the previous poster.

When I first created this code I was not using a clear task after each but found I had to in order for the resource to be released.

 

 

0 Kudos
Message 7 of 10
(4,867 Views)
I understand that you are only getting the error after the second iteration. As I said, it's because you are clearing the task. Since the DAQ Assistant seems to be the same, you should just create the task once at the very beginning and use a shift register to keep if for all iterations and from DAQmx Read to the next. I would eliminate the DAQ Assistant altogether and use a state machine. If you have a 55 fram sequence structure, that's about 54 too many frames. A state mcahine would work much better and give you flexibliltiy and the ability to stop early. A sequence structure will alwasy execute every fram - whether you have an eror or not. I've attached an example. You could also use a queue. The outer for loop should also be replaced with a while loop so that could be terminated. You cannot terminate a for loop early.
0 Kudos
Message 8 of 10
(4,858 Views)

The code you have supplied is similar to the converted subvi but this code will give an empty task error on the DAQmx Create Channel vi.

Notice on the Daqmx create task vi that there is nothing wired to the "Task to copy" or the "Global virtual channels" connectors - I believe this is why the task is empty when sent to the Daqmx create channel vi.

The code we are currently using is a modification of a previous code used before a recent upgrade. It may be better in your/NI eyes to re-write this into a State machine but time constraints and resources do not allow that at this time - All other parts of the current program work except for the counter on the second iteration. Would rather not reinvent the wheel at this point. 

If the task is being cleared was the issue then the other three should also not execute. The issue appears to be the "First Call"

I have attached a zip file of the complete program as it is now written to give you a better idea of the whole picture.

 

 

0 Kudos
Message 9 of 10
(4,853 Views)

Well, my advice to get rid of the DAQ Assistant still applies. Create the task once and pass the task from frame to frame and don't clear it until the whole VI is over.

You might also want to look at adding some error in/error out wires. If you don't care about about sequencing some things, then you can leave it as is but certain frames might give you problems. For example, frames 1 and 2 have a digital write and an analog write. You have no way of knowing which will actually happen first or second. Where you place functions on a diagram makes no difference as to execution order.

0 Kudos
Message 10 of 10
(4,848 Views)