Closed GoogleCodeExporter closed 9 years ago
How close is it? Can you include a screen capture or picture of the waveform on
your O-Scope? I'm unable to replicate this. My scope shows a close-to square
wave. At faster frequencies (above 1khz/below 1mS) the timing get's less and
less accurate. See issue 1 for more info why:
http://code.google.com/p/arduino-timerone/issues/detail?id=1
Original comment by lex.v.ta...@gmail.com
on 1 Feb 2012 at 5:50
[deleted comment]
Hi. The scope was malfunction... Now that I replaced it, everything works fine.
Thanks.
And, this instructins also work well:
/*
TCCR1A = _BV(COM1A1) | _BV(COM1B1); //activates the output pins
TCCR1B = _BV(WGM13) | _BV(CS10); //phase and frequency correct pwm mode, prescale by /1
ICR1 = 4000; //(16*10^6)/(2*1*4000) = 2000 Hz -> T = 0.5 ms
OCR1A = 2000; //float dc = (dCyclePerc/100)*4000; OCR1A = dc;
//OCR1B = 2000; */
TCCR1A = 0b10100000;
TCNT1 = 0x0000;
TCCR1B = 0b00010001; //phase and frequency correct pwm mode, prescale by /1
ICR1 = 4000; //(16*10^6)/(2*1*4000) = 2000 Hz -> T = 0.5 ms
OCR1A = 2000;
OCR1B = 30;
/*
TCCR1A = _BV(COM1A1) | _BV(COM1B1) | _BV(WGM11); //activates the output pins
TCCR1B = _BV(WGM13) | _BV(WGM12) | _BV(CS10); //fast pwm mode, prescale by /1
ICR1 = 7999; //(16*10^6)/(1*(1+7999)) = 2000 Hz -> T = 0.5 ms
OCR1A = 4000;
//OCR1B = 4000;*/
/*
TCCR1A = 0b10100010;
TCNT1 = 0x0000;
TCCR1B = 0b00000010; //phase correct pwm mode 9 bits, prescale by /8 -> (16*10^6)/(2*8*511) = 2000 Hz -> T = 0.5 ms
OCR1A = 256;
//OCR1B = 256;*/
Original comment by xpeoxove...@hotmail.com
on 12 Feb 2012 at 1:37
Whew! Good tools make all the difference.
Original comment by lex.v.ta...@gmail.com
on 12 Feb 2012 at 4:10
Original issue reported on code.google.com by
xpeoxove...@hotmail.com
on 30 Dec 2011 at 3:16