manu jose
/
6hrslave
B.3 PROGRAM .SLAVE
Diff: problemb1.h
- Revision:
- 1:695db1757630
- Parent:
- 0:9092ea8d9a6c
--- a/problemb1.h Sat Dec 04 05:09:46 2010 +0000 +++ b/problemb1.h Tue Dec 14 23:26:42 2010 +0000 @@ -44,7 +44,7 @@ //LPC_TIM0->MR0 = 0x5370; if (LPC_TIM0->IR&1) { gTime++; - pc.printf("gtime++ %X",LPC_TIM0->IR); + // pc.printf("gtime++ %X",LPC_TIM0->IR); } if((LPC_TIM0->IR >> 1)&1 ){ //RUN THE RUNAT TIME HIT @@ -126,7 +126,7 @@ } void runAtTrigger(void(*trigFunc)(timeval *tv)) { gtrigFunc = trigFunc; - trig.rise(&trigger); + // trig.rise(&trigger); // pc.printf("Runing runAtTrigger\n"); } @@ -168,7 +168,7 @@ sync.attach(&calculate_offset); - //pc.printf(" \n t1= %X, t2 = %X, t3 = %X, t4 = %X",t1.t,t2.t,t3.t,t4.t); + // pc.printf(" \n t1= %X, t2 = %X, t3 = %X, t4 = %X",t1.t,t2.t,t3.t,t4.t); // account for the case where the TC has overflowed. @@ -192,20 +192,29 @@ if(LPC_TIM0->TC > RESET_42) LPC_TIM0->TC = LPC_TIM0->TC - RESET_42; + // pc.printf(" offset = %d\n",offset); offset = 0; while(sync.readable()) sync.getc(); - //pc.printf(" offset = %d\n",offset); + } void pinToggle(void) { + toggle = !toggle; - myLED = !myLED; - // pc.printf("\nToggle"); - pps.tv_sec++; + myLED = !myLED; + // pc.putc('T'); +// pc.printf("\nToggle"); + pps.tv_usec+=500000; + if(pps.tv_usec == 1200000) + { + pps.tv_usec = 200000; + pps.tv_sec++; + } + runAtTime(&pinToggle,&pps); }