When I did my zero cross light dimming I ran into the same issue, and it turned out to be my timing was off. When I went to 'full bright' the triac was actually triggering just before the zero cross, and then turning back off again, instead of triggering just after the zero cross. Be aware that the zero crossing scheme you implement gives you a positive pulse after the actual zero cross. You might instead start your timing on the falling edge of that signal, which will start timing just before the zero cross, and put the "light out" condition at the dark end of your scale. Either way, if you have an oscilloscope then you can view the timing relationships easily enough (zero cross, triac trigger, AC line) but if not you can calculate everything and find out where the timing it off. You can see a little bit of what I did here: http://www.ubasics.com/adam/electronics/doc/phasecon.shtml Good luck! -Adam On 3/10/08, Gayan Soyza wrote: > Hi all > > I'm fading a 230V bulb. Using zero cross on an interrupt pin. > > The operation is it starts from full brightness & fades down to zero > brightness & starts to increase the brightness to its maximum & continue the > operation. > > I wrote a coding & its works the only problem is when it's reached maximum > brightness the bulb is turning off for a moment (its turning off for a very > small time) & after its working nicely. When in the next full brightness > again bulb is turning off for a moment & after its working nicely. > > My TRIAC is BT136 on GP0 via 390R resister. > Zero cross detecting via 1M resister on GP2 interrupt directly on AC mains. > Interrupt on every 10mS for (50Hz) using only positive cycle to trigger the > gate. > Using 256 steps to dim the bulb > [CODE] > ;******************** > ;detecting zero cross > ;******************** > > org 0004h > btfsc INTCON,INTF ;is it a zero cross > goto Select ;yes > goto Exit ;no > > ;************************************************************* > ;turning on the timer 36uS (Delay) X 255 (Steps) < 10ms (9180) > ;************************************************************* > Select > btfss Change,1 ;select inc or dec the brightness > goto Decrease ; > goto Increase ; > > Decrease > incfsz S_Count,F ;fade from fully brightness to dim > goto $+3 > bsf Change,1 > goto Increase_L > movf S_Count,W ;backup dim level > movwf W_Count ;// > call Delay > decfsz W_Count,F > goto $-2 > Fire > bsf GPIO,GP0 ;makes a short pulse > call Delay ;about 33uS delay > bcf GPIO,GP0 ;to latcht the triac > goto Exit > > Increase_L > movlw .255 > movwf S_Count > goto Exit > > Increase > decfsz S_Count,F ;fade from dim to fully brightness > goto $+3 > bcf Change,1 > goto Fire > movf S_Count,W ;backup dim level > movwf W_Count ;// > call Delay > decfsz W_Count,F > goto $-2 > goto Fire > > Exit > bcf INTCON,INTF > retfie > > Delay > movlw .9 ;36uS delay including call > movwf d1 > decfsz d1,F > goto $-1 > nop > return [CODE] > > -- > Electronics God > > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > > > -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Moving in southeast Michigan? Buy my house: http://ubasics.com/house/ Interested in electronics? Check out the projects at http://ubasics.com Building your own house? Check out http://ubasics.com/home/ -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist