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

three pwm output for inverter application
Goto page 1, 2  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
flahaymen



Joined: 10 Mar 2013
Posts: 13

View user's profile Send private message Send e-mail

three pwm output for inverter application
PostPosted: Sun Mar 10, 2013 8:01 am     Reply with quote

Dear Friend


It is possible to generate a three PWM signal for an inverter application using a PIC as 16F or 18F, using only software program or we need a hardware part??
temtronic



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

View user's profile Send private message

PostPosted: Sun Mar 10, 2013 8:30 am     Reply with quote

YES it is quite possible to generate a 3 phase PWM using software.
Back in the 'dinosaur days', we did it all in discrete chips since microcomputers with PWM internal peripherals did not exist.
Simply Google 'software PWM PIC' and you should get a few thousand hits.

It's all in the details...invertor frequency,power output,choice of PIC,xtal,etc.

Even the 'ancient' 16C84 is capable of 3phase PWM applications.

hth
jay
temtronic



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

View user's profile Send private message

PostPosted: Sun Mar 10, 2013 8:36 am     Reply with quote

Here's a link to show an 'old school' design.

http://circuit-diagram.blogspot.ca/2011/05/3-phase-pulse-generator-
using-cmos.html

You can easily cut code to emulate the waveforms from any PIC.
The 'trick' is use use a PWM base clock of 6X the desired frequency.

It should be a good start to your project...

hth
jay
flahaymen



Joined: 10 Mar 2013
Posts: 13

View user's profile Send private message Send e-mail

PostPosted: Sun Mar 10, 2013 9:02 am     Reply with quote

The link is unavailable.

But with the software method how we can detect the zero for starting the pwm signal and how can decal the three signal on the start up .
Ttelmah



Joined: 11 Mar 2010
Posts: 19513

View user's profile Send private message

PostPosted: Sun Mar 10, 2013 9:09 am     Reply with quote

The link got cut at the hyphen. Just re-assemble it.

Best Wishes
Mike Walne



Joined: 19 Feb 2004
Posts: 1785
Location: Boston Spa UK

View user's profile Send private message

PostPosted: Sun Mar 10, 2013 2:36 pm     Reply with quote

Tell us a lot more about what you're trying to do:-

1) PWM frequency.
2) PWM resolution.
3) End application.
4) Proposed PIC.
5) Compiler version.
6) You level of expertise.
7) .....................

At this stage, all we can do is second guess.
The more you tell us, the better we can help.

Mike
flahaymen



Joined: 10 Mar 2013
Posts: 13

View user's profile Send private message Send e-mail

PostPosted: Mon Mar 11, 2013 1:26 am     Reply with quote

Thanks for all the group

Our wish is to build a program which can be implemented in PIC 16F or PIC18 to generate a three phase PWM can be used for an inverter application.

More explanation:
The idea refers to compare a three sinusoid signal with a triangular one, but we didn't found the way in CCS code. How we can do that ?

We found some solution on matlab but not for PIC.

The below code demonstrates the code in matlab.
Code:

clc;
clear all;
A=5; %Amplitude du signal
frequ_ech=100000; %fréquence d'échantillonage
t=0:1/frequ_ech:0.019 %échelle de temps
i=A.*sawtooth(200*2*pi*t); %signal triangle (porteuse)
s=0.75*A.*sin(2*pi*50*t); %signal sinus (consigne)

pwm=0; %initialisation du PWM

for k=1:length(s)
    if (s(k)<=i(k)&&s(k)>0)
        pwm(k)=1;
   
    elseif (s(k)<=i(k)&&s(k)<0)
        pwm(k)=-1;
    end

end
length(t)
length(pwm)
subplot(3,1,1)
plot(t,pwm,'r')
set(gca,'ytick',-6:0.1:6);

subplot(3,1,2)
[AX,H1,H2] = plotyy(t,i,t,s,'plot');
grid on

set(AX(1),'ylim',[-6 6],'ytick',-6:2:6)
set(AX(2),'ylim',[-6 6],'ytick',-6:2:6)
axes(AX(1))
axes(AX(2))

