LDR R7,=LPC_SCT1_BASE @ set up SCT for capture MOVW R0,#0b1000000001 @ INSYNC ON; 32-bit counter STR R0,[R7,CONFIG] @ 32-bit timer, prescaled bus clock MOVS R0,#3 STR R0,[R7,REGMODE] @ capture on reg 0 MOVW R0,#0x6800 @ Event 0 STR R0,[R7,EV0_CTRL] @ capture rising edge on input #0 MOVS R0,#0x1 STR R0,[R7,EV0_STATE] @ remain in state 0 MOVW R0,#0x6400 @ Event 1 STR R0,[R7,EV1_CTRL] @ capture falling edge on input #0 MOVS R0,#0x1 STR R0,[R7,EV1_STATE] @ remain in state 0 MOVS R0,#3 STR R0,[R7,CAPCTRL0] MOVS R0,#3 STR R0,[R7,EVEN] @ events 0 and 1 cause interrupt MOVS R0,#3 STR R0,[R7,LIMIT] @ and reset counter MOVW R0,#0b10110000100 STR R0,[R7,SCTCTRL] @ prescale by 45 = 1µs per count LDR R7,=ISER0 MOVS R0,#1<<17+1<<21 STR R0,[R7] LDR R7,=LPC_INMUX_BASE MOVS R0,#1 STR R0,[R7,SCT1_INMUX0] @ input #0 is pin 32 (PIO0_16) |