Post Go back to editing

Timer with ABCD comparator

FormerMember
FormerMember

Dear Team ,

I have a concern regarding the ABCD comparator and timer with stop start and reset control on Sigma Studio GUI 

I am trying to compare two sine waves ,one with some decay and the other with a normal fixed amplitude for the entire length of time.

After I feed these two inputs to an ABCD conparator,I would like the output of the Comparator to send a 1 until and unless the sample value in pin a is less than sample value in pin b but once the reverse happens I would want the timer to be stopped by the 0 output of the Comparator and hence stop counting any further samples once the decay is over . However I am not getting fruitful results .

Can anyone help 

  • FormerMember
    0 FormerMember

I wonder why the forum appears so inactive these days ...

No reply ...

Can I get some helpful suggestion or insights on this asap please

  • Would you please say which processor you are using? Also, if you could post a project or screen shot of what you have tried, that would be very helpful. Lastly, I'm assuming that your two signals are in phase. Otherwise, you would need to use some sort of envelope or RMS detector.

    Ken

  • FormerMember
    0 FormerMember in reply to Ken.M

    Dear Ken 

    I am using ADAU1452 

    1. And I'm feeding the comparator pins a and b from a single sine tone generator .The ony difference is that pin a received the input from the tone generator after passing through a SW Volume Control (RC optimized) while pin b receives the input directly from sine tone generator with no module in between 
    2. I understand that the slewed signal samples will be smaller in amplitude than  the original sine -10dB samples and hence I would like the timer to count only these samples which are less or different and feed it to the ReadBack cell
  • FormerMember
    0 FormerMember in reply to Ken.M

    Dear Ken ,

    I do not understand what keeps you from responding but I will assume you must be busy but please provide support on this asap.

    I am using a SW Slew Volume Control .

    At default condition if you set the slew rate as 6 or 7 or any value the signal fades in until it reaches your input level ...

    I would want a circuit to count the exact number of this faded samples ....

    From the formula BoB outlined I get a value of a out 25ms when slew rate is set as 8 but from my several trials with different test projects I can never really get the ReadBack cell to read expected values that come from the formula 

    TC= we 10*[2^(n-9)] where n is the slew value 

  • You have opened a couple of posts of posts so I will do my best to answer them both here. Bob (not an ADI employee) was kind enough to send an example project. Did that provide any guidance? As I said, I am not able to comment on your project without more information. There are lots of ways that you may have tried to implement this. Please post the project(s) that you have created so far, and I will try to guide you. 

    It appears that you are interested in tracking the envelopes of signals rather than the instantaneous values. You will need to use an envelope detector to do this effectively. It does not sound like you have implemented this advice. Even with the tones in phase (same oscillator), if you are passing the signal through a volume control with slew, it is entirely possible that the signal with gain is remaining one LSB or more below the direct signal. I would recommend that you add a small constant before the comparison to provide a little hysteresis. Try replacing the slewed volume control with a gain block that you can better control numerically. A gain of 1 in the gain cell should give the exact same signal. 

    Readback cells do not provide instantaneous values of variables. They are literally "read back" from the DSP to the SigmaStudio GUI by polling the SPI (or I2C) port with the USBi. Since this polling is statistical, you are unlikely to catch the exact peak of a sine tone, for example.

    I am assuming that your slew questions are only tangentially related to your sample counting question. Details on the hardware slew may be found in this post and downloaded here. The equations for the hardware slew are more rigorous than for software slew. If you need exact time constants, I suggest you take advantage of the hardware.

    Ken

  • FormerMember
    0 FormerMember in reply to Ken.M

    Dear Ken ,

    I understood your concerns . Let me start by explaining what I want and what is my progress 

    Firstly I am unable to zip up a project here so I'm attaching an image file ..that should do the job just fine( sorry to bother you )

    Coming to the point :    

    I am using the SW Slew Volume Control and by default when the DSP comes out of reset the Volume Control fades in your signal based on the Slew rate setting in the Sigma Studio GUI .

    For convenience let's say I set this slew rate as 8 .

    For a slew rate of 8 from the formula provided by BoB ,I expect a time constant of 25 ms,(in other words my fade in time is 25 (ms )assuming a full slew of 99% ) this time is what I want to calculate using Sigma Studios module such as an ABCD comparator and Readback cell.

    Now what I have done and what will be evident from the image to you is that 

    I have used an inbuilt oscillator and fed it to a volume control and then to an envelope detector 

    From Bob's fantastic idea I am trying to compare the same slewed signal with a 2 ms delayed version of itself and count the number of samples as long as they differ from each other .

    As you suggested I have used a gain block and set it to a linear value of 1 since my sine tone input is 0dB and hence that is the maximum value attained by my signal after fading in .

    I assume that once both the signal reaches 1 the timer stops and the counting is over the ReadBack cell should show u the number of faded samples 

    Am I correct ? Can you suggest what I could be doing wrong 

    P.S- I am not setting any value in the envelope detector since I don't want the decay rate of the detector to interfere with my counting results 

    Regards

    Hermione 

  • FormerMember
    0 FormerMember in reply to Ken.M

    Dear Ken 

    Can you please provide support .

    It's quite important at the moment 

  • Hello  and ,

         In an attempt to help with this I entered Hermione's screenshot into SigmaStudio.  The project does provide a readout although the delay idea doesn't provide consistent results over a range of slew settings.  I also tried a more explicit version, simply comparing the level after the Slew Volume with 0.99 x the level before it.  IK would like to attach both projects to help save time for all.  I'll ask Lisa in EZ Support to do this for me, since my ability to attach files has once again quit on me.

         BR,

         Bob

    Please see the zip file below:

    Slew-sine-delay-ABCD.zip

  • P.S- I am not setting any value in the envelope detector since I don't want the decay rate of the detector to interfere with my counting results

    Note that the setting of the envelope detector are critical here. You are no longer measuring the volume slew. You are measuring the envelope slew. Play with the parameters in this project a little. I've slowed everything down and increased the delay to half a cycle so you can see the waveforms. Open up and all of the plot windows and change the time constant, hold and decay settings. This will help you get a feel for what is going on,

    Ken

     /cfs-file/__key/communityserver-discussions-components-files/396/Envelope-Example.zip

  •      Thanks, Lisa!

         With the projects attached, now I can explain them.  The comparison of the levels before and after the Slew Volume does give a result compatible with the 99% criterion being approx. five time constants.  Perhaps this is all that's required -- if so, then really, Hermione has figured out his own solution.  The projects I have been sending him are rather more complex, because I began to understand (perhaps mistakenly) that the Slew Volume was a proxy for his actual application, still unknown to me.  Thus I had included automatic hold & reset functions for the count as well as other ideas, including the delay one.

         Best regards,

         Bob