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

SOLVED - dsPIC33fj64GS610 - PWM generation

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



Joined: 21 Dec 2011
Posts: 42

View user's profile Send private message

SOLVED - dsPIC33fj64GS610 - PWM generation
PostPosted: Sun Mar 20, 2016 9:08 am     Reply with quote

Hi,

I'm trying to generate a pwm signal but nothing...
I use for that an Explorer 16 dev. board + dsPIC33fj64gs610.

I give you my code:
Code:

setup_timer3(TMR_INTERNAL|TMR_DIV_BY_1|TMR_CONTINUE_IDLE);
setup_capture(1, capture_off);
setup_compare(1,COMPARE_PWM_FAULT|COMPARE_TIMER3);
set_pwm_duty(1,1000); ;

If you see a big mistake, tell me please !


Last edited by joseph20480 on Mon Mar 21, 2016 2:02 am; edited 1 time in total
Ttelmah



Joined: 11 Mar 2010
Posts: 19338

View user's profile Send private message

PostPosted: Sun Mar 20, 2016 10:02 am     Reply with quote

You are not giving the timer a 'time'. Second value for the setup, is the count at which it is to reset. So assuming (say) a 50% duty cycle:

setup_timer3(TMR_INTERNAL|TMR_DIV_BY_1, 2000);

Without this it'll default to 65535, so the actual pulse would be tiny.

I'm ignoring idle at the moment.

Then you have fault enabled. With this, the PWM will go off, unless the fault pin is in the clear state. Is it?. (OCFA).
joseph20480



Joined: 21 Dec 2011
Posts: 42

View user's profile Send private message

PostPosted: Mon Mar 21, 2016 2:05 am     Reply with quote

sure.....
thanks !
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