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

Problem with Motor Pwm Module commands on PCWHD V.4.104

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



Joined: 23 Mar 2010
Posts: 2

View user's profile Send private message

Problem with Motor Pwm Module commands on PCWHD V.4.104
PostPosted: Tue Mar 23, 2010 6:20 pm     Reply with quote

Hi,
I have made a project with a dsPIC33FJ128MC202, and I can't use the motor pwm modules commands. My version is PCWHD 4.104.
And the compiler gave my the following errors:
Quote:

Error 12 - Unknown identifier --setup_motor_pwm

This is the line 12:
Code:

setup_motor_pwm(1,MPWM_FREE_RUN | MPWM_SYNC_OVERRIDES, timebase);

Why? Thank you.
robomaniac



Joined: 16 Jul 2009
Posts: 19
Location: Sherbrooke, Québec, Canada

View user's profile Send private message Visit poster's website

PostPosted: Tue Mar 23, 2010 7:52 pm     Reply with quote

People on this forum will ask, send the complete code.

Unknown identifier means it does not understand something. That thing can be 1 or more then one parameter.

open 33FJ128MC202.H file

MPWM_FREE_RUN and MPWM_SYNC_OVERRIDES are not in the .H file

Also timebase is not define, you wrote timebase and not a number
Code:

setup_motor_pwm(pwm,options, timebase);
setup_motor_pwm(pwm,options,prescale,postscale,timebase)

Also look at line 152 of 33FJ128MC202.H file.
It tells you what SET_PWM_DUTY takes as parameter.
_________________
Jérôme Demers
www.jeromedemers.com
Robertz



Joined: 23 Mar 2010
Posts: 2

View user's profile Send private message

PostPosted: Wed Mar 24, 2010 5:03 am     Reply with quote

Yes, but substituting identifiers with numbers, the problem will occour because (i think) the problem is " setup_motor_pwm " function and not the parameters.

For example, I have tried to write "delay_ms(pluto);" and the compiler error is: "Error 12 - Unknown identifier pluto" and not delay_ms.

I think that the compiler for this pic do not recognize the function "setup_motor_pwm".
idjanos



Joined: 31 Mar 2010
Posts: 1

View user's profile Send private message

PostPosted: Wed Mar 31, 2010 3:18 pm     Reply with quote

You must initialize the PWM timebase.
Code:

#int_PWM1 //it works with dsPIC30F2010 but you sould look at the .h file
void main(){
enable_interrupts(INT_PWM1);
setup_motor_pwm(1,MPWM_FREE_RUN|MPWM_INDEPENDENT,1,1,100);
set_motor_unit(1,1,MPWM_FORCE_L_0,0,0);
set_motor_pwm_duty(1,1,255-i);

It works, but I have a problem: it works just in complementary mode.
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