Pwm Frequency change


hello
i using pwm pins driving laser diodes, need operate them on same frequency.i.e 490 hz. how can set timer 0 frequency value? saw prescaler values providing me values of 980 hz value 3, , 244 hz value 4. want operate on 490 hz. how can achieve value on timer 0 pins on arduino mega 2560?
thanks :)

i don't know of simple solution. can use 1 timer generate frequency (using tone(pin,490)?), affects pwm generation on pins 3 , 11, perhaps not in intended way. route frequency timer create pwm signal of intended duty cycle. or use "phase (and frequency) correct" pwm modes, compare registers set appropriate values.

modifying timer 0 frequency affect timing of many other functions, including millis(). better use 1 of other timers.


Arduino Forum > Using Arduino > Project Guidance > Pwm Frequency change


arduino

Comments