FreqCount/FreqMeasure on Arduino Mega2560

Status
Not open for further replies.

APK96

New member
I just wanted to know if someone can tell me if the FreqCount and FreqMeasure libraries, really can't be used with more than one or at least on different pins than 47/49 on an Arduino ATMega2560?
I already did research the topic, but just couldn't find any understandable/consistent information. By my (VERY limited) understanding there would be enough timers available to take more than 1 measurement, but I have no idea how I would have to modify the library to do so.

I would be very grateful, if someone could help me on this matter.

Best regards
 
There is the FreqMeasureMulti library which can be used on actually up to 8 pins simultaneously, I'm currently working on a new version which can be used on up to 20pins simultaneously. But all that code is optimized for the very performant Flextimers of the Teensy 3.x processors and their powerful 32bit CPU.

I don't think that it's a good idea to do new developments on slow 8bit legacy CPUs like the ATmega2560 nowadays. There is no advantage in their limited capabilities and they aren't cheaper. Thus, why driving a Fiat 500 if you can have a Volvo V70 for the same price?
 
FreqCount and FreqMeasure are each designed to measure just one signal. They use different timers, so it should be possible to run both (each measuring 1 signal) on Arduino Mega.

Each requires a 16 bit timer to measure the signal, and FreqCount also requires an 8 bit timer. So if it weren't for the single-signal design of their code, in theory the '1280 AVR chip ought to be able to measure up to 4 signals. However, the Arduino Mega circuit board is designed with many of the chip's pins not connected to any of the user-accessible pins on the board. Two of the 4 timers specific pins can't be accessed, unless you solder wires directly to the chip's pins. So even if you redesigned these libraries to support multiple instances, Arduino Mega could only be used for up to 2 measurements with its accessible pins.

FreqMeasureMulti of course is the best answer, but it requires the more capable hardware of Teensy LC or 3.2.
 
Thank you both for your fast answers and to even receive an explanation from the author of the library is more than I could've ever asked for!
I really appreciate this forum's helpful community!
 
Status
Not open for further replies.
Back
Top