Timeline for Adjust time calculation after Timer0 frequency change
Current License: CC BY-SA 3.0
23 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Feb 3, 2020 at 17:30 | history | protected | VE7JRO | ||
Feb 3, 2020 at 17:23 | answer | added | MJtheK | timeline score: 0 | |
Oct 12, 2016 at 13:37 | answer | added | Nerbsie | timeline score: 0 | |
Jul 17, 2015 at 20:59 | history | tweeted | twitter.com/#!/StackArduino/status/622148571824001024 | ||
Jul 17, 2015 at 14:23 | comment | added | Splitframe |
The code from above, just replace the delay(65000) with delayMicroseconds() . I put the value to 16000000L because I have a 16Mhz CPU. The LED just looks dim, but doesn't turn off and on every second. If I compare it with a simple millis() - startMillis the delay takes 5ms with 16000000L and 9ms with 128000000 .
|
|
Jul 17, 2015 at 10:04 | comment | added | Nick Gammon♦ |
It seems that delayMicroseconds() has the bug aswell. it doesn't even cause a ms delay. - Please post code that supports this assertion.
|
|
Jul 17, 2015 at 8:49 | vote | accept | Splitframe | ||
Jul 17, 2015 at 8:37 | answer | added | Edgar Bonet | timeline score: 4 | |
Jul 17, 2015 at 8:36 | comment | added | Jake C |
Strange, delayMicroseconds() uses a different mechanism than delay() so I was wondering if it might not be affected by this. I've posted an answer summarizing our findings.
|
|
Jul 17, 2015 at 8:34 | answer | added | Jake C | timeline score: 0 | |
Jul 17, 2015 at 8:25 | comment | added | Splitframe | It seems that delayMicroseconds() has the bug aswell. it doesn't even cause a ms delay. | |
Jul 17, 2015 at 8:25 | comment | added | Jake C | Also, what version of Arduino are you using? | |
Jul 17, 2015 at 8:18 | comment | added | Jake C | Ah, that makes sense due to how these functions are set up in wiring.c. Can you try something for me, try running delayMicroseconds(1000000); and let me know if that is more accurate. | |
Jul 17, 2015 at 8:07 | comment | added | Splitframe | Oh I just noticed... when I can use millis() to measure the, well, millis and they seem correct, then this implies that the internal timekeeping is alright. Just delay seems to have a bug. sigh Anyway. Thanks for helping Jake! | |
Jul 17, 2015 at 7:50 | comment | added | Splitframe | No I don't have one. I have an LED that blinks with the code above and now I added a Serial output to the arduino IDE. When I put the delay at 200000 I get approx. 1050ms | |
Jul 17, 2015 at 7:40 | comment | added | Jake C | How are you measuring? Do you have an oscilloscope by chance? | |
Jul 17, 2015 at 7:33 | history | edited | Splitframe | CC BY-SA 3.0 |
added code
|
Jul 17, 2015 at 7:29 | comment | added | Splitframe | That is the weird thing, the real value seems to be really arbitrary. I tried two nanos and one Uno, both have the same results. And when I try to calculate the the value for delay I get 64000, but when I insert that it's only like 800ms instead of 1000ms. For testing purpose I already threw out all #includes it's just the Register change and digitalWrite and delay now. | |
Jul 17, 2015 at 7:22 | comment | added | Jake C |
I don't know what to say, by all means that should work. Another option would be to just scale the times yourself. You could wrap this in a macro a la #define SCALE_UP(x) x<<6 and then use it like such delay(SCALE_UP(1000))
|
|
Jul 17, 2015 at 7:04 | comment | added | Splitframe | When I clean the tmp folder and verify anew he shows: This. And that is also the wiring.c I corrected :( | |
Jul 17, 2015 at 6:52 | comment | added | Jake C | All of your settings are correct. My best guess if you maybe modified the wrong wiring.c. The best way to diagnose this is to go to File > Preferences and check the compilation checkbox under "Show verbose output during". Then click verify, copy the output into a text editor and search for wiring.c and see where it is pulling it from, then open the file and verify that your changes are there. | |
Jul 17, 2015 at 6:08 | review | First posts | |||
Jul 18, 2015 at 15:27 | |||||
Jul 17, 2015 at 6:06 | history | asked | Splitframe | CC BY-SA 3.0 |