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 support@ccsinfo.com

Example using motor PWM with DSPIC30F2010

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



Joined: 23 Nov 2011
Posts: 197
Location: Brazil

View user's profile Send private message

Example using motor PWM with DSPIC30F2010
PostPosted: Mon Dec 23, 2013 8:41 pm     Reply with quote

Example using motor PWM with DSPIC30F2010:


Just for sharing with people who needs it:

It´s a little confuse understanding how motor pwm works, but, for example, it is possible to adjust it for several configurations.

In the example below I set it for generating two different PWM with inverted outputs. The other 4 PWM pins of DSPIC30F2010 remain disabled(can be used for others things or io ports).

Code:
//MOTOR PWM(using example)

setup_timer1(TMR_INTERNAL,3333);     //setups PWM frequency               
setup_motor_pwm(1,MPWM_FREE_RUN,1,0,255); //setups PWM
//
set_motor_unit(1,1,MPWM_ENABLE_L,1,1);  //setups first PWM
set_motor_pwm_duty(1,1,20);      //Adjusts first pwm duty
set_motor_unit(1,2,MPWM_ENABLE_L,1,1);  //setups second PWM
set_motor_pwm_duty(1,2,100);     //Adjusts second pwm duty





Good luck folks!! ;)
Have a very merry Xmas *<:o)
_________________
Eduardo Guilherme Brandt
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