取消
显示结果 
搜索替代 
您的意思是: 

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

已解决!
转到解答

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 项奖励
1 条消息(共 23 条)
4,252 次查看

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!

0 项奖励
2 条消息(共 23 条)
4,217 次查看

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

https://www.ni.com/en/support/documentation/supplemental/16/understanding-communication-options-betw...


GCentral
0 项奖励
3 条消息(共 23 条)
4,203 次查看

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

0 项奖励
4 条消息(共 23 条)
4,171 次查看

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

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 项奖励
5 条消息(共 23 条)
4,159 次查看

@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.

0 项奖励
6 条消息(共 23 条)
4,156 次查看

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 项奖励
7 条消息(共 23 条)
4,153 次查看
解答
已被主题作者 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 ;))

 

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

0 项奖励
8 条消息(共 23 条)
4,143 次查看

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 项奖励
9 条消息(共 23 条)
4,138 次查看

GREAT HELP! Thank you!

0 项奖励
10 条消息(共 23 条)
4,136 次查看