Hi,

On 09/23/2011 09:26 AM, Stefan Schoenleitner wrote:
>     // set up compare matching in the middle of the period
>     TCC0.CCA = TCC0.PER/2;
>     TCC0.CTRLB |= TC0_CMPA_bm;                // enable compare match on 
> compare channel A
>     TCC0.INTCTRLB |= TC_CCAINTLVL_LO_gc;      // low level interrupt on 
> compare match

finding the culprit always happens after one has already sent out
the posts asking for help ;)

In the above code sample, you can see that I enabled compare matching on
channel A with
TCC0.CTRLB |= TC0_CMPA_bm;

However, a look into iox128a1.h reveals that is wrong.
Instead, the correct constant to enable compare matching on channel A is
TC0_CCAEN_bm.

Since I wrote the wrong bitmask to the TCC0.CTRLB register, it also
explains the weird behavior of the timer.
Using TC0_CMPA_bm, TC0_CMPB_bm, etc. actually wrote to the waveform
generation field, causing the timer to no longer run in normal mode.

Still, if other people try to set up quadrature 32-bit decoding, I think
my posts to this list might be helpful for them.

cheers,
Stefan

_______________________________________________
AVR-chat mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/avr-chat

Reply via email to