LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to send value from inside while loop to the outside

Solved!
Go to solution

Thanks Nathan! That delay/stacked structure was exactly what I needed. It works great now. However I do have that problem as you suggested (if the sensor reads greater than 140cm I get an error, as it would write > 1 for the duty cycle). How do I stop this from happening

 

Cheers,

Nick.

0 Kudos
Message 11 of 16
(2,164 Views)

Hey guys,

 

I am still getting the same error (most of the time - sometimes it runs without the error) as I was getting previously..

The error 200301:

The pulse generation with previous property settings must complete a full cycle before the property can be updated.

 

Not sure why, I took the advice to put in the delay (as in the layout picture I attached).

 

You will notice I have also added a 'select' function (which I put through the delay structure as well - in my attempt to fix the update error;which didn't fix anything). The select function is (I think? Could be doing this wrong too) either choosing the value of the height of the ball (if its less than 140cm - which is the height of the tubes). If it isn't (the false case), which would mean a bad read from the sensors, then I take the previous value; which I pass from the register. Is there a better way to do this? This ensures my read is between 0 and 1 for the duty cycle.

 

Also, any more ideas on how to fix the error i'm getting??

 

Thanks heaps!

Nick.

 

 

0 Kudos
Message 12 of 16
(2,144 Views)
Solution
Accepted by topic author nicklijic

Hey Nick,

 

In order to prevent error 200301 you need to make sure your wait time is longer than 1 period of your output pulse. For example, if your output frequency is 10 Hz, you would have a period of 0.1 seconds, so your wait needs to be at least 100ms. Refer to this article for a more detailed explanation: http://digital.ni.com/public.nsf/allkb/5F4D0C03B345468986256E85005A2FCC.

 

As for making sure the values you send to the duty cycle are between 0 and 1, your method seems fine to me. There are numerous ways you can do this, but checking the the value and making sure it's less than 140, and then changing it if it does happen to be over 140 is a perfectly fine method. I hope this helps!

 

-Nathan H 

Software Developer
National Instruments
0 Kudos
Message 13 of 16
(2,133 Views)

I have a similar problem maybe if you could help:

I have 2 parallel while loops.

There is a variable(runs from 0-50) in one that I would like to access simultaneously in the other loop...I tried createing a global variable but it seems that it is only reading the very first value(0). I know there might possibly be a race condition, but shouldnt the variable be updated in the second loop continously anyways?

 

Thanks!

0 Kudos
Message 14 of 16
(1,935 Views)

@developer001 wrote:

I have a similar problem


Even if you've similar problem, chances that someone visit this thread (which is already marked as SOLVED) are less. So better you start a new topic, and probably there you may give reference to this thread as well.


I am not allergic to Kudos, in fact I love Kudos.

 Make your LabVIEW experience more CONVENIENT.


Message 15 of 16
(1,932 Views)
0 Kudos
Message 16 of 16
(1,927 Views)