LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

File incrementer problem

Hi, I made a vi to take images and save it in a file in a While loop (run it every 3 sec.). The images are saved to files whose filenames will increment by one. The problem is that it only can save 10 files. After that nothing is saved. I attach the vi with this question. I appreciate if anyone can check it for me and let me know what the problem is. Thanks.
0 Kudos
Message 1 of 6
(3,071 Views)
Do not have all of the IMAQ VIs so I can't test it all but here are some observations:

Why do you run a open file on the c:\rui\a path on the first iteration and then just convert the refnum from open to a path again? If you have a file called a then that file will be opened and never closed...leaving it open...If you just need the path then no open is necessary.

The loop outputs the paths:

0: c:\rui\a (in this case a is opened)
1: c:\rui\a1
2: c:\rui\2
3: c:\rui\3

Is this really the name of the files you want to write?

Now - if these files already exist in that directory...then they will probably not be overwritten unless you do edit the write BMP function to do so.

What do you do with the open "a" file, it should be closed somewhere (if it really
is a point in opening it(?)).

If you probe the different wires you should be able to see what happens after the first 10 files...is there a valid image out from the Snap.vi? If there is try probing inside the write...
0 Kudos
Message 2 of 6
(3,071 Views)
Besides Mads excellent comments, you've made your case statement smaller than the code that's inside it and that's a REALLY BAD thing to do. If you just want the files names as Mads noticed (and I verified), then you've got an awful lot of extra code. What I would suggest is deleting all of the Imaq stuff and create an indicator on the output of the case statement so that you can look at the file names you've created. Or, wire the output of the case statement out through the while loop and enable auto-indexing of this output and then create an indicator. This will be an array of all the file names you're creating.
0 Kudos
Message 3 of 6
(3,071 Views)
Thanks for your comments. I deleted "save images in files" part in the vi I attached last time. The new vi (attached below) only snaps images and displays the images on the screen. The problem is that still only 10 images can be snaped. After that, I got an error "Error-1074397179 occurred at IMAQ Snap.vi. Possible reasons: NI-IMAQ: (Hex 0xBFF60005), invalid parameter #1". Please help. Rena
0 Kudos
Message 4 of 6
(3,071 Views)
Try moving your IMAQ Init outside the while loop and only do it once. Then, when the while loop finishes, do and IMAQ Close. Continously opening a reference with doing a close can cause all kinds of problems.
0 Kudos
Message 5 of 6
(3,071 Views)
I got it work after modified it as you advised. Thanks a lot. Rena
0 Kudos
Message 6 of 6
(3,071 Views)