ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Square wave frequency & trigger

Dear developers,
 
I am fairly new to Labview programming so forgive me if this question or something similiar has already been asked.  I am using Labview 7.1 with a USB 6009 DAQ.  I am using a light beam break sensor to monitor the rotational position of a shaft via a slotted disk.  The slotted disk has 3 adjacent slots joined together as a larger hole, one edge of which denotes an important rotational position (BDC).   The output signal is therefore a square wave (0v to 12v) with a larger (0v) gap.
 
It would be brilliant if I could capture and record the rising edge of the gap as it would give me a reference point and would allow me to calculate a revolution time and hence frequency.  As well as this I would like to be able to calculate the rotational position of the shaft using each rising edge with reference to BDC.  So for example 1 rising edge after BDC equals 6 degree rotation, 2nd rising edge is 12 degree rotation etc..  I would then need to reset back to 0 at each BDC.
 
I hope that is clear.
 
Any help will be much appreciated
 
Many thanks
 
Daniel Easton 
0 Kudos
Message 1 of 4
(3,304 Views)
Daniel,

I'm not 100% sure what you question is?

Are you able to acquire the signal already? If not, I would recommend looking at some of the DAQmx examples available by going to Help>>Find Examples within LV.

Something like Cont Acq&Graph - Int Clk.vi should allow you to start reading data.
0 Kudos
Message 2 of 4
(3,286 Views)
I am acquiring the square wave signal on the DAQ6009 analog input channel at 2kHz.  I can plot a graph of the data so I am sure the incoming data is correct.

I have 2 problems:

1) How do I get the frequency?
2) How do I count the rising edges of the wave?

Many thanks

0 Kudos
Message 3 of 4
(3,286 Views)
A nice function that will allow you to find the rising edge would be the peak detector.vi or the Threshold Peak Detecor.vi, try doing a palette search for this.

Frequency measurements can be done in a varierty of ways depending on the accuracy needed. For example, you could use the time stamp information to find out the period of a signal, and then do a simple 1/t to find out the frequency. The are hardware methods that would give you an accurate reading, but this can invlove using two counters/analog triggering, which isn't available on you r particular low cost device.
0 Kudos
Message 4 of 4
(3,275 Views)