PLL
Published 29 Nov 2009, by
Simon Ford

No tags
« Back to documentation index
Show/hide line numbers
main.cpp Source File
main.cpp
00001 #include "mbed.h"
00002
00003 int main() {
00004 int Fin = 12000000;
00005
00006 printf("PLL Registers:\n");
00007 printf(" - PLL0CFG = 0x%08X\n", LPC_SC->PLL0CFG);
00008 printf(" - CLKCFG = 0x%08X\n", LPC_SC->CCLKCFG);
00009
00010 int M = (LPC_SC->PLL0CFG & 0xFFFF) + 1;
00011 int N = (LPC_SC->PLL0CFG >> 16) + 1;
00012 int CCLKDIV = LPC_SC->CCLKCFG + 1;
00013
00014 printf("Clock Variables:\n");
00015 printf(" - Fin = %d\n", Fin);
00016 printf(" - M = %d\n", M);
00017 printf(" - N = %d\n", N);
00018 printf(" - CCLKDIV = %d\n", CCLKDIV);
00019
00020 int Fcco = (2 * M * 12000000) / N;
00021 int CCLK = Fcco / CCLKDIV;
00022
00023 printf("Clock Results:\n");
00024 printf(" - Fcco = %d\n", Fcco);
00025 printf(" - CCLK = %d\n", CCLK);
00026 }