subplot(3,1,3)
[AXy,H3,H4] = plotyy(t,pwm,t,s,'plot');
%grid on

set(AXy(1),'ylim',[-1.5 1.5],'ytick',-1.5:.2:1.5)
set(AXy(2),'ylim',[-6 6],'ytick',-6:2:6)
axes(AXy(1))
axes(AXy(2))
flahaymen



Joined: 10 Mar 2013
Posts: 13

View user's profile Send private message Send e-mail

PostPosted: Mon Mar 11, 2013 1:34 am     Reply with quote

The software used is PCW.

Our level is OK, but no so good.

For the PWM frequency and resolution, really we are not sure by the needed value because we don't understand the relation between our application and these characteristics.


You find in the below code an example for a program to generate a PWM signal, but as I say before we search to build a PWM by a software method, where we can compare a three sinusoidal signal by a triangular one.
Code:

#include<16F877.h>

#fuses XT,NOPROTECT,NOWDT,PUT
#use delay(clock = 2000000)//Quartz 4Mhz
#include<lcd.c>

//*******************************************
//*************variable global***************
//*******************************************

float ddp1;                //ddp1 courante
FLOAT ddp2;                //ddp2 courante
int ddp3;                //ddp3 courante
int courant;             //valeur de courant courante

int consigne1;           //consigne de ddp
int consigne2;
int consigne3;           //consigne de courant
unsigned ddpOK;   // pour tester si on est arriver au moins une fois à la consigne désirée
unsigned test;//pour tester s'il y a un changement sur la consigne1 à fin de le sauvgarder ds l'eeprom

//*******************************
//*********Entrées/Sorties*******
//*******************************
#define trisc 0x80  //tou les pin de port c sont configurer en sortie sauf le pin7
#define TRISA 0x3f //A0,A1,A2,A3,A4 et A5 = entrees
#define TRISd 0xff // portd definie en entre
#define TRISb 0xff // portd definie en entre
#bit adif=0x0c.6
#bit gie=0x0b.7
#bit peie=0x0b.6
#bit up=8.0
#bit down=8.1
void main()
{
while(1){

lcd_init();// init lcd
setup_ccp1(CCP_PWM);   // Configure CCP1 as a PWM
setup_ccp2(CCP_PWM);   // Configure CCP1 as a PWM
setup_adc_ports(a_ANALOG);//initialisation du CAN
setup_adc(ADC_CLOCK_DIV_32);
set_tris_B(TRISb);//initialisation du PORT B,configuration des pin en E/S
setup_timer_2(T2_DIV_BY_4, 127, 1);//initialisation du TIMER2 (This part is not so clear for us, we found it on the help)


             set_adc_channel(0);
             ddp1=read_adc();
             printf(lcd_putc,"\fel:=%F%C",ddp1*5/255,'V');
            delay_ms(400);
            set_pwm1_duty(ddp1);
       
 }
 }
Mike Walne



Joined: 19 Feb 2004
Posts: 1785
Location: Boston Spa UK

View user's profile Send private message

PostPosted: Mon Mar 11, 2013 3:02 am     Reply with quote

OK. You've answered my questions, but it's not clear what you are trying to do.

I don't do MATLAB, so your code means nothing to me.

a) Is this a school project, world beating new product, what?
b) What load(s) do you want to drive?
c) What power level are you going to be working at?
d) Have you experimented with any kind of hardware?
e) Can you do an LED flasher on a PIC

Indenting code make it more readable.

Before going any further you need to have a firm grasp of:-

A) What your hardware can/cannot do and needs.
B) What your chosen micro can/cannot do.

Mike
flahaymen



Joined: 10 Mar 2013
Posts: 13

View user's profile Send private message Send e-mail

PostPosted: Mon Mar 11, 2013 4:26 am     Reply with quote

It a school projet


I want drive a three phase motor, using an inverter. But the inverter based on IGBT components and a 6 PWM signals must be applied.
The 6 PWM signals wil be generated from a IR2130 but this one need a 3 input PWM signals.

