I would like to synchronize PWM with the phase

General discussion on mikroC for dsPIC30/33 and PIC24.
Post Reply
Author
Message
Thiago
Posts: 3
Joined: 03 Feb 2009 11:48

I would like to synchronize PWM with the phase

#1 Post by Thiago » 03 Feb 2009 12:15

I would like to synchronize a PWM with phase I'm following the example that has the help with the dsPIC30F2010.
the output of this dspic ok but it is not synchronized with the phase RST, how can I create this sync!

unsigned int i;
unsigned int duty_50;

void Timer1Int() org 0x1A {
IFS0 = IFS0 & 0xFFF7;
LATC = ~ PORTC;
}

void main(){
ADPCFG = 0xFFFF;
PORTB = 0xAAAA;
TRISB = 0;
PORTC = 0xAAAA;
TRISC = 0;
Delay_ms(1000);
duty_50 = Pwm_Mc_Init(2000,1,0x3F,0);
returns 50% of the duty
Pwm_Mc_Set_Duty(i = duty_50,1);
Pwm_Mc_Start();
do
{
i--;
Pwm_Mc_Set_Duty(i,1);
Delay_ms(1);
if (i == 0)
i = duty_50 * 2 - 1;
PORTB = i;
Timer1Int();
}
while(1);

}

Dany
Posts: 3854
Joined: 18 Jun 2008 11:43
Location: Nieuwpoort, Belgium
Contact:

#2 Post by Dany » 03 Feb 2009 15:24

but it is not synchronized with the phase RST, how can I create this sync!
Why do you want to do that for?
And what do you mean exactly with "synchronise"? What does it mean for the PWM pulse frequency and duty cycle?
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)

Thiago
Posts: 3
Joined: 03 Feb 2009 11:48

#3 Post by Thiago » 04 Feb 2009 11:42

I am designing a rectifier to a 3 phase system, with SCR or IGBT in the entry so I have to have a shot at having to correct a short circuit between the phase, so I have to "Synchronize"
and I have a dead time between the positive and negative also for the shot that disparo.se in output would be problems but how the entrance I can not miss

seugue changes

void main () (

PORTB = 0x0000;
TRISB.F1 = 1;
delay_ms (200);

Pwm_Mc_Init (2000, 0,0 xff, 1);
Pwm_Mc_Set_Duty (0, 1);
Pwm_Mc_Set_Duty (0, 2);
Pwm_Mc_Start ();

of
(
ch_1 = Adc_Read (1);
i = ch_1 * 4;
Pwm_Mc_Set_Duty (i, 1);
Pwm_Mc_Set_Duty (i, 2);
Pwm_Mc_Set_Duty (i, 3);
Pwm_Mc_Set_Duty (i, 4);
Pwm_Mc_Set_Duty (i, 5);
Pwm_Mc_Set_Duty (i, 6);
delay_ms (100);
)
while (1);

)

Dany
Posts: 3854
Joined: 18 Jun 2008 11:43
Location: Nieuwpoort, Belgium
Contact:

#4 Post by Dany » 05 Feb 2009 14:35

Hi, I think your problem can not be solved by using PWM (there is a chance that I am wrong of course).
I think you need 3 pulses, synchronised with the zero crossing of the 3 phases, to ignite your triac's (or SCR's or IGBT's) a while after the zero crossing. By controlling the delay between the pulse and the zero crossing the Triac's will ignite sooner or later after the crossing, letting longer or shorter current through to the load.

This is in principle what a "dimmer" does for a single phase.

Here is an example of a single phase light dimmer, controlled by touching the house of the lamp:
http://users.edpnet.be/rosseel01/DRO/PI ... C_Projects, project "TouchDimmer".
The example software (and hardware) detects the zero crossing and starts a timer. After the timer rolls over, the triac ingition pulse is generated.
You do not need the "touch" section in the code...
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)

Thiago
Posts: 3
Joined: 03 Feb 2009 11:48

#5 Post by Thiago » 09 Feb 2009 16:09

But I can not maintain a constant Vcc it this way then I will decrease the life of the component! So I have to have a PWM of 2khz ... and how can I create a Dead Time 2% in the PWM? .. Dead this time prevents the thyristors and come short circuit.
when the test is being made with thyristors but the operation is the same with or SCR Triacs

Post Reply

Return to “mikroC for dsPIC30/33 and PIC24 General”