LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Take one sample then delay

The primary section of this code that I'm trying to fix is making the reset condition only happen when the voltage changes states instead of constantly resetting the value. I'll try my best to explain the process. I have a magnetic sensor attached to a exercise bike fly wheel. Every time the magnet passes this sensor it makes a connection and outputs a -3.3 volt signal to the DAQ assistant. This signal causes the entire while loop to reset. This was the only way I could figure out how to configure my system. What I want to do with that -3.3v signal is only sample it and reset the loop when it sees a change in voltage instead of looking at the constant setting.

 

Ex. When the voltage is at -3.3v the loop will reset and no data will be collected. I want it to see the 3.3v shift from 0v and only reset the loop when this condition is met.

 

I've attached an image that points out the area of code that I'm focusing on, as well as the entire vi.

 

Thank you in advanced for your time,
Justin

Download All
0 Kudos
Message 1 of 3
(2,254 Views)

I'm not certain but what I think you want is a edge detector.  You know when the value is above 3, you want to know when the value is above 3 AND the previous value is below 3.  You can do this several ways but I think the easiest would be to drop in the NI VI found here.

 

<LabVIEW>\vi.lib\ptbypt\Other Functions.llb\Boolean Crossing PtByPt.vi

 

Set this VI to make a TRUE on TRUE-FALSE edges then this will only be true once, until the value goes from 3 to 0 again.  OpenG has a similar VI, and you can make one easily using a feed back node/shift register.

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

what are your reasonings for using 2 loops? I am not comfortable with your use of feedback nodes.....

 

get rid off your inner loop, this can be done with ONE loop....put your daq create,start and clear tasks functions outside the ONE while loop.

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