LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Low-Level Snap VI Datflow enforcing by using Sequence Structure

This is the example shipped as Low-level snap.vi

-I don't really don't understand the usage of sequence structure here after the error wires connected to enforce data flow.

-Did I miss anything?

-The Label "Buffer Number Mode" is getting on the image wire.(Ofcourse i can move it, but i'd expect little bit maybe 5 more seconds of Labview guys to take care and not spread these kind of programming)

-Feel free to comment 🙂

Low-Level Snap.png

Thanks
uday
0 Kudos
Message 1 of 25
(4,061 Views)

There are a couple of excuses I could come up with.

1. They wanted to differentiate the main method from the closing

2. It is an old example that did not have error wires in the original API

 

I doubt either is correct.  I completely agree that the seqeunce structure is not needed at all here.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 25
(4,057 Views)

I guess some day there was a frame in between that allowed to wait till user does something (wait front panel activity) and only after that discard image.

Now it clears image directly after snap and you might not see the result. I can not check, may be now clearing image does not delete image display data and you do not need to pause vi. But sequence remained from old times.

Label on the wire is probably due to font issue - they made this vi with different system font and it was fine. On your machine font resized and element location - not. Very very common.

0 Kudos
Message 3 of 25
(4,026 Views)

Oh, come on, these are examples meant to show simple things (in this case, "how to acquire a single image using low level acquisition functions and display it in an image display control".  Yes, the Label on the Buffer Number Mode enum is slightly askew, and the Sequence structure is entirely unnecessary, but give these guys a break ...

 

Bob Schor

0 Kudos
Message 4 of 25
(4,012 Views)

IMAQ images are a bit tricky and confusing.  When you write the image to the "Image" indicator terminal, your are actually just writing a reference, and the control (running asynchronously in the UI thread) will actually read from that reference at a latter point to actually render the image on the screen.  This differs from most other LabVIEW indicators, which take by-value data, not a reference.  There can easily be race conditions, where one changes or destroys the image before it can be rendered by the indicator.  

 

Indicator terminal have no outputs to enforce operation order, and the sequence structure in this subVI is to ensure that the destruction of the image happens after the write to the indicator.  That may not be enough, though, unless the indiocator is set to "synchronous" diplay (meaning the display is done immediately as you write to the terminal, rather than in parallel).

 

A clearer way to use the sequence here is to put a single small frame around the "Image" terminal, and run the wire to the image-destroying VI through the sequence.  Then it is clear what exactly we are sequencing.

0 Kudos
Message 5 of 25
(4,000 Views)

Agreed Bob. These examples are just to illustrate the basic functionality.

-My intention of highlighting is such that experienced people will not bother and they'll carry on.

-But for beginners it teaches a bad way of coding and they'll continue doing so unless someone again points out.

-And i am sure many people use examples as starting point and develop their own, Some use the examples directly.

-Either way i just want to point out the unnecessary usage of Sequence structure and to be removed.

Thanks
uday
0 Kudos
Message 6 of 25
(3,998 Views)

Here's a possible improvement:

Low Level Snap Modified.png

0 Kudos
Message 7 of 25
(3,992 Views)

What difference it will create if i wire directly to dispose without using sequence structure?

Reason for my doubt is as soon as all available nodes for an Function or subVI is available it will start executing so there wont be any change i hope, Curious to know answer from you.

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
0 Kudos
Message 8 of 25
(3,987 Views)

drdjpowell is correct, the sequence structure is absolutely necessary to ensure the execution that is expected.  If the IMAQ dispose vi executes before the indicator renders (which is possible without the sequence structure), no image will appear on the front panel (because of the by reference vs. by value that was explained above).

0 Kudos
Message 9 of 25
(3,980 Views)

Hope even if you have sequence structure for display image, soon after the execution of dispose VI the the image will get cleared.

Am i making sense?

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
0 Kudos
Message 10 of 25
(3,972 Views)