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

Input : Push Button As a toggle switch

hello,

I am using Push button in a spring effect.

I want to control a LED with this input.

If Once I press that button output should be on on LED and second time press,It should OFF and so on....

Please give me logic 4 it...

Thank you.

0 项奖励
1 条消息(共 11 条)
13,347 次查看

Please find the modified VI for ur solution.Hope this helps

 

Kudos are welcomed.:-)

2 条消息(共 11 条)
13,337 次查看

Hi,

   Take a look at this.im sure it will help

-------------------------------------------------------------
kudos welcome
0 项奖励
3 条消息(共 11 条)
13,335 次查看

Dear  omprakash,

 

I believe this is not full proof way, beacuse when LED local variable is FALSE & inpyt is TRUE, the LED will be TRUE & the same value will bepassed to its local variable.

 

Now if switch remains TRUE & LED is TRUE so LED will get OFF.

This condition will arrive when the processor is loaded & execution gets slow. Always avoid this.

0 项奖励
4 条消息(共 11 条)
13,328 次查看

Hi kekin,

        Nice one.common thing is we both used local variable眨眼表情

-------------------------------------------------------------
kudos welcome
0 项奖励
5 条消息(共 11 条)
13,327 次查看

Hi kekin,

               Im not getting in particular what you are trying to say.

              please give some real time example or a vi

-------------------------------------------------------------
kudos welcome
0 项奖励
6 条消息(共 11 条)
13,323 次查看

Your code will work only if LOCAL VARIABLE gets updated before the switch goes from TRUE to FALSE.

 

If LOCAL VARIABLE does not get updated before the input switches to FALSE then ur code will not work. You  have dependecy here & this error can happen randomely at any time.

 

F-->False , T-->True &  LV-->Local variable of LED.

For example, initially: 

1.LED=F , LV=F & INPUT=F.

2.PRESS INPUT

3.INPUT=T & LV=F so LED=T

4.Now if LV is not updated first then.

5.INPUT=F & LV=F so LED=F.LED will never turn ON.

 

This can happen.Hence your code will work only if LOCAL VARIABLE gets updated before the switch goes from TRUE to FALSE.

 

Kudos are welcomed.:-)

 

Hence I have edited your code to make it FULL PROOF.

 

 

下载全部
0 项奖励
7 条消息(共 11 条)
13,310 次查看

Here for writing to localvariable LED it takes time.Iagree
But in my vi im only reading from output LED
i.e
Here as the output changes local variable will change with it.
Because both share the same memory space.

-------------------------------------------------------------
kudos welcome
0 项奖励
8 条消息(共 11 条)
13,298 次查看

Dear Omprakash,

 

If you search on LOCAL VARIABLE, then u will find that each local variable (whether READ or WRITE/ CONTROL or INDICATOR) is assigned seperate location & is updated after some time.

Local variables always chage after the CONTROl or INDICATOR changes.

 

Fastest is CONTROL & INDICATOR

Next is Local variables &

Slowest are Property Nodes.

 

Read following article to clear ur CONCEPTS:

 

https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000019N6nSAE&l=en-US

http://digital.ni.com/public.nsf/allkb/37002ACC84B961CA86256D9C00760EE2 

 

and last but not least:

https://www.ni.com/docs/en-US/bundle/labview/page/memory-considerations-when-using-local-variables.h...

 

Hope this clears my POINT.

I cannot explain more on that.

 

 

9 条消息(共 11 条)
13,294 次查看

Dear OP: ghj

 

Reqest to accept any one as solution depending upon ur choice & close the thread.

 

Kudos are welcomed.:-)

0 项奖励
10 条消息(共 11 条)
13,290 次查看