|
|
View previous topic :: View next topic |
Author |
Message |
Robertz
Joined: 23 Mar 2010 Posts: 2
|
Problem with Motor Pwm Module commands on PCWHD V.4.104 |
Posted: Tue Mar 23, 2010 6:20 pm |
|
|
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
|
|
Posted: Tue Mar 23, 2010 7:52 pm |
|
|
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
|
|
Posted: Wed Mar 24, 2010 5:03 am |
|
|
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
|
|
Posted: Wed Mar 31, 2010 3:18 pm |
|
|
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. |
|
|
|
|
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
|