Skip to main content
Arduino

Timeline for Help managing the fallout from timer0 mode and prescaler change on ATMega2560 without modifying wiring.c

Current License: CC BY-SA 3.0

10 events
when toggle format what by license comment
Oct 27, 2017 at 1:02 vote accept Nerbsie
Nov 14, 2016 at 10:20 history tweeted twitter.com/StackArduino/status/798108452824514560
Nov 13, 2016 at 20:45 history bumped Community Bot This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
Oct 14, 2016 at 20:29 history edited Nerbsie CC BY-SA 3.0
Included sentence indicated other timer settings
Oct 14, 2016 at 9:59 answer added Edgar Bonet timeline score: 2
Oct 13, 2016 at 19:02 comment added Nerbsie I think you are right actually, and I think the interrupt that is causing this mistake could actually be the timer overflow interrupts. By changing the clock speeds (I actually increased the clock speed of all PWM timers) I caused each clocks TOVn interrupt flag to be raised every 31.875us, as opposed to the standard operation which is every 1024us.
Oct 13, 2016 at 18:00 comment added Nerbsie Yes, timer0 must be used here. The code does use interrupts, which might be effecting this (I hadn't notice that delayMicroseconds() doesn't utilize micros(), which blocks interrupts; I assumed it did since delay() does) - although I am using a scope to measure the output (toggling a pin on either side of the delay) and the delay is repeatable, where-as our interrupts may happen at any time during the code. If it is an interrupt causing the issue I would expect the delay to vary as the loop runs, which it does not. I'll do my best to read through the source code for delayMicroseconds()
Oct 13, 2016 at 15:23 comment added Gerben You might want to check the Arduino source code. It seems like delayMicroseconds doesn't even use timer0. Does your code use any interrupts, as that would skew the result of delayMicroseconds? Did you run out of PWM pins on the Mega, that you need to use timer0?
Oct 13, 2016 at 15:01 history edited Nerbsie CC BY-SA 3.0
added 4 characters in body
Oct 13, 2016 at 14:45 history asked Nerbsie CC BY-SA 3.0

AltStyle によって変換されたページ (->オリジナル) /