Maker Pro
Maker Pro

One micro second execution

electronicsLearner77

Jul 2, 2015
306
Joined
Jul 2, 2015
Messages
306
To perform high critical time tasks is it ok to create 1 micro second timer interrupt. Is it recommended? I am asking this in general for all controllers. The sytem will end up doing only timer task in this case?
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,722
Joined
Nov 17, 2011
Messages
13,722
The interrupt needs to become active as often as required. If your task asks for repetition in 1 µs intervalls then this is as it is.
How much the controler can work outside the interrupt routine depends on the length of the interrupt routine (interrupt routines always should be as short as possible) and on the speed of the controller:
  • A controller operated from a 1 MHz clock will not be able to do anything, not even within the interrupt routine as the interrupts come at the same rate as the clock frequency.
  • A controller operated from a 50 MHz clock can at least perform 49 operations between 2 interrupts (assuming 1 operation per clock cycle).
  • A controller operatde from a 50 MHz clock with pipelined instruction processing may be able to perform many more operations.
You see: your question cannot be answered in a completely general and generic way.

On the other hand, inspect your requirements carefully: do you really need one interrupt every 1 µs? Would it be possible to outsource the operation from the interrupt routine into external hardware which would pre-process the data and interrupt the controller less often?
An example of the latter is digital filtering of an input signal. You can do the filtering in real time using the controller but you may have a heavy load on the controller. You could also use a hardwired external filter, e.g. in an FPGA, and use the controler to process the already filtered signal at a much lower data rate.
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,722
Joined
Nov 17, 2011
Messages
13,722
Back to business: The question is about processing interrupt signal at high speed with a microcontroller. Where the fast interrupts come from is an entirely other matter. "switches" that fast are known as transistors to the adept.



[mod tidy up]
 
Last edited by a moderator:
Top