Navigation

    • Register
    • Login
    • OpenHardware.io
    • Categories
    • Recent
    • Tags
    • Popular
    1. Home
    2. n8falke
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    n8falke

    @n8falke

    0
    Reputation
    1
    Posts
    173
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    n8falke Follow

    Best posts made by n8falke

    This user hasn't posted anything yet.

    Latest posts made by n8falke

    • RE: Flickering problem with RGB leds and a simple solution

      Some background, why the solution works without changing the timer prescale:
      The default prescale of all timers are 64, so they should work the same, but the default mode is different:
      Timer 0: Fast PWM mode = 0..255,0..255,... (timer is used for internal calculations millis() / delay() /..., so this setting is required)
      Timer 2: Phase-correct mode = 0..255..0..255...
      Timer 1 is 16 bit and the pins are blocked by the radio, so I'll leave them out here.
      The frequency of the timer is comparable to a timer round trip (values are calculated with a 16 MHz IO-frequency like with ATmega168 or ATmega328 used in nano):
      Timer 0: 16 MHz / 64 / 256 = 976.5625 Hz
      Timer 2: 16 MHz / 64 / 510 = 490.1961 Hz
      Fast PWM uses 0..255 = 256 for a round trip.
      Phase-corrected mode uses 0..255,254..1 = 256 + 254 = 510 (all numbers are double except 0 and 255!)

      NOW the command:
      TCCR2A |= _BV(WGM21);
      Switches timer 2 to fast PWM mode (mode from 1 to 3).

      In addition to the links above, here I found the default settings: http://playground.arduino.cc/Main/TimerPWMCheatsheet

      posted in Troubleshooting
      n8falke
      n8falke