LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to skip data?

Solved!
Go to solution

Hi

I am working on a control system where a motor (bi-directional) will rotate for a specific data. When it starts rotating, motor should do this for a while and would not change it's rotation even if the data for opposite rotation comes. In that case, after starting rotation, controller has to skip out the next data for a while.

 

I have made a very simple program to explain the things. Please find the attached file. In loop#01 some random number will generate. In the loop#02, a comparison will be done. When A is true and B is false the output should be 5 and for opposite condition output is -5. When output is 5, this output should stay for a while (e.g 5sec) as 5. In this interval next upcoming 10 data will be skiped out (Since a wait VI is set in loop#01 and wait time is 500ms). I could not figure out how to do this. Could anybody plz help me out?

 

FYKI: you may find the output is -2 when both A and B are true. It may be happened because of converting the boolean into integer. I dont think it is something should be worried about.

 

 

Thanks at advance-

 

Taslim 

0 Kudos
Message 1 of 5
(2,416 Views)

Hi Taslim,

 

If i well understood your issue, i think your architecture is wrong.

Try out an Event architecture ; while loop with event loop inside.

When your event happen, skip your data into the event loop. Shift registers can be useful !

Another way to think about your problem (which can be combined) is to see that as states machine. (Rototion trigo +, Rotation trigo -, initialization(where you rotate only one direction), Stop)

 

Hope this help.

 

BR,

Vincent

Message 2 of 5
(2,390 Views)
Solution
Accepted by topic author taslim.reza

From what I've seen, you will be much better off using a State Machine.  One of your states should be to read the data.  You will also have a wait state where you should look for UI events (event structure).  Another state for setting the output control.


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
Message 3 of 5
(2,369 Views)

Thanks Vincent. 🙂

0 Kudos
Message 4 of 5
(2,329 Views)

I tried State Machine and it worked nicely. Thanks a lot crossrulz. Smiley Happy

0 Kudos
Message 5 of 5
(2,328 Views)