I would like to use a sketch that was created for an Arduino Nano on a Nano Every, but some parts are not compatible due to the different microprocessors they use. Does anyone know the equivalent of the following Nano registers for a Nano Every:
That code programs the timer to produce PWM of a certain frequency on some pin. Unless you need that certain frequency, use the builtin analogWrite() function to produce PWM.
There won't be a one-to-one translation for that code, no matter what you do. It is absolutely specific for a 16 bit timer on an ATmega328 or similar processor.
You will have to read the data sheet and learn how to program the timer to produce that required frequency. There may be a tutorial on line.
Timer setup on the ATmega4809 bears little resemblance to those on ATmega328 or similar, and there are some major drawbacks, e.g. "there is only one prescalar setting and it is shared across all timers".
Ah. You're right. It's the SAMD series that has TC and TCC timer.
Atmega4809 has TCA and TCB timers.
TCA looks quite powerful up to six 8-bit compare outputs, and separate "period" register. TCB, not so much - only one compare channel (but it still has a separate period register.) (the big "problem" with TCB is that it's tied to the same clock input as TCA, so you can't run them completely separately.) (well, you can also use a very fast clock - CLK_PER/2)