# LabVIEW

cancel
Showing results for
Did you mean:

## Re: how to count the number of cycles in sine wave

Hi tbob,

i need to count the number of cycles from a controller (it controls a valve). i'm getting sinwave which runs only in +ve direction.

i need to count the number of cycles it produce.

in this case the signal is always +ve and so no zero crossing. how can i do this?

many thanks in advance

Renn

Message Edited by RENN on 02-09-2009 10:14 AM
Kudos always welcome for helpful posts 🙂
Message 11 of 15
(1,820 Views)

## Re: how to count the number of cycles in sine wave

Finding the number of cycles does not have to depend on zero crossing.  It uses the midpoint crossing.  If you read my last post you will see this.  If your signal goes from 1v to 5v, the midpoint is 3v.  Count the number of times the signal crosses 3v in one direction.  Or count the number of times it crosses 3v in both directions and divide that number by 2.  This will give you the number of cycles in a signal.

- tbob

Inventor of the WORM Global
Message 12 of 15
(1,782 Views)

## Re: how to count the number of cycles in sine wave

Hi RENN,

What kind of DAQ card are you using? Let's just assume you have an M series DAQ board, in which case you support analog triggering. If you set up an analog level trigger and set the level to whatever your midpoint voltage is (like our friend below mentioned), then the analog triggering circuitry in your board will create a pulse in hardware that occurs every time your input sine wave crosses that voltage level. This internal pulse signal is called the "AnalogComparisonEvent." You can find more information about this signal here. We can use this signal as the source of a Counter Input pulse tick count task. I've attached a quick VI that I wrote to do this. I tested this with success on my PCI-6251. I hope this helps.

Chris W

Message 13 of 15
(1,760 Views)

## Re: how to count the number of cycles in sine wave

Dear Tbob

I would like to thank you for your efforts with other LabVIEW users. I am also a new user and I would like to ask a question which is kind off similar. I am using this VI (which is attached) and I would like to control the number of cycles of the generated wave (sine, sawtooth, square, Triangle).

How can I modify the VI to do this task?

Best Regards

Fasial

Message 14 of 15
(1,156 Views)

## Re: how to count the number of cycles in sine wave

Hi FaisalF,

This is a pretty old thread. Can you please create a new thread? You are more likely to get more traffic and responses on a new thread.

Thank you,

Catherine B.
Applications Engineer
National Instruments
Message 15 of 15
(1,120 Views)