Aus SatriaWiki
Wechseln zu: Navigation, Suche
(Die Seite wurde neu angelegt: „== Code snippets == === Change clock speed === <code><poem> #define CLOCK_SPEED_16MHZ 0 #define CLOCK_SPEED_8MHZ 1 #define CLOCK_SPEED_4MHZ 2 #define CLOCK_SPE…“)
(kein Unterschied)

Version vom 9. Juni 2020, 07:48 Uhr

Code snippets

Change clock speed

  1. define CLOCK_SPEED_16MHZ 0
  2. define CLOCK_SPEED_8MHZ 1
  3. define CLOCK_SPEED_4MHZ 2
  4. define CLOCK_SPEED_2MHZ 3
  5. define CLOCK_SPEED_1MHZ 4
  6. define CLOCK_SPEED_500KHZ 5
  7. define CLOCK_SPEED_250KHZ 6
  8. define CLOCK_SPEED_125KHZ 7

volatile void setClockSpeed(byte speed)
{
  CLKPR = 0b10000000; // enable clock change
  CLKPR = speed;
}

void setup()
{
  setClockSpeed(CLOCK_SPEED_8MHZ);
}