Bit of Background: I am currently working with my ATX Power Supply and trying to re-purpose it to use its voltage outputs (3.3V, 5V and 12V). But I would like to have a PWM feature with my power supply when I complete it. For this purpose I am thinking to use Attiny85 and use it's fast PWM mode to generate what I need. I need a PWM signal whose duty cycle and frequency can be varied through the use of potentionmeter.
Problem:Link to datasheet Going through the datasheet, I figured out that it is possible to vary the duty cycle as I want through the manipulation of Output Compare Register (OCR). But I can only vary frequency in pre-determined values. Varying the clock prescale factor does the basic job. But what I want is PWM with frequency I can adjust with a potentiometer as I want (within the supported range of course).
Possible way for solution from my study: I came to the CTC mode in which I can vary the frequency by changing the values in OCR. But this would limit the duty cycle varying feature. So, I wonder if there is any way to combine these two modes.I came to this thread where the question deals with varying frequency only but not the duty cycle.
I can do the basic operation of generating the PWM with fixed frequency. Although, I went through the registers involved in generating PWM, I can't scrap any idea to generate the PWM I wish for.
This is basically what my primary problem is. I would love some recommendations from this community about what I could add to the features of my power supply. Thanks for the help.