LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

data input stabilization

Thanks, I will definitely experiment with the daqmx functions. And by various testing, I have realized the way while loops work and have already enclosed the entire code in a while loop. I've mostly been building small pieces of code in blank projects and using indicators to see if its working as I envision; observing and testing different data bits. A little time consuming, but a great way to learn.

 

As for the stop program; I need the program to run forever unless it it closed as we need to have certain functions (to be added to the VI) active continuously. This is again fixed by placing the entire code in a loop.

 

With the entire code in a while loop, is there a way to make a case structure execute only once during a true input? For example if you have a push button T/F and someone holds down the button, I need the case structure to only execute once no matter how long the button is held; to have it activate again only if the button is released and pressed again.

 

Also, I've looked into training, but money concerns mean google and Labview for Everyone are my resources. It's fun learning on my own, and when I get really stumped I post on here Smiley Happy

 

Ryan

0 Kudos
Message 11 of 17
(562 Views)

Hey Ryan, 

 

       To make the case structure execute only once when the switch is pressed, right click your button that is returning true/being pressed and select the mechanical action "Latch when pressed". This will send a true value only once even if the button is held down and wont send another true until it is released and pressed again. 

 

Here is more information on the other options of mechanical options. Feel free to do a little experimenting by wiring a switch to an led indicator in a while loop. Use the highlight execution tool to see exactly whats happening.

http://zone.ni.com/reference/en-XX/help/371361H-01/lvhowto/changemechactofboolswitch/

 

Hope this helps,

 

Luke West

 

0 Kudos
Message 12 of 17
(553 Views)

That is the function I need-but unfortunately the input to the case structure is not a front panel button, it is a T/F value derived from a signal that comes from external hardware.

 

 I need a way to latch a boolean value without having a front panel input so that when a true value is inputted, it sends one signel true pulse to the case structure and then immediately resets to false.

 

-Ryan

0 Kudos
Message 13 of 17
(538 Views)

Hey Ryan,

 

         For this case, you may want to create a state machine. Use a case structure, a shift register, an enum, and some local variables. I've attached a simplified version that detects when a value goes above a threshold constant. It will perform the threshold action only once (even if the value stays true) and then enter an above threshold state, titled threshold detected wait. Whatever actions you would like to be performed only when the threshold is initially passed can be put into the case structure 'threshold detected action'

 

Heres an online example on state machines

https://decibel.ni.com/content/docs/DOC-4594

 

Regards,

 

Luke W

0 Kudos
Message 14 of 17
(532 Views)

Using a state machine alsmost works-but the trouble comes from the outside signal being the trigger. I used your structure and replaced the 'greater than' functions with the waveform scalar limit comparison, and connected that to the daqmx signal. I used a local variable in the 'threshold detected, wait' case to take the place of your control. However, you cannot use local variables to call an active signal; it takes the most recent reading and re-uses it indefinitily, creating an infinite loop.

 

I then tried inserting a separate daqmx function in the 'threshold detected, wait' case, but there seems to be an issue whenever you use more than one daqmx function, even if they are not used simultaneously.

 

Is there any way to inport live data into various cases?

 

Ryan

0 Kudos
Message 15 of 17
(522 Views)

Hey Ryan,

 

               You can feed live data into the case structure and eliminate the use of local variables at all

 

Luke W

0 Kudos
Message 16 of 17
(503 Views)

I was having an issue with doing that with the daq assist. I figured it out; I had all of the daq assists set to continous samples and they were interfering with each other, now I have them set to 1 sample and it works.

 

Thanks!

0 Kudos
Message 17 of 17
(491 Views)