|
|
View previous topic :: View next topic |
Author |
Message |
nailuy
Joined: 21 Sep 2010 Posts: 159
|
Two phases and a neutral on 16F1936 |
Posted: Mon Sep 10, 2012 9:05 am |
|
|
I want to make PWM for electric engine.
Truth table for phases and neutral positions are:
#1 F1=1, F2=0, N=0
#2 F1=1, F2=1, N=0
#3 F1=0, F2=1, N=0
#4 F1=0, F2=1, N=1
#5 F1=0, F2=0, N=1
#6 F1=1, F2=0, N=1
#7 F1=1, F2=0, N=0
#8 F1=1, F2=1, N=0
#9 .... and so on
My question is how to make a precise delay between CCP1 and CCP2 (F1, F2).
How can I make link between "N" to CCP1 and CCP2.
Thnks. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19538
|
|
Posted: Mon Sep 10, 2012 9:22 am |
|
|
Realistically, this is not two phases and neutral, but standard 3 phase BLDC control. The 'neutral', is a virtual point inside the motor, where the 3 phases meet.
Have a look at AN857a from MicroChip, which shows doing this in software using a timer to control the PWM, and phase timing. I have done this with CCS, without problems. AN970, shows a more sophisticated control using a PIC18 (downside of the AN857 version comes when loads change rapidly, or supply voltages change a long way).
It is actually a lot easier to do using an IC designed to do it. Unless you have some special 'extra' requirement. Toshiba in particular do a couple of chips that make this a 'doddle'.
Best Wishes |
|
|
nailuy
Joined: 21 Sep 2010 Posts: 159
|
|
Posted: Mon Sep 10, 2012 1:15 pm |
|
|
Thank you for reply.
I want to learn how to work with PWM between CCP1 and CCP2 (delay's).
I have other "doddle" to solve, and are already solved if I use this PIC16F.
I'm not using PWM on "N" because I'm not need it.
Only two question's, how can I work with two CCP delayed and how can I make this N to be correlated ?
If I work with 3 phases I make inside of engine neutral, but I need only outside, I have only 2 coils.. at 90 degree.
I'm not understanding language of Mplab.
Thank you. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19538
|
|
Posted: Mon Sep 10, 2012 3:16 pm |
|
|
The PWM's can be set to use two different timers.
Start one timer.
Delay for the offset time required
Start the second timer.
Program the two PWM's.
You then have two PWM's with the time delay between them.
However normally you'd have PWM, common between the phases, used to control the power, and modulate the drive phases at a much lower frequency. Typically perhaps PWM at 10KHz+, with phase modulation much slower than this. For instance, a 12phase motor at 8000RPM, still only wants 1600Hz on the phase changes.
You are going to run into problems controlling your third phase, because of the latency involved in code. Even 1uSec of delay in turning off a drive combination, is too long, if you are already turning on the other bits....
This is why operating all the bits in sync is needed.
Best Wishes |
|
|
asmboy
Joined: 20 Nov 2007 Posts: 2128 Location: albany ny
|
|
Posted: Mon Sep 10, 2012 6:59 pm |
|
|
You should understand that the PIC by itself is not always the best way to get your task done. Using specialized function chips for time critical functions is important, especially for you project, where small amounts of time indeterminacy can be problematic.
As somebody who has BTDTGTTS with multiphase motors, several times, - the KEY wisdom Ttelmah was kind enough to share with you is this:
Quote: |
It is actually a lot easier to do using an IC designed to do it. |
a google search of
BLDC controller
and
BLDC IC
will do you a world of good I think.
BTW: Shat you have not disclosed is if you are using
Back EMF sensing or Hall effect tach sensors for speed control and /or
phase switch sync and how you plan to handle stall management/ protection. |
|
|
nailuy
Joined: 21 Sep 2010 Posts: 159
|
|
Posted: Mon Sep 10, 2012 11:17 pm |
|
|
I find this topic and is much closer to what I need.
http://www.ccsinfo.com/forum/viewtopic.php?t=37807&start=3
but is based on the interruption.
I will continue to search how to make delay between timers like you say
Quote: | Start one timer.
Delay for the offset time required
Start the second timer.
Program the two PWM's. |
If you know example... I appreciate.
For third phase or "neutral" I will try to make link between timers and this.
Thnks. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19538
|
|
Posted: Tue Sep 11, 2012 1:03 am |
|
|
I too have built several BLDC controllers, including one based directly on AN857, which is why I'll repeat the comment reinforced by asmboy, of just how much easier this is using an IC designed to do it....
On the delayed PWM's:
Code: |
setup_timer_4(T4_DIV_BY_4);
setup_timer_6(T6_DIV_BY_4);
set_timer4(0); //start timer4
setup_CCP4(CCP_PWM|CCP_TIMER4);
delay_us(10);
set_timer6(0); //start_timer6
setup_CCP5(CCP_PWM|CCP_TIMER6);
|
Obviously with some tweaking, according to what CCP/timer you want to use, give you two PWM channels, with the pulses from the second, delayed by just over 10uSec from the first.
Best Wishes |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19538
|
|
Posted: Tue Sep 11, 2012 2:05 am |
|
|
I think it is also important to get the poster to understand that the PWM frequency, is not normally the phase frequency.
Have a look at:
<http://www.youtube.com/watch?v=Jdhgi5_kmvk>
Which shows the waveforms involved. The PWM, is being modulated to control the power, while the phase pulses change at a much slower frequency to give the motor speed required.
Best Wishes |
|
|
nailuy
Joined: 21 Sep 2010 Posts: 159
|
|
Posted: Tue Sep 11, 2012 3:30 am |
|
|
yes Ttelmah this I need it.
Thank you.
Table of truth was wrong sorry.
#1 F1=1, F2=na, N=0
#2 F1=1, F2=1, N=0
#3 F1=na, F2=1, N=0
#4 F1=0, F2=na, N=1
#5 F1=0, F2=0, N=1
#6 F1=na, F2=0, N=1
#7 F1=1, F2=na, N=0
#8 F1=1, F2=1, N=0
#9 .... and so on
na is value between 0-1 (if it is 0 or 1 I have brake.)
on the old table should be operated with a fill of 50% and a difference of 60 degrees
Now with the new table I must make a filling of 33% and a difference of 90 degrees.
How can I change this PWM filling?
for degree now I understand.
Thnks. |
|
|
nailuy
Joined: 21 Sep 2010 Posts: 159
|
|
Posted: Tue Sep 11, 2012 8:08 am |
|
|
I found it:
int16 DUR;
DUR = 408; // [408/(4*(200+1))]=0.5=50%
set_pwm1_duty(DUR);
Thank you guys. |
|
|
|
|
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
|