Simon Ford
/
PLL
Revision 0:7ebf892f4561, committed 2009-11-29
- Comitter:
- simon
- Date:
- Sun Nov 29 11:29:59 2009 +0000
- Commit message:
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r 7ebf892f4561 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun Nov 29 11:29:59 2009 +0000 @@ -0,0 +1,26 @@ +#include "mbed.h" + +int main() { + int Fin = 12000000; // 12MHz XTAL + + printf("PLL Registers:\n"); + printf(" - PLL0CFG = 0x%08X\n", LPC_SC->PLL0CFG); + printf(" - CLKCFG = 0x%08X\n", LPC_SC->CCLKCFG); + + int M = (LPC_SC->PLL0CFG & 0xFFFF) + 1; + int N = (LPC_SC->PLL0CFG >> 16) + 1; + int CCLKDIV = LPC_SC->CCLKCFG + 1; + + printf("Clock Variables:\n"); + printf(" - Fin = %d\n", Fin); + printf(" - M = %d\n", M); + printf(" - N = %d\n", N); + printf(" - CCLKDIV = %d\n", CCLKDIV); + + int Fcco = (2 * M * 12000000) / N; + int CCLK = Fcco / CCLKDIV; + + printf("Clock Results:\n"); + printf(" - Fcco = %d\n", Fcco); + printf(" - CCLK = %d\n", CCLK); +}
diff -r 000000000000 -r 7ebf892f4561 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sun Nov 29 11:29:59 2009 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/32af5db564d4