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

Button Index Counter with Square wave input

SigmaDSP & SigmaStudio campus May 5, 2020 00:00 2 replies Original on forum ↗
Subscribe
campus Question
May 5, 2020 00:00

Dear all,

I encounter a strange behaviour of the button index counter. I assumed that each time the orange input pin gets high, the output pin increases by one index valueuntil the max count is reached and then resetted to zero. But it seems to output nothing plausible. When I feed the block with a square wave input (that toggles between 0 and 1) with max index count = 3 I assume that the output counts up with the frequency of the square wave. But It does not output anything only when I increase the sqaure wave frequency. I´ve looked at lots of examples (e.g. https://ez.analog.com/dsp/sigmadsp/w/documents/5179/how-do-i-use-a-gpio-button-to-select-different-audio-processing-paths) and find also a strange behaviour with the example of the FAQ:

===Example===
This example shows a Toggle Counter counting a 50 Hz square wave's rising edges. Note that the counter starts at zero, so in this case the counter will go from 0 to 99, resetting every 100 rising edges. Since there are 50 rising edges per second, the Toggle Counter will reset itself to zero once every 2 seconds.

It´s true that the counter resets to zero every 2 seconds but the corresponding readback value in counts between 0 and 6 (28.0). I would assume that it counts from 0 to 99 every 2 seconds.

What am I missing?

Thanks in advance!

index-counter.png
index-counter.png
KJBob Reply
May 5, 2020 00:00

Hello campus,

Are you working with the ADAU1701? This DSP's readback register drops the lowest four bits, in effect dividing any "28.0" (integer) reading by a factor of 16. Since 99 / 16 = 6.18, this would explain your result not exceeding six. Multiplying by 16 as shown below yields an accurate integer readback:

On the other hand, drawing your example into a ADAU1761 produces a schematic which more closely appears like the example -- thus the example might have been run on a -1761, which is equipped with a proper 28.0 readback:

Best regards,

Bob

T-Count_1701-sch.png
T-Count_1701-sch.png
T-Count_1761-sch.png
T-Count_1761-sch.png
campus Reply
May 15, 2020 00:00

Dear KJBob,

Thank you for your fast reply. This was exactly what I´ve been looking for :-) Yes, I´m working on the ADAU1701. Thanks for helping me out.

Best regards