LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

single boolean increment

I am attempting to set up a photo gate for use as a tachometer. I have set up voltage outputs to the sensor and emitter, and an input from the sensor. when the sensor is open it returns a voltage of .15, and when it is clossed it returns a voltage of .45. What i have done is set up a range detector that gives a true/false statement if the voltage is in the closed range of .25 to .6. If the gate is closed it returns true, if the gate is open it returns false. Then i set up an incrementer with feedback to add 1 to an initial zero value. I want the incrementer to execute one and only once if it reads true, and then perform the task again only if the value reads false, and then true again. This will give me the number of times a true value is obtained. as of right now it will increment several times depending on how long the gate is closed. I have seen people talking about latched buttons, that will only iterate once per button push, i need to implement something like taht. I tried to set the range withing the signal transition area of .2 to .35 and it will not register the value because the voltag jumps instantaneously. edge detection is promising but i have not had any luck with that feature

i have an ni usb 6211

0 Kudos
Message 1 of 8
(3,696 Views)

OpenG Boolean Trigger.

 

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 2 of 8
(3,686 Views)

If you don't have the OpenG stuff

 

Rising Edge.png

Omar
Message 3 of 8
(3,678 Views)

With a little help from the PtByPt palette:

 

BooleanTriggerExample.png

0 Kudos
Message 4 of 8
(3,660 Views)

Ok, i have one question, i dont have open g, what is the green arrow before the graeter than sign doing/called. this is the only portion of the code i cannot recreate

0 Kudos
Message 5 of 8
(3,644 Views)

It is a feed back node. Similar to a shift register on a loop.

It keeps the last state for the next iteration so you can compare the state of the Boolean to the state it was the last time to see if it has gone for false to true (rising edge)

Omar
0 Kudos
Message 6 of 8
(3,631 Views)

Thank you all for your responses. I have implemented a code that will increment only once per event using the greater than method, and it is working well. I put it all in a foe loop to be terminated by a button. In that loop i used a elapsed time set to restet after 1 second. when it reaches a second a true value is iterated once which triggers a zero to be multiplied into the feed back node of the counter. I then multiplied by 60 to convert to rpm. The only thing i have left to do is to create a data logging feature which will hold the largest rpm values for each time period and either display them in an array or graph them every second because at high rpms we will not be able to observe the indicator, any insight would be greatly appreciated. i have attached a print screen.

thanks again.block diagram.png

0 Kudos
Message 7 of 8
(3,615 Views)

Although this has already been solved, I'm just putting in my two cents, since I still avoid feedback nodes like the plague Smiley Sad

.

 

 

 

 

0 Kudos
Message 8 of 8
(3,608 Views)