I would like to count how many times my signal goes to zero. For example having an impulse signal as input I want a variable which counts how many times the impulse goes to zero.
I´m becoming crazy thinking of something....can anybody help me? Thanks
figure 1 is a pulse counter model
and figure 2 is scope output which shows for 5 input pulses we get counter output as 5
There is a similar question here that might help. There are loads of ways to implement a counter, but a good way I've used before is to use a rising/falling edge detect. I don't have the library on my computer so I can't test this Edge Dectector but I've used one similar in the past for just this problem. It will output a single sample time impulse when it detects a given condition, which in your case would be a signal going to zero. You can then use with a memory block and an add to implement a counter. See below:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With