Arduino Forum

Products => Arduino Due => Topic started by: umutgemisi on Mar 19, 2019, 09:48 pm

Title: Arduino-FreqPeriod-Due
Post by: umutgemisi on Mar 19, 2019, 09:48 pm
hi friends

https://github.com/enternoescape/Arduino-FreqPeriod-Due/blob/master/Examples/FreqPeriod/FreqPeriod.ino

Are there any friend before used that library. its perfect one frequency counter but i need 2 counter anyone knows how can i count second frequency on other pin same time on Due? i search forum no topic about that.  Thanks  :smiley-roll:
Title: Re: Arduino-FreqPeriod-Due
Post by: ard_newbie on Mar 20, 2019, 07:35 am

To measure frequency and duty cycle of input signals, Timer Counters in Capture Mode is the way to go (see TC_CMR register page 881 Sam3x datasheet).

AFAIK, tc_lib library from antodom does just that, although I don't know if you can select 2 input capture pins at the same time with that library. Give it a try .....
Title: Re: Arduino-FreqPeriod-Due
Post by: umutgemisi on Mar 20, 2019, 06:15 pm
i will check it thank you
Title: Re: Arduino-FreqPeriod-Due
Post by: antodom on Mar 21, 2019, 01:40 pm
Hi there @umutgemisi,

As ard_newbie has commented you can use library tc_lib just for measuring digital signals.

You can find tc_lib at: https://github.com/antodom/tc_lib (https://github.com/antodom/tc_lib)

@HermannSW (thansk HermannSW) has already done some testing to know the limits of tc_lib. In this post you have a summary:

https://forum.arduino.cc/index.php?topic=393842.msg3086694#msg3086694 (https://forum.arduino.cc/index.php?topic=393842.msg3086694#msg3086694)

I think they can help you to have a better idea about tc_lib, they report measurements of signals with frequencies greater than 20Mhz.

As to if tc_lib can capture different signals in different pins simultaneously, it can, just have a look to the library's documentation.

I hope it helps.