How to adjust Arduino PWM frequencies
Pins 5 and 6:
Setting | Divisor | Frequency |
---|---|---|
0x01 | 1 | 62500 |
0x02 | 8 | 7812.5 |
0x03 | 64 | 976.5625 |
0x04 | 256 | 244.140625 |
0x05 | 1024 | 61.03515625 |
TCCR0B = TCCR0B & 0b11111000 | <setting>;
Pins 9 and 10:
Setting | Divisor | Frequency |
---|---|---|
0x01 | 1 | 31250 |
0x02 | 8 | 3906.25 |
0x03 | 64 | 488.28125 |
0x04 | 256 | 122.0703125 |
0x05 | 1024 | 30.517578125 |
TCCR1B = TCCR1B & 0b11111000 | <setting>;
Pins 11 and 3:
Setting | Divisor | Frequency |
---|---|---|
0x01 | 1 | 31250 |
0x02 | 8 | 3906.25 |
0x03 | 32 | 976.5625 |
0x04 | 64 | 488.28125 |
0x05 | 128 | 244.140625 |
0x06 | 256 | 122.0703125 |
0x07 | 1024 | 30.517578125 |
TCCR2B = TCCR2B & 0b11111000 | <setting>;
All frequencies are in Hz and assume a 16000000 Hz system clock.