Zero crossing detection

Yes, at every interrupt it sets counter to zero and starts again counting up from 0 to 255 (in reality it is 1 to 216 or smth near this number and 216 is full OFF and 1 is full ON).
If counter value is same as I requested with requestValue, it sets output high and triac holds itself up until the end of half period

If I sign my period is 20ms as I set my timer to take a sample of 2 seconds in 2 seconds

thank Ragnar