changing pwm

I have a mega 2560. I was wondering if you can change the pen frequency without affecting anything else. I've searched and found that in can stop millis() and other things from working right. Is this true? I am using millis in my program and cannot do without it. Is what I found true?

Thanks .

Each of the timers can control two PWM pins. You can certainly use the timers independent of the analogWrite() library to generate a wide range of PWM frequencies. What frequency do you want?

johnwasser:
Each of the timers can control two PWM pins. You can certainly use the timers independent of the analogWrite() library to generate a wide range of PWM frequencies. What frequency do you want?

Well not exactly - on the Mega some timers control 3 pins. Here's the mapping I gleaned from the datasheet of ATmega1280/2560:

timer0: pins 4, 13
timer1: pins 11,12 [ and 13 but analogWrite only uses timer0 for this pin ]
timer2: pins 9, 10
timer3: pins 2, 3, 5
timer4: pins 6, 7, 8
timer5: pins 45, 46 [ and 44, but analogWrite doesn't support this pin ]

Double check this though, I might have got something wrong.

millis() etc use timer0, so don't change that one.