LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use the same button to control run or stop of the program?

I want to run a program when I press Boolen2, I use switch when press. So when I press it, it will turn "on" stature. There is a loop in the program. I want to stop it, when press the button again, that is when make the button from "on" statue to "off" stature.
But I don't know why it doesn't work in my vi. And is there other good way?
Thank you.
0 Kudos
Message 1 of 7
(3,105 Views)
hi,
when i try to open your vi, it asks to locate the vis "MP421_AD.vi","MP421_Read.vi", Array to wave.vi" and so on.
in order to execute this and see what is happening, pleaase send me the complete set of codes. i think better you can go for save  with options->developement distributions or custmized save.
 
Thanks,
Sathish
Message 2 of 7
(3,097 Views)
hi,
Thank you for your help.
Please try this vi.
Thank you.
 
 
Hugoliang.
0 Kudos
Message 3 of 7
(3,077 Views)

Hai,

still i could not open ur file as there are some library functions all those things which are not there in llb file.

but i have attached skelton (one vi) for your code. where you could place functions inside that and execute it.

the button boolean gives you the functionality exactly what u need.

 

Thanks,

Sathish

Message 4 of 7
(3,050 Views)
Hi,
Thank you very much.Please download this file and save it under the same path,and change its extern name to dll.
I have tried follow your vi. But this method doesn't work properly in my vi. I don't know why.
Maybe it is because there is a highspeed data acquisition working in the loop. And I have tried to wait 100ms every loop.But it doesn't work.
Thank you for your help.
 
Hugo Liang. 
 
0 Kudos
Message 5 of 7
(3,044 Views)
Hi,
I have found the problem. I have put it in an event structure. I have config it run when the button's value change. And wire the button to a case stucture. I move it out of the event structure, it can run properly. But in the structure, It can't run.
I don't know why.
 
Thank you for your reply.
0 Kudos
Message 6 of 7
(2,961 Views)

hai,

event structure code will execute once the specified event occurs. for this event source i.e. control should be outside of the event structure.

so basically when u place the boolean control inside the event structure, event structure will not have access to detect that value change event.

when it is outside the event structure, event structure can detect the event for that button.

that is it the concept.

 

Thanks,

Sathishkumar. S

Message 7 of 7
(2,947 Views)