Read the previous post first.
Then if you want both halves of the cycle, try this ...
Code:
INTEDG  VAR OPTION_REG.6
; ...

ACDetect:
    if triacdelay != 8000 then triac = 0 
    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

    INTEDG = !INTEDG
@ INT_RETURN
Name:  dimmer_2.JPG
Views: 2307
Size:  74.2 KB