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

How to sample a periodic waveform at given points in the period?

SigmaDSP & SigmaStudio Dan_GasData Oct 8, 2014 00:00 2 replies Original on forum ↗
Subscribe
Dan_GasData Question
Oct 8, 2014 00:00

I'm using a ADAU1701 on the mini-eval board. I'm creating a periodic function (T = 100ms) and I want to know the values at two given points in the period every time it repeats (specifically 34.8 and 41.4ms into the period).

Does anybody know how to go about doing this? I've tried delays combined with sample and hold, but how would SigmaStudio know to delay from the start of each new period?

Audio Signal Processors

sigma studio

SigmaDSP Audio Processors

adau1701

KJBob Reply
Oct 8, 2014 00:00

Hello Dan,

It sounds like you're on the right track. I imagine that we can define the input waveform's period as beginning when it crosses zero while rising -- like setting your scope's trigger for zero level, positive slope. Resetting a counter at this moment, we can count time until your desired delay has been reached. At that point a hold block captures the present reading. In SigmaStudio there's often more than one way to implement such an arrangement -- one example is shown below:

The Value-Cross Detector block outputs for both rising and falling levels -- thus we need to gate it for rising input only. The short FIR filter shown takes the average of the previous four samples. When the input is crossing zero while rising, this average should be negative -- then comparator ABCD1 allows the Value-Cross pulse through to reset the Stop Watch. This counts samples until reset at the next period. In the meantime, the two desired measurements are frozen by the remaining blocks.

I have this running at 96 K samples / second to provide more time resolution -- for info on setting sample rate on a ADAU1701, see FAQ: How do I change the sample rate of my SigmaStudio system? Accuracy appears to be about three digits worth -- for the result at T1, a sine wave at 34.8% into its period should read about 0.816.

Best regards,

Bob

3225.a83365be8d057edbc264ca5793cd5135.png
3225.a83365be8d057edbc264ca5793cd5135.png
3225.a83365be8d057edbc264ca5793cd5135.png-620x478.png
3225.a83365be8d057edbc264ca5793cd5135.png-620x478.png
Dan_GasData Reply
Oct 9, 2014 00:00

Thanks Bob.

That is exactly what I needed. I modified it slightly to take the count from a clean signal and read the data from a different one (my data signal is a bit messier and could cross zero a few times per period).

Thanks again for replying so quickly and providing your code.

Dan