LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

delay case structure


@carmen84 wrote:

Hi,
I am presenting one out of two different pictures ( in a case structrure)  on the control panel, based on some processing that is done sample by sample, by outputting a boolean variable(call it X).
What I would like to do is this:
If X is true -->  display PIC1
If X is false --> display PIC2, and maintain it for, say, half a second, no matter what is the actual value of X in this time range.

As of now, I managed to do basically this:
If X is true -->  display PIC1
If X is false --> display PIC2

And this is not good enough for my VI, since there is an annoying flickering between images


There should not be any annoying flickering, ever. Make sure to update the image only whenever it changes and not as fast as the loop allows. If the two pictures are always the same, easiest would be use a picture ring with two images. Why don't you attach the VI you have now so we get a better idea what you are trying to do. Where does the boolean signal come from and at what rate? Also, what is your LabVIEW version?

 

 

0 Kudos
Message 11 of 24
(865 Views)

Yes sir right.

Can you modify that ?

 

One more thing how to do that, as in your reply it appears,

 

-----------------------

ABC wrote:

abcdefghijklmnopqrstuvwxys

----------------------

Is there any shortcut method for that ?

--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
0 Kudos
Message 12 of 24
(861 Views)

Sir  ,

      As you said 100% of a CPU core, I tried to see in task manager but not able to see that. Can you please tell me how you saw that ?

 I am using LV2011 win-7(In case you need this info Smiley Wink).

 

Thanks

--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
0 Kudos
Message 13 of 24
(857 Views)

Sir  ,

                    I tried to modify the code. Please give me the feedback

 

Thanks.

--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
0 Kudos
Message 14 of 24
(849 Views)

@Ranjeet_Singh wrote:

I tried to modify the code. Please give me the feedback


Where is the modified code?

0 Kudos
Message 15 of 24
(845 Views)

Ranjeet_Singh wrote:

      As you said 100% of a CPU core, I tried to see in task manager but not able to see that. Can you please tell me how you saw that ?


Sorry, it happens when the LED is TRUE and the VI is running. Try again.

0 Kudos
Message 16 of 24
(844 Views)

I am sorry, Here it is.

 

Thanks.

--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
0 Kudos
Message 17 of 24
(836 Views)
Hii, Delay of a case structure can be implemented just by using a variable. Include the variable also for case selector. Based on the delay required fix some count, in each iteration increment the value of the variable. Once your count is reached just reset the count check for which pic to be uploaded and do your operation. This should not affect your main while loop timing.
Thanking you,
Sushmith
0 Kudos
Message 18 of 24
(827 Views)

@Ranjeet_Singh wrote:

I am sorry, Here it is.


There is still way too much code!!! Why so complicated? Let's look at your code:

 

 

  • There is no need for the sequence structure. Why is it there???
  • The first two property nodes will get overwritten in a nanosecond with new values inside the loop. They are not needed!
  • Most of the code in your two cases is the same, all that belong outside the case structure!
  • You don't even need a case structure!
  • You have six property nodes, only two are needed!
  • You have 2 waits, only one is needed!
  • Your boolean should be TRUE by default with a mechanical action of "switch until released".

Here's code (still bad!) that is identical to yours except it uses much less stuff!

 

 

 

Still there are problems, for example the loop might still have to spin at a higher rate, e.g. to do other stuff, so delaying everything by 2 seconds might not be good. You are still writing the same properties almost all the time.

 

Try to implement a solution that uses a constant loop rate (e.g. 50ms) and still provides the desired functionality. 🙂

Download All
0 Kudos
Message 19 of 24
(826 Views)

Nice one sir,

 

What does it mean ?

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Try to implement a solution that uses a constant loop rate (e.g. 50ms)  

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

I agree with all the points just needs to ask something,

 

Why this ?

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 Your boolean should be TRUE by default with a mechanical action of "switch until released".

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

But I think this 50ms can be 1 sec or 500ms. Checking in the interval of 50ms is very quick.

 

 

One more thing sir,

I asked you one question in the starting how you reply with that format ?

-----------------------

ABC wrote:

abcdefghijklmnopqrstuvwxys

----------------------

--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
0 Kudos
Message 20 of 24
(808 Views)