Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 4 of 4

Thread: elapsedMillis ?

  1. #1
    Member
    Join Date
    May 2014
    Location
    Black Forest Colorado
    Posts
    74

    elapsedMillis ?

    I'm using an elapsedMillis timer with the audio library and it doesn't seem to keep accurate time. It seems to be running at about half speed. Is there some interaction possibly with interrupts that is causing this? Or is this a figment of my imagination ?

    Thanks

  2. #2
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    9,668
    That sounds odd, I've found them to work even doing FFT's and counting seconds for perf counts - likely need more details to understand or reproduce

  3. #3
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,544
    Quote Originally Posted by craiglindley View Post
    Or is this a figment of my imagination ?
    I'm going to go with this explanation for now. But I'll quickly change my tune if you post a program which I can run here on a Teensy to reproduce the problem.

  4. #4
    Senior Member
    Join Date
    Jan 2013
    Posts
    843
    It seems possible. elapsedMillis is based on millis(), which in turn uses a systick counter which is incremented in an ISR at 1000Hz. If you disable interrupts for more than 1ms, you are going to loose systick interrupts.

    millis() would be affected, that should be easy for you to check.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •