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

TIMER 2
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
Jean FOUGERON



Joined: 30 Nov 2012
Posts: 110
Location: France

View user's profile Send private message Visit poster's website

PostPosted: Tue May 28, 2013 7:48 am     Reply with quote

OK
I come back to #FUSE HS
Jean FOUGERON



Joined: 30 Nov 2012
Posts: 110
Location: France

View user's profile Send private message Visit poster's website

PostPosted: Thu May 30, 2013 7:48 am     Reply with quote

But the quickest I obtain is 26µs (520 time clock period), is that normal ?
Ttelmah



Joined: 11 Mar 2010
Posts: 20161

View user's profile Send private message

PostPosted: Thu May 30, 2013 7:59 am     Reply with quote

Yes.

It takes typically 60 to 65 instructions to get into and out of an ISR.
Each instruction takes four clocks.
A cycle of the output will take two interrupts.

65*4*2 = 520 clocks.

This is why if you want fast clocks, you use a PWM, not an interrupt.

Best Wishes
Jean FOUGERON



Joined: 30 Nov 2012
Posts: 110
Location: France

View user's profile Send private message Visit poster's website

PostPosted: Thu Jun 06, 2013 1:41 am     Reply with quote

Yes it is better with

Code:
setup_power_pwm_pins(PWM_COMPLEMENTARY,PWM_OFF,PWM_OFF,PWM_OFF);
      //PPWM channels 0 and 1 are both on and always opposite values
   setup_power_pwm(PWM_CLOCK_DIV_4|PWM_FREE_RUN,1,0,PERIODE,0,1,0);


and

Code:
if(B_Interrupt1_seen)
      {
         B_Interrupt1_seen=FALSE;
         if (B_BF) set_power_pwm0_duty(L_Periode); else set_power_pwm0_duty(0);
         Output_toggle(PIN_B6);
      }

in main

Thanks for your help.
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