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

DSPIC33 PWM Setup
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
jeremiah



Joined: 20 Jul 2010
Posts: 1410

View user's profile Send private message

PostPosted: Fri May 05, 2017 6:39 pm     Reply with quote

What makes you think that the timer two period value isn't working? Is it because of the PWM? Various things can cause that. For example, on some dsPICs and PIC24s there is a SYNC option that must be specified for the PWM to work. If it isn't specified, changing the period can have no effect.

Have you just tested timer2 by itself? I bet if you do a quick program with just timer two and have the interrupt toggle an IO that it will work


Code:


#int_timer2
void timer2_isr(){
   output_toggle(PIN_E0);
}

void main()
{
   setup_timer2(TMR_INTERNAL | TMR_DIV_BY_8, 0x61A7);
   enable_interrupts(INT_TIMER2);
   enable_interrupts(GLOBAL);
   while(TRUE);
}


See if changing the period parameter changes your pin toggling time. If it does, then you need to find the right PWM option most likely.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
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