-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is millis() a bit slow? #8
Comments
I realize now that I'm adding 19 every interrupt, while your code adds 16. I'm not familiar with assembly at all, so how can your code be modified to add 19 instead of 16? IIRC, I'm adding 19 because almost all ATtiny13 WDT oscillators are too slow. |
@nerdralph do you have time to look at this? Your millis code is superior to the one that MicroCore uses, but as I explained earlier, would like to add 19 instead of 16. |
One of the things I did with picoCore was to reduce interrupt latency and minimize the time spent in interrupts: less time in interrupts means more cycles available for user code. The original millis() asm code I wrote for MicroCore did the math (19 WDT interrupts per ms) inside the interrupt. picoCore just increments a 16-bit millis count (pinned to r2 & r3) in the interrupt, then does the multyply (x16 in this case) in the millis() code. I picked x16 because it is pretty close with the t85, and a lot less code than x19 due to the fact that x16 can be done with a few shifts. I'll ruminate on it. |
Thanks! Please let me know if you come up with a solution that would work. After this, I'll probably release a new MicroCore boards manager version |
Hi!
I was going through some older MicroCore issues when I discovered that PicoCore had an updated version of your millis implementation that compiles down to a smaller size than the one MicroCore uses today.
Before copying your implementation, I decided to test how it performs compared to the one MicroCore uses today.
I've been using a dedicated frequency counter and the code below for testing.
What's interesting is that with picoCore, the period time is 9.432 s, but with MicroCore, it's 7.958 s. I know the internal 128kHz oscillator isn't that accurate but is a deviation like this correct?
The text was updated successfully, but these errors were encountered: