LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I increment once only?

I am trying to keep a count of the number of times my voltage reaches 5 volts after passing thru a rotating switch. I want it to only increment one time each time I see 5 volts. Currently it keeps incrementing as long as the switch is in the on position which may be for several seconds up to several minutes.

I am using Labview 5.01 with a daqcard 1200. My vi is attached. Any help would be appreciated. I visit this forum often and it has been a great help.
0 Kudos
Message 1 of 8
(3,441 Views)
Put a shift register on you acquisition loop that stores in it the state of the voltage last time through the loop. Now, only increment the count if the voltage was not greater than 5V last time through the loop, but is greater than 5V this time.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 2 of 8
(3,441 Views)
The problem is that it will be greater than 5V for a period of time and it continues to increment while it is.
0 Kudos
Message 3 of 8
(3,441 Views)
Yes, but if you only increment the count when the last sample wasn't greater than 5 and the current sample is greaterthan 5, it will only increment once no matter how long it stays above the threshold.

Would it be helpful if I posted an example of the logic?

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 4 of 8
(3,441 Views)
Mike

Feel free to add logic to the vi that I posted. I am still new to Labview and I am a geologist not an electrical engineer so I am having some trouble with the electric end of this as well as learning the programing.

Thanks for your help.
Mdlggr
0 Kudos
Message 5 of 8
(3,441 Views)
Try this VI out I wrote,
0 Kudos
Message 6 of 8
(3,441 Views)
This seems to work and with a little adjustment should fit into my master vi.

Thanks for all the help.

Mdlggr
0 Kudos
Message 7 of 8
(3,441 Views)
Here's the code back. For demonstration purposes, I removed the DAQ VIs and put a signal generation function in the place of the Analog Input. I also added a stripchart so you can see the "data".

Due to the output of the sine function, I made the limit .5 instead of 5.

You'll notice that every time it goes from less than .5 to greater than .5 the count increments by one.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 8 of 8
(3,441 Views)