Connect with us

Microcontroller execution time

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

Scroll to continue with content
  1. electronicsLearner77

    electronicsLearner77

    159
    1
    Jul 2, 2015
    I have a timer and if i configure it for 1ms the execution time of main function from the beginning to end will be less compared to the same timer configured for 500 micro seconds. Is it correct? Or there will not be any difference. The controller is a pic. Please suggest.
     
  2. Minder

    Minder

    3,066
    657
    Apr 24, 2015
    Depends what source you are using to run the timer, if the system clock then it will depend on the freq of the clock (Fosc/4) and the pre-scale the timer is set for.
    You can pre load the timer with any value and then check the over flow after changing timer value.
    M.
     
    Last edited: Jul 15, 2017
  3. electronicsLearner77

    electronicsLearner77

    159
    1
    Jul 2, 2015
    I think i have not explained my question properly. My question was if i increase the frequency of timer interrupt (for that matter any interrupt) then it will load the sytem more and hence other functions will take more time to finish. Similarly if i decrease the timer interrupt frequency then less time for other functions to finish. Am i correct?
     
  4. Minder

    Minder

    3,066
    657
    Apr 24, 2015
    If the timer period is reduced and you are using a Interrupt location routine, Then obviously the more often the interrupt is called it will increase the time taken for non-interupt routines to perform their task etc.
    In some cases, instead of using the interrupt locations is to turn off GIE etc and just poll the interrupt bit, which will still be set regardless.
    M.
     
    electronicsLearner77 likes this.
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

-