LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Trying to get input from DAQ assistant to behave like a latching switch

Hi,

I am very new to labview and was wondering if it is possible to get myDAQ input to behave like a latching switch when it isn't physically a latching switch. I have a circuit consisting of a touch sensor that behaves like a pushbutton. This sensor sends input to the myDAQ when the wire is touched, and it outputs a signal to an LED (connected to a digital output pin on the myDAQ) to turn it on.  I would like to use labview to take the signal produced when the sensor is touched to keep the LED on until the sensor is pressed again.  RIght now, the LED only stays on while the sensor is being touched. Any suggestions?

 

Here is what the block diagram currently looks like:block diagram.PNG

 

0 Kudos
Message 1 of 3
(2,763 Views)

The logic you have now is going to pass the value without maintaining history.

 

You're going to need a loop of some kind.  I'll leave this to you to figure out.

 

You'll need to maintain history.  I'd suggest a shift register.  With this, you can compare the current value to the last. 

 

Once you have that, you'll want to find a way to use the comparison to determine how to handle the LED.

0 Kudos
Message 2 of 3
(2,751 Views)

Hi Catherine,

 

 I would like to use labview to take the signal produced when the sensor is touched to keep the LED on until the sensor is pressed again.  

To solve such porblems it (sometimes) helps to create some pseudocode:

IF (sensor_current == TRUE) AND (sensor_before == FALSE) /* detect "sensor is touched" */
THEN LED := NOT(LED) /* switch LED */ ENDIF

It really helps to work with pseudocode (or schematic flow diagrams) to analyze a problem. And analyzing a problem is usually the first step to write a program…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 3
(2,706 Views)