First, I write something like this:
' Interrupt routine called by ACLine (GP4) pin state change
disable
ACDetect:
if ACline=1 then ' Check for rising edge of AC signal
pauseus triacdelay ' do the selected delay
Triac=1 ' Activate TRIAC
pauseus 20
Triac=0 ' Disable TRIAC
endif
INTCON.0=0 ' Clear GPIF (interrupt on GP4 change)
resume
enable
and because I use half wave signal from the AC line on GP4, finaly something like this:
' Interrupt routine called by ACLine (GP4) pin state change
disable
ACDetect:
if ACline=1 then ' Check for rising edge of AC signal
pauseus triacdelay ' do the selected delay
Triac=1 ' Activate TRIAC
pauseus 20
Triac=0 ' Disable TRIAC
'send a second pulse to triac,after 10ms, like the full wave
pause 10
Triac=1 ' Activate TRIAC
pauseus 20
Triac=0 ' Disable TRIAC
endif
INTCON.0=0 ' Clear GPIF (interrupt on GP4 change)
resume
enable
Again, thanks all of you!
Reven




Bookmarks