LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Boolean Logic help

Solved!
Go to solution

Hi guys!

 

I need to monitor an input (voltage) and register the time when the input is greater than zero.

If the input stays above zero the time should not be registered again.

MeasurementLoop.JPG

The measurement is taken within a while loop.

I tried to check if the numerical input is not equal to zero and put the boolean output into a shift register.

The value of the register is then compared to the boolean output and written into the register again.

The logic i use (XOR) doesn't do the trick.

 

Do you have any idea how i can build this so it only takes the time once?

 

P.S.: Don't worry, I will tidy up the block diagram when it is working properly.

0 Kudos
Message 1 of 4
(1,329 Views)
Solution
Accepted by MDKTec

Hi MDKTec,

 


@MDKTec wrote:

I need to monitor an input (voltage) and register the time when the input is greater than zero.

If the input stays above zero the time should not be registered again.

 

I tried to check if the numerical input is not equal to zero


Why do you compare for "<>0" when you want to test for ">0"???

(And why do you append the current sample to an array, then index the last element of that array for testing? Why not simple test the current sample before appending to the array?)

 


@MDKTec wrote:

put the boolean output into a shift register.

The value of the register is then compared to the boolean output and written into the register again.

The logic i use (XOR) doesn't do the trick.


So you want to get the current timestamp when the boolean value changes from FALSE to TRUE? This is called a "positive/rising edge" and there is a ready-to-use function named PtByPt-BooleanCrossing to detect such edges in boolean signals!

 

Example:

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 4
(1,283 Views)

You are comparing the <>0 condition (should it be >0 instead?) with the previous result of the XOR. You should rather compare with the previous condition, i.e. wire the <>0 to the shift register.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 3 of 4
(1,276 Views)
Why do you compare for "<>0" when you want to test for ">0"???

(And why do you append the current sample to an array, then index the last element of that array for testing? Why not simple test the current sample before appending to the array?)


 The measurement device I'm using only gives positive values anyway, so it won't matter, but you are correct, best practice is to use a greater than zero.

I have to check each output of the measurement device if it really is a voltage or rather a current. The device doesn't give back the values properly, so it is possible that the last read value is a current value, which is always zero. By reading the value from the array, I can make sure that I only read values after they ran through the voltage/current check.



So you want to get the current timestamp when the boolean value changes from FALSE to TRUE? This is called a "positive/rising edge" and there is a ready-to-use function named PtByPt-BooleanCrossing to detect such edges in boolean signals!

Exactly! Thanks for the suggestion! It worked!

 

 

 

 

 

 

 

 

 

 

 

0 Kudos
Message 4 of 4
(1,263 Views)