09-30-2019 10:40 AM
Hey everyone,
So I'm an undergraduate research assistant trying to get a VI to work and spit out an image every time it is looped. The VI I'm working on is supposed to be a part of a sequence that captures a photo of a sample at set intervals. Everything is working fine except for this photo taking part that I have as a subVI.
The VI works fine when it is run once, and it saves a file perfectly. However, when it is looped, it seems incapable of spitting out the second file (both when the whole vi is looped and when it is placed in a while loop). I've been tinkering with making it generate new file names for each photo but all amount to nothing, and I just keep getting Error Code 3 when the file save part is disabled, and Error Code 3 and Error 1172 occurred at Invoke Node Error calling method uc480.Image.Save, (System.ArgumentNullException: Key cannot be null.
Parameter name: key) when the file save structure is enabled.
I'd appreciate any help I can get.
09-30-2019 10:48 AM
Hey badr.jpg,
I'd suggest as a starting point that you do the following:
I'll dig out my copy of the driver for these cameras if you're not able to solve the problem based on these tips, then I'll be able to read the help information and so on (currently they're all just displaying "The method for this invoke node is not valid for this class"...)
09-30-2019 11:03 AM
Hey,
So I've moved all the cleanup stuff out of the loop. I've tried moving the initialization outside too but that just stopped the loop from initializing each time. There is a subVI thing in the initialization sequence that also throws out an error when looped. I suspect that is the culprit.
Thanks for replying so soon.
09-30-2019 11:05 AM
I'll just add that when the while loop is removed, and the sequence is run, it works just fine. So I doubt it's a connection issue. Maybe the initialization sequence isn't starting over from scratch like it should and it's reusing values?
09-30-2019 11:07 AM
09-30-2019 11:11 AM
Alright cool!
Also, here's the file with the saving inside the loop. I get Error 1172 occurred at Invoke Node Error calling method uc480.Image.Save, (System.ArgumentNullException: Key cannot be null.
Parameter name: key) when the saving is inside the loop.
09-30-2019 11:12 AM
Forgot to upload, oops.
09-30-2019 11:26 AM
So let me have a few more guesses and you can point out where I'm going wrong...
It seems as though (at least from that somewhat peculiarly structured example) that the only bits you're going to want inside the loop are the sections here:
Note here that the camera reference is not closed. The "Memory" reference and the "Display" reference are closed.
The "memID" value is the handle of the PictureBox, which is also not closed.
I'll need to look through the documentation to get a better idea of why, but that might have to wait for tomorrow! (Perhaps someone else will tell you before then, but I have to sleep!)
09-30-2019 11:33 AM
I can wait! Thats alright. I've also literally just used the uc480_basics VI and added in a little something to save the file it captures, but even the original VI chokes on the same error when looped. I'll upload that here.
The only thing I've done to modify this is just remove the loop, which I'm not sure was the wisest idea, but here is the original in case you'd like to take a look at it.
Greatly appreciating your help. It's keeping me sane for now.
10-02-2019 12:43 PM
Hey,
I hope you're doing well. Did you manage to get anything?
Thanks!