Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of ClockControl by
Diff: main.cpp
- Revision:
- 2:6a9131b3df01
- Parent:
- 0:b5d3bd64d2dc
--- a/main.cpp Thu Sep 03 08:50:31 2015 +0000 +++ b/main.cpp Thu Sep 03 09:26:56 2015 +0000 @@ -3,49 +3,47 @@ #include "CoreMark/core_portme.h" int main() { - while(1) { - printf("mbed Clock Control test\r\n"); - printf("(c) 2010 Michael Wei\r\n"); + printf("(c) 2015 Simon_mbed\r\n"); - unsigned short newM = 12; - unsigned short newN = 1; +// unsigned short newM = 12; +// unsigned short newN = 1; - printf("Value of M? (default = 12):\r\n"); - scanf("%d", &newM); +// printf("Value of M? (default = 12):\r\n"); +// scanf("%d", &newM); +// +// printf("Value of N? (default = 1):\r\n"); +// scanf("%d", &newN); - printf("Value of N? (default = 1):\r\n"); - scanf("%d", &newN); +// setSystemFrequency(0x3, 0x1, newM, newN); - setSystemFrequency(0x3, 0x1, newM, newN); - - Serial pc(USBTX, USBRX); // tx, rx + //This code by Simon Ford: http://mbed.org/forum/mbed/topic/229/?page=1#comment-1225 - int Fin = 12000000; // 12MHz XTAL - pc.printf("PLL Registers:\r\n"); - pc.printf(" - PLL0CFG = 0x%08X\r\n", LPC_SC->PLL0CFG); - pc.printf(" - CLKCFG = 0x%08X\r\n", LPC_SC->CCLKCFG); - - int M = (LPC_SC->PLL0CFG & 0xFFFF) + 1; - int N = (LPC_SC->PLL0CFG >> 16) + 1; - int CCLKDIV = LPC_SC->CCLKCFG + 1; +// int Fin = 12000000; // 12MHz XTAL +// pc.printf("PLL Registers:\r\n"); +// pc.printf(" - PLL0CFG = 0x%08X\r\n", LPC_SC->PLL0CFG); +// pc.printf(" - CLKCFG = 0x%08X\r\n", LPC_SC->CCLKCFG); +// +// int M = (LPC_SC->PLL0CFG & 0xFFFF) + 1; +// int N = (LPC_SC->PLL0CFG >> 16) + 1; +// int CCLKDIV = LPC_SC->CCLKCFG + 1; +// +// pc.printf("Clock Variables:\r\n"); +// pc.printf(" - Fin = %d\r\n", Fin); +// pc.printf(" - M = %d\r\n", M); +// pc.printf(" - N = %d\r\n", N); +// pc.printf(" - CCLKDIV = %d\r\n", CCLKDIV); +// +// int Fcco = (2 * M * 12000000) / N; +// int CCLK = Fcco / CCLKDIV; - pc.printf("Clock Variables:\r\n"); - pc.printf(" - Fin = %d\r\n", Fin); - pc.printf(" - M = %d\r\n", M); - pc.printf(" - N = %d\r\n", N); - pc.printf(" - CCLKDIV = %d\r\n", CCLKDIV); - - int Fcco = (2 * M * 12000000) / N; - int CCLK = Fcco / CCLKDIV; - - pc.printf("Clock Results:\r\n"); - pc.printf(" - Fcco = %d\r\n", Fcco); - - printf(" - CCLK = %d\r\n", CCLK); +// pc.printf("Clock Results:\r\n"); +// pc.printf(" - Fcco = %d\r\n", Fcco); +// +// printf(" - CCLK = %d\r\n", CCLK); printf("Run CoreMark? (Y/N)\n"); char buf[8]; @@ -54,8 +52,4 @@ { mainCoreMark(); } - - wait(1); - NVIC_SystemReset(); - } }