Once a triac is turned on it will not turn off until the current through it falls to zero by external means (a triac can't be shut off by controlling it's gate). If you want it to stay on you could just apply a continuous high to the gate. You don't actually need to pulse it only at the instant you want to turn it on. Nothing bad happens if you just apply a high signal as long as you want the triac to stay on (it will only turn off after you remove the gate signal when it crosses zero though).
For an exact 50Hz, the half cycle time is exactly 10ms. The mains frequency will varies a bit from 50.5Hz to 49.5Hz in some cases. Therefore your max hold time will be the half cycle time from 9.9ms ~ 10.1ms, depending on the AC frequency. You'll need to make some allowance.
Suraj143 said:
When i increase the hold time closer to 10ms & turning on the triac the output will very dim.Am I right?
Most zero point crossing detecting circuits will trigger when the AC main is a few degrees before actually reaching zero crossing and thus will fire the ISR a little early. This is good.
I would suggest once you are inside the ISR, you immediately check on the power requirement and remove the triac gate drive unless the power requirement demands it to remain fully ON in the next half cycle.
Then how you will ensure the triac drive fires at the desired moment between 0 ~ 10ms for power control will depend on actually programming. You can either use a timer interrupt or set up some count variables to do that.
Yes, it will work. Except that you should remind yourself instead of "turn off the triac", it should actually be "removes triac gate drive" in the code comments.
However, spending (aka wasting) 5ms inside an ISR, with the interrupt requests coming at 10ms rate is definitely not a good programming practice.
Yes, it will work. Except that you should remind yourself instead of "turn off the triac", it should actually be "removes triac gate drive" in the code comments.