HQ, good to see you around!
Timer/Counter A and B are both 16 bit. Timer/Counter D is 12 bit. The advantage of using TC-D is the ability to have clocked separately from the main CPU clock. While it could have many applications, I feel like the main benefit for us would be to use the 32 kHz ultra-low-power clock for the main CPU and then we could still use PWM at a high rate without the CPU sucking up a lot of current. For the sake of comparison, say you wanted a 10-bit PWM (1024 steps) and a fast PWM rate (like 19 kHz). Using TC-A, the main clock would need to run at the full 20 MHz and the MCU would be drawing ~10.6 mA. But if we used TC-D and ran the main clock at 32 kHz, the MCU would only draw around 970 uA (less than 1mA). If we used this for moon levels, it could greatly extend runtime.
In choosing pins, there’s quite a bit of flexibility. I typically refer to the two charts shown below (from the datasheet).
Some things worth noting:
- TC-A is 16-bit and normally has 3 compare outputs: WO0, WO1, and WO2. But you can run TC-A in split mode which gives you 6x 8-bit compare registers WO0-WO5.
- TC-D technically has 4 output pins, but WOC and WOD (if enabled) generally mirror WOA and WOB… they’re not configured independantly
- I haven’t played with the multiplexing much, but yes… there are certain functions that can be re-routed to other pins (as noted below)