08-27-2010 02:04 AM
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.
08-27-2010 02:33 AM
Please find the modified VI for ur solution.Hope this helps
Kudos are welcomed.:-)
08-27-2010 02:40 AM
Hi,
Take a look at this.im sure it will help
08-27-2010 02:44 AM
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.
08-27-2010 02:47 AM
Hi kekin,
Nice one.common thing is we both used local variable![]()
08-27-2010 02:53 AM
Hi kekin,
Im not getting in particular what you are trying to say.
please give some real time example or a vi
08-27-2010 03:27 AM - edited 08-27-2010 03:33 AM
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.
08-27-2010 03:47 AM
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.
08-27-2010 03:55 AM - edited 08-27-2010 03:56 AM
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:
http://digital.ni.com/public.nsf/allkb/2EE5662479871C058625753F005C2352
http://digital.ni.com/public.nsf/allkb/37002ACC84B961CA86256D9C00760EE2
and last but not least:
http://zone.ni.com/reference/en-XX/help/371361F-01/lvhowto/localvarcannotreusedatamem/
Hope this clears my POINT.
I cannot explain more on that.
08-27-2010 04:00 AM
Dear OP: ghj
Reqest to accept any one as solution depending upon ur choice & close the thread.
Kudos are welcomed.:-)