Showing results for 
Search instead for 
Did you mean: 

Count Signal Pulses & Use Count Value to Change Wave Phase

Go to solution


I am a very, very new user to LabVIEW (just installed and had my first contact with it 2 days ago) and had a question about my application and its implementation. My project objective is to record images of the combustion of a fuel droplet forced by typical car speakers at a forcing frequency of 1500Hz in a phase locked fashion. This is done using a camera with phase locking capabilities which depend on the input signal given.

The camera I am using takes as an input a square wave signal (2.5V Amplitude, Offset by 2.5V, Duty Cycle ~3%, f = 1500Hz) that controls when the camera gate opens. Each image exposure is composed of 255 gate openings, so recording one image will require producing a square wave signal with 255 periods at a frequency of 1500Hz. The speakers output is measured using a pressure transducer and registers as a sinusoidal pressure signal, again with a forcing frequency of 1500Hz. The goal of the experiment necessitates that we take 24 consecutive images, with each new image being taken at 15 degrees of phase difference with respect to the the former (so, the first image is taken at a phase of 15, the next at a phase of 30, the next at a phase of 45...). A sample of the input camera signal and the pressure signal phase locked at approximately 90 degrees is attached.


I am trying to implement a VI in LabVIEW that can create the camera input waveform with a phase value that can dynamically change depending on how many pulses have been generated. So far I have been using the Simulate Signal Express VI to test this, but have not figured out how to count the number of peaks in the signal OR a way to change phase dynamically based on whether or not a counter has reached a particular value (255 in my case). I am noting that I need to do this phase changing without having to stop and start the VI because the combustion process I am studying cannot be sustained for a long period of time. 

I'm not sure if this type of topic has been covered, but if it has I will be thankful if anyone can lead me to it. I am using LabVIEW 11.01 with the NI-USB 6251 board. Thank you very much for any assistance.


0 Kudos
Message 1 of 5
Accepted by topic author sevilla952

Hi sevilla952,


The application that you said you would like to implement is too specific for a Express VI, specially because each iteration of the Express VI will open, generate, write and close the task, and that is exactly what you don’t want: stop the task and start a new one.


I’ll recommend you to use this example VI’s as those are able to change parameters each iteration without closing and restarting the task:


Multiple Channel Analog Output with Dynamically Updated Waveform Attributes


I hope this helps,


Message 2 of 5

Thank you for directing me to this example, I think a good portion of what my application will require can be derived from a modification of this kind of VI. All I would need now would be a method of measuring when the number of peaks in my input signal reaches 255 to update the phase parameter dynamically. Would you (or anyone else) know an efficient way to perform this? Again, your help is very much appreciated. 


0 Kudos
Message 3 of 5

Hi sevilla952,


There are a couple of functions in LabVIEW that you can use to detect peaks, for exampel the Peak or the Peak Detector or Waveform Peak Detection.VI.


0 Kudos
Message 4 of 5

Thank you very much for your assistance in this problem, your help was very much appreciated. The VI I am implementing is working fairly well, now the recording system needs some tweaking for our pressure measurements to be recorded correctly 🙂  

0 Kudos
Message 5 of 5