LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Saving Mutiple bmp images in labview?

Now you have a way to fire the Value change event, but the problem is it is in another value change event.  You've got a catch-22.  The only way the event will ever run is if you execute the value change (signalling) property node.  But the property node is in the event that will never run.

 

And worse, if the event would ever run because you had a value change property node execute somewhere else, that event would keep queueing up further events because of the property node in it.  You'd essentially create an endless loop of events.

 

I don't know about your 0-20 requirement, since you've only added a zero constant to that.

 

I'd suggest you read some tutorials if you haven't done so already.

LabVIEW Introduction Course - Three Hours
LabVIEW Introduction Course - Six Hours

 

Look at examples on how the event structure works and read up on it in the help file.

 

Turn on execution highlighting so you can see how your program is or isn't executing.

 

For all of that, the event structure may not be the best way for you to do the screen captures.  Event structures are primarily designed to handle user interface events, but can also handle programmatic events such as value (signalling) property node and user events.  But it is generally a bad idea to have multiple event structures, especially ones that are handling the same events as you are doing now.  It can be done, and there is nothing inherently wrong with it.  But if you don't understand the architecture of your program, you might lead yourself down a path where the program no longer behaves like you expected it to.  You might be better off using a queue or notifier to trigger your separate loop to capture the screenshots.

Message 11 of 30
(1,591 Views)

Hello,

 

I have thoroughly studied your comments. yes i agreed what you have said. Now I have implemented the queuing for triggering and i have removed the event structure for current position. Now i am trying to put the current position in the queue in start event. I have chosen the start event because when i executed the program i have observed that the current position on the indicator starts changing when my program starts the start event. Further I am dequeuing the current position to utilize it for triggering the camera please have a look at it. I have got only three images in my target folder instead of 20. please suggest me what i should do ore to achieve my goal. 

 

Yes you are right i am not used to of labview i am using this first time in my any project.So i am facing too much difficulties. I have seen your suggested tutorials some days before but not properly. In this weekend i will have a look at them again. I am very hopeful that your kind guidance would help me out.

 

Note: Updated VI is attached.

 

Regards,

Rizi

 

0 Kudos
Message 12 of 30
(1,583 Views)

Is it working any better?

 

An important note about queues.  You don't want to obtain a queue and release it in every loop iteration.  It will begin to waste resources.  You should obtain the queue before the loop, only enqueue or dequeue as necessary inside the loop, and then dequeue after the loop.

 

It is better if you replace your stacked sequence structures with flat sequence structures.  Thst stacked sequence structure hides code, and causes wires to run backwards in some frames.  Both of these things hurt readability.  In reality, you don't need the sequence structure in your lower loop.  The 3rd frame is basically empty.  The 2nd frame is already going to follow the 1st because of the dataflow of the wires.  In your upper loop, simple modifications to the code would allow you to eliminate the sequence structure there.

0 Kudos
Message 13 of 30
(1,572 Views)

Hello,

 

Yes it was better yesterday it was taking 3 images at 0, 5 and 20 positions. but today i have tried alot but it is not taking any image.

 

But now i have implemented your suggested solutions. I have taken the queues out of the loop to improve utilization of resources and i have removed the stacked sequence to improve understandability and readability. Now it is looking nice but not performing the required task. It is giving error 1 at write bmpfile.vi  'Snapshot is attached'. One more problem that i havn't discussed with you before that it gives camera initialization error 3 in error window in second run. In first run it do not give this type of error. Then i have to close my vi file and open it again then it is ok for 1st run.

 

Regards,

Rizi

Download All
0 Kudos
Message 14 of 30
(1,563 Views)

Hi rizi,

 

"save0.bmp:\" doesn't seem to be a valid path on Windows systems Smiley Wink

Maybe you forgot to set a valid path before trying to save a picture?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 15 of 30
(1,559 Views)

Hello GredW,

 

Please check my VI i think i have given a valid stripped path. i.e. g:\trysnaps\save0.bmp. I am providing g:\trysnaps\ on front panel and save0.bmp is generated by my code please have a look at it. If i am wrong make me correct where i am making mistake.

 

Regards,

Rizi

0 Kudos
Message 16 of 30
(1,564 Views)

Hi rizi,

 

when I open your VI then "path" is empty! And your error message shown in message #14 says the same as your are trying to write to "save0.bmp:\"...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 17 of 30
(1,559 Views)

Hello GerdW,

 

Yes in the start path is empty when i am running the program. i am giving g:\trysnaps\ in the path control on the frontpanel and it is taking save0.bmp from the string concatinating function. One more thing i have already saved the fules on this path but now it is giving error. I dont know why?

 

Regards,

Rizi

0 Kudos
Message 18 of 30
(1,551 Views)

Hi Ravens,

 

I have sent you my updated vi and the error message. please have a look at it and provide me your kind guidance. I am waiting for your reply.

 

Regards,

Rizi.

0 Kudos
Message 19 of 30
(1,550 Views)

You have to have something in the file path control.  Without it, the build path function is going to assume that the string you are sending in is going to be your drive name.

 

 

If your file path is empty, you might have to detect that and use a select statement to feed in some valid starting path such as c:\

Message 20 of 30
(1,540 Views)