![](/media/cache/profiles/8a76780c6f3cd22891a6e7926fb9ad1c.jpg.50x50_q85.jpg)
Code from liamg with few edits to init seria comml and output counter.
Fork of MKL05CLK by
main.cpp@3:985a40825e8d, 2014-04-12 (annotated)
- Committer:
- donoman
- Date:
- Sat Apr 12 00:54:25 2014 +0000
- Revision:
- 3:985a40825e8d
- Parent:
- 2:1328c14aca66
- Child:
- 4:322eeda5453b
YEAH BOYEE;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
liamg | 0:0d020b1f3308 | 1 | #include "mbed.h" |
liamg | 0:0d020b1f3308 | 2 | #include "head.h" |
liamg | 0:0d020b1f3308 | 3 | |
liamg | 0:0d020b1f3308 | 4 | Serial pc(USBTX, USBRX); // tx, rx for debug terminal |
donoman | 3:985a40825e8d | 5 | //Serial testOut(PTC4,PTC3); |
liamg | 0:0d020b1f3308 | 6 | DigitalOut myled(LED1); |
liamg | 0:0d020b1f3308 | 7 | |
donoman | 1:dc4a581c6c4a | 8 | |
liamg | 0:0d020b1f3308 | 9 | int main() { |
donoman | 1:dc4a581c6c4a | 10 | |
donoman | 1:dc4a581c6c4a | 11 | int cycle = 0; |
donoman | 3:985a40825e8d | 12 | |
donoman | 3:985a40825e8d | 13 | SIM_SOPT2=0x4010080; |
donoman | 3:985a40825e8d | 14 | MCG_C2=0x25; //fast clock slow clock |
donoman | 3:985a40825e8d | 15 | MCG_SC=0x04; //divider |
donoman | 3:985a40825e8d | 16 | |
donoman | 3:985a40825e8d | 17 | SIM_SCGC5=0xF81; |
donoman | 2:1328c14aca66 | 18 | PORTC_PCR3=0x501; |
donoman | 1:dc4a581c6c4a | 19 | |
donoman | 1:dc4a581c6c4a | 20 | while(true){ |
donoman | 1:dc4a581c6c4a | 21 | pc.baud(9600); |
donoman | 2:1328c14aca66 | 22 | |
liamg | 0:0d020b1f3308 | 23 | myled = 1; |
liamg | 0:0d020b1f3308 | 24 | wait(0.2); |
liamg | 0:0d020b1f3308 | 25 | myled = 0; |
liamg | 0:0d020b1f3308 | 26 | wait(0.2); |
liamg | 0:0d020b1f3308 | 27 | |
donoman | 1:dc4a581c6c4a | 28 | unsigned int ID=0; |
donoman | 2:1328c14aca66 | 29 | unsigned int FU=0; |
donoman | 2:1328c14aca66 | 30 | unsigned int FU2=0; |
donoman | 3:985a40825e8d | 31 | unsigned char FU_TIM=0; |
donoman | 3:985a40825e8d | 32 | unsigned int FU_MAN=0; |
donoman | 1:dc4a581c6c4a | 33 | cycle++; |
liamg | 0:0d020b1f3308 | 34 | |
liamg | 0:0d020b1f3308 | 35 | ID=SIM_SDID; |
donoman | 2:1328c14aca66 | 36 | FU=SIM_SOPT2; |
donoman | 3:985a40825e8d | 37 | |
donoman | 3:985a40825e8d | 38 | //FU2=PORTC_PCR3; |
donoman | 3:985a40825e8d | 39 | //MCG_C1=0x3c; |
donoman | 3:985a40825e8d | 40 | |
donoman | 3:985a40825e8d | 41 | FU_TIM=MCG_C2; |
donoman | 3:985a40825e8d | 42 | FU_MAN=SIM_SCGC5; |
donoman | 2:1328c14aca66 | 43 | |
donoman | 2:1328c14aca66 | 44 | |
liamg | 0:0d020b1f3308 | 45 | pc.printf("Kinetis ID = %x \n",ID); |
donoman | 2:1328c14aca66 | 46 | pc.printf("SIM_SOPT2 = %x \n",FU); |
donoman | 3:985a40825e8d | 47 | //pc.printf("PORTC_PCR3 = %x \n",FU2); |
donoman | 3:985a40825e8d | 48 | pc.printf("MCG_C2 = %x \n",FU_TIM); |
donoman | 3:985a40825e8d | 49 | pc.printf("SIM_SCGC5 = %x \n",FU_MAN); |
donoman | 2:1328c14aca66 | 50 | |
donoman | 1:dc4a581c6c4a | 51 | pc.printf("CycleNo = %d \n", cycle); |
donoman | 2:1328c14aca66 | 52 | |
donoman | 2:1328c14aca66 | 53 | //testOut.printf("FUCKKK"); |
donoman | 1:dc4a581c6c4a | 54 | } |
liamg | 0:0d020b1f3308 | 55 | |
liamg | 0:0d020b1f3308 | 56 | |
liamg | 0:0d020b1f3308 | 57 | |
liamg | 0:0d020b1f3308 | 58 | } |
donoman | 2:1328c14aca66 | 59 |