10-bit PWM possible? #539
-
Hi, I'm currently on a project where i want to fade some LEDs and since fading LEDs with an 8-bit PWM is a bit meh, i searched for possible workarounds. I found this instructions how to boost the resolution to 10bit (or even 12) on an ATtiny85 device. i guess something similar should be possible with the ATTiny1614, but I'm not sure how this will interfere with megaTinyCore functionallity. Thanks in advance |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
There's an example in here for 16-bit PWM: https://github.com/SpenceKonde/megaTinyCore/blob/master/megaavr/extras/TakingOverTCA0.md |
Beta Was this translation helpful? Give feedback.
-
Uh, you can get 3 channels at up to 16-bit as demonstrated in that example. Unfortunately those examples aremdated. They are missing an important bit: You want to call takeOverTCA0(); before you start reconfiguring the timer. This prevents calls to digitalWrite() from turning off PWM on the wrong pins. You can also with much more work, get 2 channels of 12-bit PWM on two specific pins from TCD0, assuming you're not using it for millis (programming that one is an adventure for sure) |
Beta Was this translation helpful? Give feedback.
Uh, you can get 3 channels at up to 16-bit as demonstrated in that example.
Unfortunately those examples aremdated. They are missing an important bit:
You want to call takeOverTCA0(); before you start reconfiguring the timer. This prevents calls to digitalWrite() from turning off PWM on the wrong pins.
You can also with much more work, get 2 channels of 12-bit PWM on two specific pins from TCD0, assuming you're not using it for millis (programming that one is an adventure for sure)