LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

"Event structure" can't work in "While Loop"

Solved!
Go to solution
Highlighted

Hi everyone.

 

I'm new to LabVIEW and I'm learning how to use the real-time PC to output analog voltage from the data in an array. I'm now first want to create an array. I want to make it clear for users to manipulate so my desire is: when click "RESET" button, all the numerics and the array are initialize(typically all set to "0") and when click "START" they are able to create the specific array I need. And now I meet 3 questions:

 

1. My current understanding is to use "Event Structure" in a "While loop" to achieve my goal. But when I start compiling and then run the VI the button can't work. when I take the code out of the "Event structure" it can run as I wish. 

 

2. I wrote the program out of the real-time target and made it an independent vi it could run. But when I inserted it under the target category it couldn't work. Now neither opening it in my host computer nor writing a new one can't work.

 

3. I try to test out and put the button in a "while loop" it could be clicked but when add an "Event structure" it can't run as I wish.

 

Hereby are my files.

 

0 Kudos
Message 1 of 23
(308 Views)

A RT target does not have a UI, so an event structure is useless.

 

You should eliminate all your value property nodes. There is absolutely no need for them!


LabVIEW Champion Do more with less code and in less time
0 Kudos
Message 2 of 23
(273 Views)

Unfortunately programming such a system on an RT device is a bit more complicated. 

 

If you're always going to be controlling it from a desktop applications (or development environment) you probably want to look at the options for inter target communication. 

 

Here are some links you might find helpful. 

https://learn-cf.ni.com/teach/riodevguide/guide/rt-pc_inter-target-communication.html

http://www.ni.com/product-documentation/53345/en/

0 Kudos
Message 3 of 23
(259 Views)

Thank you. But how can I operate the variables without creating their value property node?

0 Kudos
Message 4 of 23
(227 Views)

In LabVIEW variables are the wires shift registers, feedback nodes etc.

 

Controls and indicators should be viewed as a "I/O" device to get information from the user or present info to the user.

 

Ben

0 Kudos
Message 5 of 23
(215 Views)

@chen3477 wrote:

Thank you. But how can I operate the variables without creating their value property node?


LabVIEW does not really have variables. Typically, the wire is the variable and you can keep it in a shift register if needed.


LabVIEW Champion Do more with less code and in less time
0 Kudos
Message 6 of 23
(212 Views)

LabVIEW is not like other programming environments.  You would benefit greatly by learning a little about it before jumping in over your head.

 

When you come to the LabVIEW Forum, you are greated with the following:Training.png

(The bright red arrow point you to Training offerings is not present on the Forum, itself, so you might have missed these offerings).

 

You will quickly learn that "Data are carried by Wires", and you interact with Wires, not with conventional "variables" that you would find in text-like languages.  It turns out to be a powerful visual metaphor ...

 

Bob Schor

0 Kudos
Message 7 of 23
(209 Views)
Solution
Accepted by topic author chen3477

What are you going to do with the final array and why do you have the 10ms timing? Are you expected to change the numerics while the loops are running? Probably not! (You could not, even if you tried, because the event is set to lock the front panel until it completes Smiley Wink)

 

Here's a comparison of two ways to create that array.

The top is based on your code... arguably, the bottom is simpler (no value properties, no sequences, etc.)

 

wowzers.png


LabVIEW Champion Do more with less code and in less time
0 Kudos
Message 8 of 23
(199 Views)

I add a waiting time because I found it couldn't produce array one-by-one. Now it can create in a sequence like 0.001, 0.002 and without a time delay it can't work at the regular interval of 0.001. I don't know why.

0 Kudos
Message 9 of 23
(194 Views)

GREAT HELP! Thank you!

0 Kudos
Message 10 of 23
(192 Views)