Marc R.J. Brevoort wrote:
>>> Right now, I've set:
>>> TCCR0B = 0<<CS02|0<<CS01|1<<CS00 (no prescaling)
>>> TCNT0 = 255 (overflow on next tick)
>>> TIMSK=(1<<TOIE) (enable counter overflow int).
>>>
>
>
>> For one interrupt every 1/31250Hz, I'd use:
>> TCCR0A = 1<<WGM1 (CTC mode)
>> TCCR0B = 1<<CS01 (8MHz/8)
>> OCR0A = ((8MHz/8)/31250Hz)-1 = 32-1
>> TIMSK = 1<<OC1E0A
>> TCNT0 = don't care
>>
>
> I assume you mean 1<<WGM01 for TCCR0A (CTC mode, TOP=OCR0A).
> I also changed ISR (SIG_OVERFLOW0) to ISR (TIMER0_COMPA_vect).
> This works, more or less. That is, the interrupt routine gets
> called, but by the pitch I get it seems to be at a quarter of
> the rate that it should be.
>
> Strangely, altering OCR0A does not seem to influence
> the pitch at all, which makes me think something else is
> amiss which makes the ATtiny ignore the value in OCR0A.
>
> Any ideas?
>
> Best,
> Marc
>
Please verify if the clock source fuses are set up to cristal
oscillator.
Check CKSEL0 to CKSEL3 and CKDIV8.
Mark JordanMessage
Re: [AVR-Chat] ATtiny2313 audio
2009-12-28 by enkitec@gmail.com
Attachments
- No local attachments were found for this message.