Hi,
I have to thank for that great software!
I am developing AVR programs in Assembler and Pascal and a little C.
I've boght the pro version of Flowcode for AVR to develop applications faster and learn C too.
I managed to do some simple programs in no time at all, but I am stuck with a problem:
I want to do a PWM with variable frequency but no success.
I am using ADC0-value to change the Frequency... I've defined the DutyCycle for ~50%.
I can change the frequency, but the DutyCycle is changing too.
How can I achieve to vary the frequeqncy without changing the DutyCycle?
My best regards
Vidor
Variable frequency
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Variable frequency
Hello Vidor
Please could you send me your program and ill try to find out whats going wrong. My email is ben@matrixmultimedia.co.uk
Please could you send me your program and ill try to find out whats going wrong. My email is ben@matrixmultimedia.co.uk
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Valued Contributor
- Posts: 548
- Joined: Tue Jun 26, 2007 11:23 am
- Has thanked: 6 times
- Been thanked: 44 times
Re: Variable frequency
The PWM duty period and cycle period are both controlled seperately and regulated by the selected clock source. If the cycle period is to be changed, but the duty cycle is to be maintained, the duty period must be recalculated (based on the new cycle period).
An alternative method is to select different prescaler settings (5 settings available) or use an external, variable clock source, possibly using Timer2.
An alternative method is to select different prescaler settings (5 settings available) or use an external, variable clock source, possibly using Timer2.