Our projet is to build these signals using a PIC.
After research we found that the PWM signal can be contsruct by a comparaison between three sinisoidal signal and a traingular signal.


The three phase input power will used (380V 50Hz) to drive the inverter.


After research wez found that pic 18f445 can generaate a PWM signal but this is not related to the pwm theory. I think
asmboy



Joined: 20 Nov 2007
Posts: 2128
Location: albany ny

View user's profile Send private message AIM Address

PostPosted: Mon Mar 11, 2013 8:35 am     Reply with quote

would this project have a SCHEMATIC of the circuitry you plan to build ??

do you have to build a working unit , or will a simulation be all you ever need to submit ?

are you able to share the grade for the project with the ones who actually are able to figure it out ?
flahaymen



Joined: 10 Mar 2013
Posts: 13

View user's profile Send private message Send e-mail

PostPosted: Mon Mar 11, 2013 9:16 am     Reply with quote

i will build it in a real prototype but after verify this on simulation. This projet is for engineering classes.
flahaymen



Joined: 10 Mar 2013
Posts: 13

View user's profile Send private message Send e-mail

PostPosted: Mon Mar 11, 2013 9:30 am     Reply with quote

generally the schematic sheme compose.

PIC for generating the PWM signals
LCD for showing the Dutty cycle
2 buttons for increasing and decreasing the dutty cycle
IR2130 to assure the delai betwen the PWM signals
Mike Walne



Joined: 19 Feb 2004
Posts: 1785
Location: Boston Spa UK

View user's profile Send private message

PostPosted: Mon Mar 11, 2013 9:55 am     Reply with quote

This just gets better.

Let me re-cap:-

1) You're going to use a full bridge to convert 3-phase mains to DC.
2) Use the DC to drive a three phase invertor for a motor.

Have you any power electronics experience?

You have still not told me:-

c) How much POWER you're going to handle.
(i.e. How much current will you be feeding to the motor?)
d) If you have experimented with real hardware.
e) That you can drive an LED flasher.

Mike


++++++++++++++++++++++++
Mike,
Please cut back on the bullying behavior.
The mod does not want to lock any more threads.

The OP's posts show he is the design/idea stage
of the project. He has no LEDs to flash.
He does not know the current or power.

When replying, judge the OP's experience level
and be patient, and no bullying. If you find the
OP irritating, don't reply.

This applies to everybody.

- Forum Moderator
++++++++++++++++++++++++
Mike Walne



Joined: 19 Feb 2004
Posts: 1785
Location: Boston Spa UK

View user's profile Send private message

PostPosted: Mon Mar 11, 2013 11:15 am     Reply with quote

OK. You're at the design stage. So I'll go the other way round.

Quote:
The three phase input power will used (380V 50Hz) to drive the inverter.
Feed 380V into a bridge rectifier then a storage cap yields >500V.
That's lethal, very lethal.
That's why I'm asking if you have any power electronics experience. (Without the cap you still get >500V peak.)

Quote:
After research wez found that pic 18f445 can generaate a PWM signal but this is not related to the pwm theory. I think
There is no 18F455, I think you might have meant the PIC18F4550.


Quote:
After research we found that the PWM signal can be contsruct by a comparaison between three sinisoidal signal and a traingular signal.
Yes, you are correct. The method you desrcibe is a standard analogue approach to creating PWM signals.
With a PIC you use a digital method.
You generate all your PWM signals directly from the PIC.
There are examples on the forum which show how it can be done.

Quote:
generally the schematic sheme compose.

PIC for generating the PWM signals
LCD for showing the Dutty cycle
2 buttons for increasing and decreasing the dutty cycle
IR2130 to assure the delai betwen the PWM signals
In general (for what you're trying to do) the PWM duty ratios for each of your three phases will vary continuously.
You do not have a fixed duty ratio.
What your PIC system effectively can do, is apply synthesised mains to your motor.
In other words you can change both the amplitude and the frequency of the mains.
(Amongst other things.)

Sorry if I appeared to be bullying.
I was trying to extract information from you, rather than swamp you with more data than you either needed or could cope with.

Mike
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
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