Connect with us

One micro second execution

Discussion in 'Microcontrollers, Programming and IoT' started by electronicsLearner77, Jul 17, 2017.

Scroll to continue with content
  1. electronicsLearner77


    Jul 2, 2015
    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?
  2. Harald Kapp

    Harald Kapp Moderator Moderator

    Nov 17, 2011
    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.
    electronicsLearner77 likes this.
  3. Harald Kapp

    Harald Kapp Moderator Moderator

    Nov 17, 2011
    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: Jul 17, 2017
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day