i'll prefer to detect begining of each cycle using the appended circuit...
You must detect begining of cycle, then activate output to TRIAC for a maximum delay of 10ms including when your PIC is detecting the begining of the cycle. Let's say your PIC is detecting the cycle after 1ms of the begining, you must wait a maximum of 9 ms. Can be intelligent to use a PIC who have internal voltage comparator here.
try the following code as a begining.
Code:
'Using PIC16F628
@ __config _INTRC_OSC_NOCLKOUT & _WDT_ON & _PWRTE_ON & _MCLRE_ON & _LVP_OFF
TRISB=%00000001
BeginingCycle var PORTB.0
OutputToTriac var PORTB.1
delay var byte
Hold var word
while BeginingCycle
wend
start:
For delay=0 to 8
for Hold=1 to 100
while BeginingCycle=0
wend
OutputToTriac=1
Pause delay
OutPutToTriac=0
While BeginingCycle
Wend
Next
next
goto start
Last edited by mister_e; - 20th December 2004 at 22:12.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Bookmarks