LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading a button

Solved!
Go to solution

Hello,

 

I am looking for examples on how to read a button in labview. Can anyone share some details. Or if anyone have worked on something similar then it would be helpful. Thank you. 

0 Kudos
Message 1 of 53
(1,771 Views)

Are you talking about a virtual button on the front panel or a physical button connected e.g. to a digital input?

 

It both cases, it is all in the dataflow where you just need to poll it at reasonable time intervals. Make sure the terminal (or DI read function) can actually be read by the code and is not e.g. hidden inside another case or outside the toplevel loop. (For virtual there are also e.g. value change events, but if the data does not "flow", it won't help you either)

 

One you give more details and maybe even attach your VI, we can give more specific advice.

0 Kudos
Message 2 of 53
(1,762 Views)

Its a real button. I havent created any VI.  So i need to design a system with a physical button, where when the user presses the button the labview reads that the button has been pressed and then perform certain other task. I am not sure on how to do it. Thats why I am looking for some examples. Thank you. 

0 Kudos
Message 3 of 53
(1,758 Views)

Plain LabVIEW does not care where the data comes from (front panel control, external input, etc.).

 

Designed right, a button state is just an electrical signal that you can measure. What DAQ hardware are you planning to use?

0 Kudos
Message 4 of 53
(1,752 Views)

It would have been better communicated if you used the term "push button switch".

 

You need some DAQ hardware to detect the switch state and you use appropriate drivers to read it from the DAQ hardware. The simplest option would be a simple arduino with LINX toolkit.

 

Based on requirements you may need a fancy DAQ, like if you need to trigger an event when the switch is engaged or would a regular poll would suffice.

 

 

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 5 of 53
(1,742 Views)

@Santhosh. Thank you. This is exactly what I was looking. Thats why I asked, my question was actually do I need some DAQ hardware or is there some fancy push button when you press the button it sends a digital signal that is read by labview. If I need DAQ hardware what would you recommend. This is part of a big production plant. Thank you. 

0 Kudos
Message 6 of 53
(1,739 Views)

@govindsankar wrote:

@Santhosh. Thank you. This is exactly what I was looking. Thats why I asked, my question was actually do I need some DAQ hardware or is there some fancy push button when you press the button it sends a digital signal that is read by labview. If I need DAQ hardware what would you recommend. This is part of a big production plant. Thank you. 


You're starting at the wrong end.

What's the requirements for the button reaction? Is it just some slow, safe function (like send e-mail when pushed), or mission critical, fast and dangerous?

If it's e.g. some emergency button the function should be all electrical (i.e. not SW dependant) but you can read the status through SW.

A typical use case is "Perform measurement when button is pressed", which is a slow and safe interaction. In this which case the button sets a DI which can be polled on almost any DAQ-device  (it must have a DI ofcourse). If it can happen quickly you can have some anti-bounce SW or even HW. If the timing of this activation is important, PCI-daq cards can generate events which is more accurate than polling.

If you really need timing you'll need some FPGA, which quickly gets expensive.

 

So, what's the use case and requirements?

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 7 of 53
(1,729 Views)

 


@govindsankar wrote:

... is there some fancy push button when you press the button it sends a digital signal that is read by labview.



Yup, it's called your computer's keyboard.  You could also read a game controller if you want joysticks, etc...  You could bluetooth a wireless signal from a button app on your cellphone to LabVIEW.  A digital DAQ card can read hundreds of physical switches really fast.  You can detect digital signals on your PC's COM port (if you have one) with LabVIEW.

 

You need to tell us more information about what you actually need to do for us to provide valid suggestions.  😉

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
0 Kudos
Message 8 of 53
(1,701 Views)

What I actually need is to control a hydraulic press. So when I press a button, my labview program will read the button has been pressed. Then the program will inform the control system of the hydraulic press that the function has to be performed, and then the press will put holes in a battery cell. This is the process that has to be done. 

0 Kudos
Message 9 of 53
(1,649 Views)

@govindsankar wrote:

What I actually need is to control a hydraulic press. So when I press a button, my labview program will read the button has been pressed. Then the program will inform the control system of the hydraulic press that the function has to be performed, and then the press will put holes in a battery cell. This is the process that has to be done. 


Looks like a job for a PLC and HMI, but you could do similar stuff with cRIO as well.

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 10 of 53
(1,646 Views)