|
|
View previous topic :: View next topic |
Author |
Message |
Flaviofrc
Joined: 04 Mar 2008 Posts: 7
|
MPWM Motor Control (PWM Problem! ) |
Posted: Thu Feb 14, 2013 12:16 pm |
|
|
Dear,
I'm trying to program a dsPIC30F4011 to control an AC induction motor using the PWM outputs in a complementary way but I'm not getting any results and no signal on the output PWM.
See complete code below:
I need to know where I am going wrong ... :
Thank You.
Code: | #include <30F4011.h>
#FUSES WPSA8
#FUSES WPSB1
#FUSES XT_PLL4 //External Clock mode with 4X PLL
#FUSES NOCKSFSM //Clock Switching is enabled, fail Safe clock monitor is enabled
#FUSES BROWNOUT //No brownout reset
#FUSES PWMPIN //PWM outputs disabled upon Reset
#FUSES WRT //Program Memory Write Protected
#FUSES MCLR
#FUSES BORV42
#FUSES PUT16
#FUSES PROTECT
#FUSES ICSP
#FUSES NODEBUG
#FUSES NOWDT
#use delay(clock=40000000)
#bit led=0x02d4.2 // PORTD 2
#bit dir_led=0x02d2.2 // PORTD 2
#bit FOTO=0x02f0.0 // PORTF 0
#bit dir_FOTO=0x02de.0 // PORTF 0
#bit FCF=0x02f0.1 // PORTF 1
#bit dir_FCF=0x02de.1 // PORTF 1
#bit FCA=0x02f0.4 // PORTF 4
#bit dir_FCA=0x02de.4 // PORTF 4
#bit BOT=0x02f0.5 // PORTF 5
#bit dir_BOT=0x02de.5 // PORTF 5
#bit LAMP=0x02c8.7 // PORTB 7
#bit dir_LAMP=0x02c6.7 // PORTB 7
#bit SINA=0x02c8.8 // PORTB 8
#bit dir_SINA=0x02c6.8 // PORTB 8
#bit RFIN=0x02d4.3 // PORTD 3
#bit dir_RFIN=0x02d2.3 // PORTD 3
#bit PROG=0x02d4.1 // PORTD 1
#bit dir_PROG=0x02d2.1 // PORTD 1
#bit COOLER=0x02d4.0 // PORTD 0
#bit dir_COOLER=0x02d2.0 // PORTD 0
#ZERO_RAM
#use rs232(baud=9600,parity=N,xmit=PIN_F3,rcv=PIN_F2,bits=8)
#int_PWM1
void PWM1_isr()
{
}
void main()
{
SETUP_COMPARE(1,COMPARE_OFF | COMPARE_TIMER2);
setup_timer2(TMR_INTERNAL | TMR_DIV_BY_256,499 );
setup_spi( FALSE );
setup_adc_ports(sAN1 | sAN2 | sAN3 | sAN4 | sAN5 |sAN6);
setup_adc(ADC_CLOCK_INTERNAL | ADC_TAD_MUL_31);
setup_timer1(TMR_INTERNAL|TMR_DIV_BY_256);
setup_timer3(TMR_INTERNAL|TMR_DIV_BY_256);
//--------------------------------------------------------------
dir_led=0;
dir_FOTO=1;
dir_FCF=1;
dir_FCA=1;
dir_BOT=1;
dir_LAMP=0;
dir_SINA=0;
dir_RFIN=1;
dir_PROG=1;
dir_COOLER=0;
//--------------------------------------------------------------
setup_motor_pwm(1,MPWM_FREE_RUN | MPWM_SYNC_OVERRIDES,1);
set_motor_unit(1,1,MPWM_ENABLE,1,1);
set_motor_pwm_duty(1,0,10);
set_motor_pwm_duty(2,0,2000);
set_motor_pwm_duty(3,0,2000);
*/
while (1)
{
delay_ms(200);
led=!led;
}
}
|
_________________ Flavio R. Caruso
www.stareletronics.com.br |
|
|
Flaviofrc
Joined: 04 Mar 2008 Posts: 7
|
|
Posted: Tue Feb 26, 2013 2:38 pm |
|
|
Nobody answer?
Well well..... |
|
|
Mike Walne
Joined: 19 Feb 2004 Posts: 1785 Location: Boston Spa UK
|
|
Posted: Wed Feb 27, 2013 3:05 am |
|
|
Flaviofrc wrote: | Nobody answer?
Well well..... |
There's too much code with no guidance for me to even start looking at it.
Or maybe you're the first with the problem, and you can help the rest of us.
In twelve days, what debugging have you done?
May I suggest you break the code down, and attack it one small chuck at a time.
Sorry, can't help further.
Mike |
|
|
|
|
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
|