Code from liamg with few edits to init seria comml and output counter.

Dependencies:   mbed

Fork of MKL05CLK by Liam G

Revision:
3:985a40825e8d
Parent:
2:1328c14aca66
Child:
4:322eeda5453b
--- a/main.cpp	Fri Apr 11 02:34:27 2014 +0000
+++ b/main.cpp	Sat Apr 12 00:54:25 2014 +0000
@@ -2,15 +2,20 @@
 #include "head.h"
 
 Serial pc(USBTX, USBRX); // tx, rx for debug terminal
-Serial testOut(PTC4,PTC3);
+//Serial testOut(PTC4,PTC3);
 DigitalOut myled(LED1);
 
 
 int main() {
     
     int cycle = 0;
+    
+    SIM_SOPT2=0x4010080;
+    MCG_C2=0x25; //fast clock slow clock
+    MCG_SC=0x04; //divider
+    
+    SIM_SCGC5=0xF81;
     PORTC_PCR3=0x501;
-    SIM_SOPT2=0x4010080;
     
     while(true){
         pc.baud(9600);
@@ -23,20 +28,25 @@
         unsigned int ID=0;
         unsigned int FU=0;
         unsigned int FU2=0;
-        unsigned int FU_TIM=0;
+        unsigned char FU_TIM=0;
+        unsigned int FU_MAN=0;
         cycle++;
     
     ID=SIM_SDID;
      FU=SIM_SOPT2;
-    // PORTC_PCR3=0x501;
-    FU2=PORTC_PCR3;
-    FU_TIM=MCG_C1;
+  
+    //FU2=PORTC_PCR3;
+    //MCG_C1=0x3c;
+    
+    FU_TIM=MCG_C2;
+    FU_MAN=SIM_SCGC5;
     
     
     pc.printf("Kinetis ID = %x \n",ID);
     pc.printf("SIM_SOPT2 = %x \n",FU);
-    pc.printf("PORTC_PCR3 = %x \n",FU2);
-    pc.printf("MCG_C1 = %x \n",FU_TIM);
+    //pc.printf("PORTC_PCR3 = %x \n",FU2);
+    pc.printf("MCG_C2 = %x \n",FU_TIM);
+    pc.printf("SIM_SCGC5 = %x \n",FU_MAN);
 
     pc.printf("CycleNo = %d \n", cycle);