hello i h've been working on a phase control light dimmer project with pic 16f877 microcontroller with ccs pic c compiler driving a MOC3021 optotriac
controling a lamp 220 v 50 hz .i can say that i know the principle well ,so i wrote this c code,and for some reason it does not work.
well in this case i am trying to control the lamp at 3 defrents phases 100,75,50 %
int porcentage=100;
#int_EXT
EXT_isr()
{
if(porcentage==50)
{
delay_us(4990);
output_high(PIN_C0);
delay_us(100);
output_low(PIN_C0);
// set_timer1(5000);
I assume you are working from a zero cros point and controlling a triac! Is this correct? When you say it doesn't work what do you mean exactly/ What happens?
the zero cross crcuit is working fine,it does trigger an externel interrupt ,wich execute an ISR.i am using isis proteus simulator an for some reason i have a timing probleme and it is crashing .
the zero cross crcuit is working fine,it does trigger an externel interrupt ,wich execute an ISR.i am using isis proteus simulator an for some reason i have a timing probleme and it is crashing .
If we need to control at different phases we need to use non-zero cross TRIAC Driver example MOC3011. Now detect the zero cross using voltage drop and opto-couple accross the Live or Hot wire. Remember here not to connect reverse. That's all rest is done by software, we can control a very smooth almost linear control.
Thankyou
PS: Try to change to MOC3011 and see. I think you are trying to sense through half wave rectifier. I suggest direct sense would give you better results. Connect a IN4007 and then 33K on the live or Hot wire and connect to an Opto-coupler like 4N35, now sense the output of optocoupler.
in the 50 % case i need to wait 5ms to trigger the TRIAC ,with the osciloscope it shows that is longer then the entire sicle of the input .allthough i ma using i 50hz input ,onse a zeros cross interrupt the microcontroller a 5ms delay seems to hang the ISR longer than the time it takes for the next interruption.
---------- Post added at 14:47 ---------- Previous post was at 14:45 ----------
using a 50hz frequency should have 20ms sicle and 2 times interruption after each 10ms ,the problem that my code is for some reason concedering a 5ms delay longer than the 10ms of half sicle.
---------- Post added at 14:52 ---------- Previous post was at 14:47 ----------
thanks for your post prmurthy ,but the zeros cros sence is working fine,and i am using a non eros cross TRIAC driver MOC3021
I am trying to design a very simular circuit, only using circuitry and no pic.. Since I am having problems I am considering using the sam pic. I tryed to stay away from programming, I find its not my strong point!!:-|
Does the trigger have to be an interrupt?? Im looking to vary the phase output buy varying a voltage input to the pic from 0-5 volts. Its an analog signal so would i have to use an A/D converter. Is this possible??
Thanks