Hi forum, Im using Arduino uno I need to generate an interrupt every 50us. But there shouldn't be any timers used. Is it possible?
(there are 6 pwm pins in this controller which used timer to generate pwm signal. I need all the 6 pwm channel for other load. So i cant use timer to generate an interrupt)
Then you will need an external clock with a 50uS period connected to one of the external interrupt pins.
You need something that will trigger an interrupt at a pre-defined rate. That must either be a timer or... um... a timer. Either internal or external. You can't just magic an interrupt from thin air, it has to have a trigger.
Timer uses 2 Output Compare vector to generate 2 PWM outputs. There is an example for 328 uCPU:
8 0x000E TIMER2 COMPA Timer/Counter2 Compare Match A
9 0x0010 TIMER2 COMPB Timer/Counter2 Compare Match B
10 0x0012 TIMER2 OVF Timer/Counter2 Overflow
11 0x0014 TIMER1 CAPT Timer/Counter1 Capture Event
12 0x0016 TIMER1 COMPA Timer/Counter1 Compare Match A
13 0x0018 TIMER1 COMPB Timer/Coutner1 Compare Match B
14 0x001A TIMER1 OVF Timer/Counter1 Overflow
15 0x001C TIMER0 COMPA Timer/Counter0 Compare Match A
16 0x001E TIMER0 COMPB Timer/Counter0 Compare Match B
17 0x0020 TIMER0 OVF Timer/Counter0 Overflow
Probably, you could set Timer Overflow Interrupt for your timing-clock generation. It'd would require manual AVR programming, as I'd expect any library would mix up each other settings (analogWrite not exception). the Timer has only one pre-scaler, so two freq. ( PWM and Clock ) must be properly scaled. Time to dig into data-sheet ]