pa-pa / AskSinPP

104 stars 72 forks source link

Phasecutmode, CTC-Mode for Timer2 necessary? #322

Open mankut80 opened 4 months ago

mankut80 commented 4 months ago

i am trying to build a Homematic Phasecut-Dimmer (leading edge) with an Arduino Pro Mini. Examining the code, i stumbled over line 107 in PhaseCut.cpp:

TCCR2B |= (1 << WGM21) | (1 << CS20) | (1 << CS21) | (1 << CS22) ; // Enable/start CTC and set prescaler to 1024 the bit WGM21 is located in TCCR2A, not in TCCR2B. So, the CTC-Mode will not be enabled. Is this a "cosmetic" bug :-)? Maybe the CTC-Mode ist not necessary for the comparematch to occure?

pa-pa commented 4 months ago

Good question. I have no idea.

mankut80 commented 3 months ago

In the meantime i know it. CTC-Mode is not necessary. No need to set WGM21 :-)