LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Overcome error 50103

Hi,

 

I new to LabVIEW and attempting to write an application for running a scientific study. Trials are initiated by the press of a button. Data is obtained from a DAQ (NI USB-6341). I would like to have the program set up so that one channel of the DAQ is sampled from and continuously plotted for the entire duration of a trial and two other channels are sampled from only for a short and specific instance during the trial (similar to what the attached program would do if it ran). I understand that only one task can sample from a DAQ at a time (which is why my program does not work); however, I am not sure of the best way to achieve my desired outcome. Do you have any suggestions?

 

On another note, I placed a stop button in my program so that I do not have to use the abort button, but the program generally runs for 2 or 3 more trials after the stop button is pressed, before it actually stops. I would appreciate some help on fixing that. Maybe there is a better way that I could have structured the program so that the stop button would work?

 

Thank you very much.

 

Quinn

0 Kudos
Message 1 of 6
(2,591 Views)

Hello Quinn, 

 

If all three channels need to acquire at the same time I would set all of the channels to acquire continuously and throw away the samples that you do not need from channels 2 and 3. If channel 1 and channel 2&3 do not need to acquire at the same time then I would implement what you did in your program set the task to acquire continuously (or finite) then end the task, then set up a new task that acquires finite (or continuously). As for your second question regarding the program running 2 or 3 more times I would have to see a running version of the code in order to better determine how to assist. How are you determining that it is running an additional 2 to 3 more times? Have you run the code in highlight execution and determined that after you clicked the stop button the for loop iterated an additional 2-3 times. Also the Save file button (if you wish to use the latching mechanism) needs to be in the event structure in order to reset. 

 

Best Regards,

 

Izzy O.

Applications Engineer

National Instruments

www.ni.com/support

 

0 Kudos
Message 2 of 6
(2,538 Views)

Thank you, I was thinking that I would proably need to set all channels to acquire continuously and throw away extra data. Good to know I had the right idea.

 

Attached is an earlier, working version of the code. Yes, when I run the code in highlight execution the for loop tends to execute an addition 2 times before it registers that the stop button has been pressed.

 

Thanks again for your help.

 

Quinn

0 Kudos
Message 3 of 6
(2,520 Views)

Hello Quinn, 

 

I could not execute your code because there is a subvi missing. Please attach it so I can see what is causing your VI to execute 2-3 times after the stop button is clicked. Also, you could place an indicator to read the output from the count (N) terminal to accurately determine the number of times the loop has iterated. During highlight execution when you click the stop button what do see coming from the stop button terminal on the block diagram and the iteration count terminal output? When your VI finally stops does the iteration count terminal indicator read 2-3 more iterations then when you initially clicked the stop button? 

 Capture14.PNG

 

Best Regards,

 

Izzy O.

Applications Engineer

National Instruments

www.ni.com/support

 

 

0 Kudos
Message 4 of 6
(2,504 Views)

Oops. Here is the missing Sub VI and the program with the iteration displayed. When you press the stop button the stop button terminal shows true by the end of the iteration in which the button was clicked but the loop does not stop until the end of the next iteration.

 

Regards,

 

Quinn

 

 

Download All
0 Kudos
Message 5 of 6
(2,499 Views)

Hello Quinn,

 

The behavior you are seeing is expected because the button has been updated to true and  it was not recognized in the current iteration (a false has already been sent to the loop condition), thus the program will stop in the next iteration. I thought you were experiencing an issue where the loop would take 2-3 iterations from when you clicked the stop button for it to stop which is unexpected.

 

Best Regards,

 

Izzy O.

Applications Engineer

National Instruments

www.ni.com/support

0 Kudos
Message 6 of 6
(2,488 Views)