According to the simulator, your resistors/zeners should give 4.4v, so that's ok. (but you shouldn't need the zeners)
mister-e was using INT ON CHANGE, so it triggered on both edges.
To get INT to do the same thing you have to toggle INTEDG on each interrupt.
This modification of the handler works in the SIM.
In the scope image, the blue line shows the triac ON time.Code:INTEDG VAR OPTION_REG.6 ; ... ACDetect: if INTEDG then if triacdelay > 0 then if triacdelay=8000 then triac=1 ' Activate TRIAC else maxdelay=8000-triacdelay pauseus maxdelay triac=1 endif else triac=0 endif else if triacdelay != 8000 then triac=0 endif INTEDG = !INTEDG @ INT_RETURN
It's only on during the positive half of the cycle.
Doesn't seem right, but that's the way mister-e had it.
HTH,




Bookmarks