ΣSigmaStudio Ask AI Русский Log in

selecting only the positive-going zero crossings of a sine wave

SigmaDSP & SigmaStudio philipj451 Oct 21, 2021 00:00 2 replies Original on forum ↗
Subscribe
philipj451 Question
Oct 21, 2021 00:00

Hi,

I am using an ADAU1452 and want to generate a "gated" sine wave as a test signal. That is 'A' cycles of sine wave then 'B' cycles of silence.

I can use the "Value Cross Detection" block from Basic DSP->Logic to pick out the zero crossings of the sine waves and then count the pulses output by this block to switch an "Index Selectable DeMux" turning the wave on and off. But the "Value Cross Detection" picks out both the positive going and the negative going crossings so I am actually counting half-cycles which is OK except for the gated waveform arbitrarily starts with the positive or the negative part of the sine wave and I want it to always start with the positive.

This is my current circuit, sorry it's only a bitmap but it's part of a considerably larger design. Suffice it to say, the Hin on the left is a 1kHz sine wave coming from an oscillator block and Hout on the right takes the gated sine wave out to be processed through the system and out of a DAC.

Can anyone suggest a clever way to only detect the positive going zero crossings of the sine wave ?

Thanks in anticipation of any advice offered

PhilipJ

Audio Signal Processors

adau1452

SigmaDSP Audio Processors

pastedimage1634823525419v1.png
pastedimage1634823525419v1.png
KJBob Reply
Oct 21, 2021 00:00

Hello Philip,

It would be wonderful if ADI made a unidirectional version of the Value-Cross Detector. It seems like every time one is needed I have to add stuff to make it respond only on a rising signal. Here's the way I've been doing it:

Comparator ABCD1 gates the Value-Cross Detector output only if the present input sample is more positive than the previous one (thus a rising signal). The 1001 Hz oscillator, Value Hold and Real-Time Display are included merely as a test. The Value Cross pulses gate the Value Hold at a 1 kHz rate, allowing the 1001 Hz sine wave to show as 1 Hz on the Real-Time Display. It's a sort of equivalent-time sampling. If the circuit didn't work and thus the Value Crosses were coming in at 2 kHz, the display would have been unreadable.

Best regards,

Bob

Z-cross-rise-1452_sch.png
Z-cross-rise-1452_sch.png
philipj451 Reply
Oct 23, 2021 00:00

Hi Bob,

I managed to get mine to work with a" zero crossing" and a "greater than 0" AND'ed together but later I realized that this would not be totally reliable as not every waveform would guarantee to contain a sample that was actually equal to zero.

Your solution is perfect so thanks for the reply

PhilipJ