hello,
i know that's about timers, i don't understand how to swich 15625khz pwm and what is 0x07, 0x01, 0x03, 0x02(may be the setting of the divisor?), i see as well 9 bit pwm, how to change the mode from 8 to 9bit.
if it exist some tutos, it's gonna be great.
// switch to 15.625kHz PWM
TCCR1B &= ~0x07;
TCCR1B |= 0x01; // no prescale
TCCR1A &= ~0x03; // 9-bit PWM
TCCR1A |= 0x02;
thank u
you might want to start here :
http://forum.arduino.cc/index.php/topic,16612.0.html
as for timers:
http://playground.arduino.cc/Main/TimerPWMCheatsheet
as for what does 0x01 mean ? depends on the pin it is connected to. and of course if you are using the mega or uno.
this is from the timerpwmcheatsheet, please read that whole page to understand the chip/board being described.
Pins 5 and 6: controlled by Timer 0 in fast PWM mode (cycle length = 256)
Setting Divisor Frequency
0x01 1 62500
0x02 8 7812.5
0x03 64 976.5625 <--DEFAULT
0x04 256 244.140625
0x05 1024 61.03515625
TCCR0B = TCCR0B & 0b11111000 | ;
Pins 9 and 10: controlled by timer 1 in phase-correct PWM mode (cycle length = 510)
Setting Divisor Frequency
0x01 1 31372.55
0x02 8 3921.16
0x03 64 490.20 <--DEFAULT
0x04 256 122.55
0x05 1024 30.64
TCCR1B = TCCR1B & 0b11111000 | ;
ok, thank u
he's using pin 9 and 10 , how to switch to 15625khz from an arduino nano?
Hello,
here is the code:
http://www.instructables.com/files/orig/F84/2AP0/GI0TG1L8/F842AP0GI0TG1L8.txt
if somebody can explain me, particulary this
TCCR1B &= ~0x07;
TCCR1B |= 0x01; // no prescale
TCCR1A &= ~0x03; // 9-bit PWM
TCCR1A |= 0x02;
of course!
but i want explanations
Didn't you read reply #1?
of course yes, but how to achieve 15625ktz, moreover in this code there aren't binarymask.