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

need more example PWM using pcd for DSPIC33FJ256MC710

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



Joined: 21 Feb 2008
Posts: 7

View user's profile Send private message

need more example PWM using pcd for DSPIC33FJ256MC710
PostPosted: Tue Feb 26, 2008 11:52 pm     Reply with quote

hi, can any one send me other example of PWM using pcd for DSPIC33FJ256MC710. the example in picc is not very helpful.
i need more example:
my problem is which pin is my pwm output??
how to setup pwm -40khz??

Here is the thing i can't understand from example:

/* PWM EXAMPLE FOR 16-BIT PICS */

do {

// The cycle time will be (1/clock)*4*t2div*(period+1)
// In this program clock=20000000 and period=127 (below)
// For the three possible selections the cycle time is:
// (1/20000000)*4*1*65473 = 13.1 ms or 76.37 hz
why here not using 128 and why 65473???
// (1/20000000)*4*8*65473 = 104.7 ms or 9.55 hz
// (1/20000000)*4*64*65473 = 838.1 ms or 1.19 hz

case '1' : setup_timer2(TMR_INTERNAL | TMR_DIV_BY_1, 0xFFC0);

setup_compare(1, COMPARE_PWM | COMPARE_TIMER2);

set_pwm_duty(1,value * (int16)64);
what this part means??
can i just put
mtspeed is my adc in put
set_pwm_duty(mtspeed);


Thank you.
Guest








PostPosted: Fri Mar 07, 2008 7:32 am     Reply with quote

setup_timer2(TMR_INTERNAL | TMR_DIV_BY_1, 750); //set period to 750 for 40kHz PWM at 120MHz
setup_compare(2, COMPARE_PWM | COMPARE_TIMER2); // firts number that is 2 sets OC2 PIN (1 for OC1...etc)

set_pwm_duty(2,value); // value must be lower than period(0-750)
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