CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

3 PHASE PWM ON 18F452

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
theredkid



Joined: 27 Aug 2014
Posts: 14

View user's profile Send private message

3 PHASE PWM ON 18F452
PostPosted: Mon Sep 01, 2014 2:33 am     Reply with quote

Hi Everybody,

I'm trying to achieve tri-phase angle control of a thyristor using PWM on 18F452. I know the code for single phase, but how can we implement in three phase? I'm restricted to use 18F452. Thank you:

Code:
#include <18F452.h>
#fuses XT, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock = 4000000)

main()
{
output_low(PIN_C1);   // Set CCP2 output low
output_low(PIN_C2);   // Set CCP1 output low

setup_ccp1(CCP_PWM);  // Configure CCP1 as a PWM
setup_ccp2(CCP_PWM);  // Configure CCP2 as a PWM

setup_timer_2(T2_DIV_BY_16, 124, 1);  // 500 Hz     
set_pwm1_duty(31);                    // 25% duty cycle on pin C2
set_pwm2_duty(62);                    // 50% duty cycle on pin C1

while(1);
}
Ttelmah



Joined: 11 Mar 2010
Posts: 19538

View user's profile Send private message

PostPosted: Mon Sep 01, 2014 4:31 am     Reply with quote

What you post, is not 'the code for single-phase', and has nothing to do with it....

Thyristor control does not want PWM.

With a thyristor, your signal needs to be synchronised to the mains, not 'free running' as a PIC PWM signal is.

Basically, you look for an input signal to signal the zero crossing point, and then a time after this signal, you send a pulse to the thyristor gate to turn it on. For full power, you turn it on immediately after the zero crossing, for 50% you turn it on half a cycle after the crossing etc..

All that is needed is a tiny pulse to trigger the gate. The power changes according to the time this pulse occurs, _not_ according to the pulse width as with conventional PWM.

The thyristor stays on from the moment it receives the pulse to the end of the half cycle.

To do three phase, ideally you have three zero crossing detectors, and for the 'power', you have a look up table of the time values required after this for each required level.
With three zero crossing signals, and a relatively simple code loop using a single timer, and working out the values required on this, it is quite do-able with your PIC. This is phase angle control.

Currently, if you are running single phase,, you have something possibly resembling 'maybe control', with semi-random beating of the switching point. It might vaguely work for something that wouldn't mind the beating (though as posted the range of control would be a few percent, then 'off'), like a heater, but for anything else it is not going to work at all.

You need to start by understanding how Thyristors work, and why PWM is not basically useable with them. Unless something special like GTO thyristors, there is no ability to turn them off once triggered.
Phase angle control can be considered as a very low frequency 'form' of PWM on the output, but it does not want 'PWM' from the PIC, or use the PWM hardware at all.....
temtronic



Joined: 01 Jul 2010
Posts: 9243
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Mon Sep 01, 2014 5:14 am     Reply with quote

hmm...

Mr. T's "Phase angle control can be considered as a very low frequency 'form' of PWM "

I never thought of it like that but it really is!!
A type of fixed frequency(line or 'mains') analog (AC) PWM.

jay
Ttelmah



Joined: 11 Mar 2010
Posts: 19538

View user's profile Send private message

PostPosted: Mon Sep 01, 2014 7:32 am     Reply with quote

Yes, The 'trigger' is pulse position modulation, but the output from the actual thyristor is synchronous mains frequency PWM. However as I said it has nothing to do with PWM as generated at the PIC!... Smile
theredkid



Joined: 27 Aug 2014
Posts: 14

View user's profile Send private message

PostPosted: Tue Sep 02, 2014 12:34 am     Reply with quote

Thank you all for your detailed answers.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group