Bump. Anyone know if 140z is possible with the internal timer.
I may be misreading this but in fast pwm mode, OCR0A controls the period.
PWM with 2ms period and 10% duty
Configure timer 0 to generate a 2ms period with a 10% duty cycle.
The fast PWM mode where the period is controlled by OCRA has (WGM2,WGM1,WGM0) = (1,1,1). The compare match B output must be used and it should turn on at TOP and reset at match. This happens when (COM0B1,COM0B0) = (1,0). The prescaler is set to 64.
TCCR0A = _BV(COM0B1) | _BV(WGM01) | _BV(WGB00);
TCCR0B = _BV(WGB02) | _BV(CS01) | _BV(CS00);
OCR0A = 250;
The duty cycle (period the PWM is on) is controlled by OCR0B. The range of OCR0B is from 0 to OCR0A (or 250 in this case). If OCR0B exceeds OCR0A, then the PWM output will be alway on. A duty cycle of 10% is set by:
OCR0B = OCR0A * 10% = 250 * .1 = 25
The configuration is complete when OCR0B is assigned:
OCR0B = 25;
Changing the output compare control setting (COM0B1,COM0B0) = (0,1) inverts the waveframe (i.e., the output will be off for 10% and on for 90%).
What is the setting for a 75% duty cycle? How would the period be changed to 250 uS, and how would this affect the precison of the duty cycle?