| View previous topic :: View next topic |
| Author |
Message |
Jean FOUGERON
Joined: 30 Nov 2012 Posts: 110 Location: France
|
|
Posted: Tue May 28, 2013 7:48 am |
|
|
OK
I come back to #FUSE HS |
|
 |
Jean FOUGERON
Joined: 30 Nov 2012 Posts: 110 Location: France
|
|
Posted: Thu May 30, 2013 7:48 am |
|
|
| But the quickest I obtain is 26µs (520 time clock period), is that normal ? |
|
 |
Ttelmah
Joined: 11 Mar 2010 Posts: 20161
|
|
Posted: Thu May 30, 2013 7:59 am |
|
|
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
|
|
Posted: Thu Jun 06, 2013 1:41 am |
|
|
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. |
|
 |
|