02-16-2011 11:56 AM
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
02-16-2011 12:19 PM - edited 02-16-2011 12:20 PM
02-16-2011 12:34 PM
If you don't have the OpenG stuff
02-16-2011 01:40 PM
With a little help from the PtByPt palette:
02-16-2011 03:01 PM
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
02-16-2011 03:34 PM
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)
02-16-2011 08:29 PM
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.
02-16-2011 09:57 PM - edited 02-16-2011 10:00 PM
Although this has already been solved, I'm just putting in my two cents, since I still avoid feedback nodes like the plague
.