LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview program stop after a few while loop

I have made a labview program to acquire waveform data and save it every 10 seconds, but the program runs good at beginning but will stop after a few loops. The error message i got is" I/O error". i have to restart my oscilloscope, the program will run again. What is the possible reason? attached is the VI.

Thanks.

0 Kudos
Message 1 of 21
(3,247 Views)

Could you post a picture of diagram?

 

 

Nicola
LabVIEW DeveloperByteLABS.
0 Kudos
Message 2 of 21
(3,242 Views)

Your loop will not stop until you press the stop button, but you'll get an automatic error handling modal popup*. What does the error say?

 

*because you don't have the error out connected at the file IO. You won't get that popup if you wire the error out to the loop boundary, for example. Still you should handle or display the error for troubleshooting anyway.,

0 Kudos
Message 3 of 21
(3,232 Views)

attached is the picture of the diagram. the error message is :

"VISA: (Hex 0xBFFF003E) Could not perform operation because of I/O erro"

I used USB to connect the oscilloscope with my laptop.

0 Kudos
Message 4 of 21
(3,213 Views)

@keysuccess:  Although you've been a member of the LabVIEW Forums longer than I, I'm guessing it has been a number of years (a decade?) since you did any serious LabVIEW programming.  I've taken the liberty of slightly rearranging your VI, turning off the icon displays on Controls and Indicators, straightening wires, turning on the labels of the two DAQ functions that show up as question boxes, moving some controls outside the While Loop, and using the Error Line to also stop the Loop if an Error occurred.  I also added a Shift register so the first time you run, you start a new file (if you really want to start by appending to an existing file, feel free to remove my "improvement" and an Error Indicator so you could "see" the Error Message.  Here's a Snippet with my changes:

BS Modification of KeySuccess VIBS Modification of KeySuccess VI

Incidentally, it looks like the two ? functions are from Agilent 2000-3000 X-Series Instruments (whatever those are).

So what happens inside the loop?  You do a Read Waveform, which brings in some data (no idea how much, no idea how it is timed, nor how much time it takes).  Once this function finishes, the data are sent to a Waveform Graph (I'll assume this takes 0.1 sec) and written to a Export Waveform to SpreadSheet File function, opening a new file the first time through and appending to the file for all subsequent loops.  The time for this function depends on the amount of data written, and will probably increase on subsequent loops (because the file is always opened and closed with each call, meaning subsequent calls have to "find the end" and append, but that should be fairly rapid).  I'll assume this process takes less than a second.

 

You also have a 10 second Wait (ms) in the loop.  Since LabVIEW's Principle of Data Flow means that the loop can't "move on" to its second time through until the Wait is satisfied.  So (at least) 10 seconds after the first Read Waveform, you'll do the second, and (at least) 10 seconds later, the third.  Could this "enforced" slowdown in reading the data from your Agilent (I'm assuming, here) device cause some kind of "backup" that results in an Error on the Error Line?  Using an Error on the Error Line as an additional way to stop the Loop can help you diagnose the problem when it first occurs.

 

Try running this version, and report back on the Error.  Also, find out what happens if you ask for data (however you've coded your instrument to provide it) but only do one Read Waveform every 10 seconds -- does it, in fact, get backed up and fail?

 

Bob Schor

 

0 Kudos
Message 5 of 21
(3,212 Views)

Thanks for your help. I have revised the program. Attached is the complete program. I am running this program now and will report if there is any error messages. I need to correct one thing, The previous error message I got is "VISA: (Hex 0xBFFF0037) Device reported an input protocol error during transfer"

 

0 Kudos
Message 6 of 21
(3,178 Views)
0 Kudos
Message 7 of 21
(3,175 Views)

@keysuccess wrote:

Attached is the complete program.


That's just partially redacted picture of a block diagram. A picture is not a "complete program".

 

  • You are never using the boolean in the shift register, so why is it even there?
  • I strongly recommend to do all path operations using strip path/build path. It is much more fragile doing everything as strings followed by "string to path".
  • While you can change the lower two source channels during run, you cannot change the topmost, because the terminal is outside the loop. Is this as designed?
  • Communicating with an instrument cannot happen in parallel, so you should probably serialize the IO. Currently there is no way telling what happens in what order. You could even combine all into a FOR loop.
  • Even if you keep it separate, at least make the parts look the same instead that random wire mess with three completely different layouts for the same functionality.
  • Is the loop rate slow enough to guarantee that all file IO can complete in the desired loop time?
  • I would use more digits for the iteration number. This way the numeric and alphabetic sorting of the file names remains identical. (file0001.txt vs. file1.txt)
  • Why do you ignore the error in the lower two code trains?
  • Why do you even extract the [Y]? Just graph the waveform! This way x0,dx are correct.
  • I recommend to keep the polymorphic selector next to the function and not give it easter-egg colors.
  • etc. ...
0 Kudos
Message 8 of 21
(3,165 Views)

Attach your VI, not a picture that shows part of the Block Diagram of your VI.  We can't "inspect" your VI (to see the properties of those stupid Express VIs), we can't "edit" your VI (to clean it up so we can better understand it), we can't run your VI (to see and understand the errors), we can't figure out for ourselves what version of LabVIEW you are running, etc., etc.

 

Bob Schor

0 Kudos
Message 9 of 21
(3,156 Views)

I revised my VI as attached. this time I used "read multiple wave form.vi", which make the program more compact. However, I still face the same problem. when the program executed a number of loops (this time 72th loop, wait 1 second in each while loop), it stopped acquiring waveform data. I checked the generated files after it stopped acquiring waveform data. the byte is 1 kb, it should be 67MB.  

0 Kudos
Message 10 of 21
(3,124 Views)