Using multiple interrupt at same time in different frequencies.

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

Post Reply
Renjith
Posts: 12
Joined: Wed Jul 23, 2014 4:13 am
Has thanked: 2 times
Been thanked: 1 time
Contact:

Using multiple interrupt at same time in different frequencies.

Post by Renjith »

is it possible to use two or more timer interrupts in different frequencies with accurate timing, is interfere one another one ?
Renjith.

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Using multiple interrupt at same time in different frequencies.

Post by medelec35 »

Yes, you can.
There may be instances where more than one interrupts will want to trigger at the same time.
If that did happen then the interrupt that triggered slightly ahead will be serviced first.
The other interrupt will wait until the service routine has finished.

Alternatively, you could get an interrupt to trigger every 1ms
Then use a variable to make an event happen every 5 ms and another event every 10 ms etc.
I could post an example if required?
Martin

Renjith
Posts: 12
Joined: Wed Jul 23, 2014 4:13 am
Has thanked: 2 times
Been thanked: 1 time
Contact:

Re: Using multiple interrupt at same time in different frequencies.

Post by Renjith »

Thank you very much…………..I mean timer Interrupt.
Please post an example as said above, actually I need an example as below if possible please.
timer Interrupt no.1 need to be fire every 400us (2500 Hz) for read 4 ADC component. timer Interrupt no. 2 need to be fire every 50us to generate Incremental duty cycle PWM (20000 Hz). Both should be run without affecting frequency of one another.

Renjith.

Post Reply