|
|
View previous topic :: View next topic |
Author |
Message |
JaimeFC Guest
|
PCD Motor Control Functions |
Posted: Sun Jan 04, 2009 6:50 am |
|
|
Hi you all guys, I'm trying to use a DsPIC30f4012 to control 3 PWM with Hardware for Motor Control. PCD has no examples to do that, and PCD manual is very unuseful to do that, because functions are not explained at all. I've deduced that I have to use this:
Code: |
#include <30f4012.h>
#fuses PR,XT,NOWDT
#use delay(crystal=4mhz)
void main(void)
{
setup_motor_pwm(1,MPWM_FREE_RUN | MPWM_SYNC_OVERRIDES, 10000);
//set_motor_pwm_unit(1,MPWM_ENABLE);
//setup_motor_pmw_duty(1,0,0x55);
//set_motor_pmw_event(pwm,time);
//set_power_pwm0_duty(8000); //16383
while(true);
} |
Well, functions commented with // are not recognized by PCD 4.084, and looking at .h this is suposed to work...
Anyone have a working example to 3 pwm motor control module?? I think this is not really implemented on PCD although is 'explained' at compiler manual.
Best regards and thanks |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Sun Jan 04, 2009 10:33 am |
|
|
Quote: | I think this is not really implemented on PCD although is 'explained' at compiler manual. |
Yes, that's the most obvious conclusion. You should ask CCS support in this regard, however, if you want to get it working soon, you better access motor pwm through SFR directly. I have no 16-bit PICs with motor pwm unit and thus didn't try yet. Just can say, there are more cases of incomplete or inoperational PCD built-in functions. |
|
|
JaimeFC Guest
|
|
Posted: Mon Jan 05, 2009 6:17 am |
|
|
Thanks for your reply, I´ll try to contact with them. I think as you... that functions are not implemented (YET!) so I will have to configure through SFR.
Best regards |
|
|
JaimeFC Guest
|
|
Posted: Wed Jan 07, 2009 5:29 am |
|
|
I made it work in this way:
Code: |
#include <30f4012.h>
#fuses XT_PLL16,NOWDT,NOPUT,NOBROWNOUT
#use delay(clock=64mhz)
void main(void)
{
setup_compare(1, COMPARE_PWM | COMPARE_TIMER2);
setup_timer2(TMR_INTERNAL | TMR_DIV_BY_64,499);
set_pwm_duty(1, 250); // Duty 50%
while(true);
}
|
That is working with Compare Module but seems to be impossible to me with PWM module:
Code: |
#include <30f4012.h>
#fuses XT_PLL16,NOWDT,NOPUT,NOBROWNOUT
#use delay(clock=64mhz)
void main(void)
{
setup_motor_pwm(1,MPWM_FREE_RUN | MPWM_SYNC_OVERRIDES, 31999);
setup_motor_pwm_duty(1,0,10);
setup_motor_unit(1,MPWM_ENABLE,MPWM_FORCE_L_1,MPWM_FAULT_NO_CHANGE,0);
while(true);
}
|
|
|
|
Guest
|
|
Posted: Wed Jan 07, 2009 5:33 am |
|
|
By the way, although that functions are included as PCD functions on manual, they are not working, good ones seems to be this ones:
Code: |
#include <30f4012.h>
#fuses XT_PLL16,NOWDT,NOPUT,NOBROWNOUT
#use delay(clock=64mhz)
void main(void)
{
setup_motor_pwm(1,MPWM_FREE_RUN | MPWM_SYNC_OVERRIDES, 31999);
set_motor_pwm_duty(1,0,10);
set_motor_unit(1,MPWM_ENABLE,MPWM_FORCE_L_1,MPWM_FAULT_NO_CHANGE,0);
while(true);
}
|
But... nothing happens!! Please CCS guys any clue on this?? How could I configure PWM modules with SFR??? Something is wrong with PCD.....
best regards |
|
|
Guest
|
|
Posted: Thu Jan 08, 2009 8:22 am |
|
|
CCS support doesnt reply ... It´s a pity that a compiler like MicroC this is working properly and not in CCS.......... |
|
|
JaimeFC Guest
|
|
Posted: Tue Jan 20, 2009 3:47 pm |
|
|
please any help on this?? |
|
|
JaimeFC Guest
|
|
Posted: Thu Feb 19, 2009 11:25 am |
|
|
Any news on this?? Any chance CCS update his PCD manual someday?? |
|
|
|
|
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
|