hi all, having problem with measurement of pulse width.i am generating a PWM at P1.2 and loping it back to timer B catpure input pin at P4.2. need to capture the width. it is not going to the ISR for timerB #include "msp430x13x.h" TOP_FRONT EQU 0200h TOP_TRAIL EQU 0204h ORG 0F000h RESET mov.w #0A00h,SP Main CALL #INIT mov.b &TOP_FRONT,R6 mov.b &TOP_TRAIL,R7 sub.b R6,R7 here jmp here INIT mov.w #WDTPW+WDTHOLD,&WDTCTL mov.w #TASSEL1+TACLR,&TACTL ; SMCLK, Clear TAR mov.w #512-1,&CCR0 ; PWM Period mov.w #OUTMOD_7,&CCTL1 ; CCR1 reset/set mov.w #384,&CCR1 ; CCR1 PWM Duty Cycle bis.b #004h,&P1DIR bis.b #004h,&P1SEL bic.b #004h,&P1DIR bis.b #004h,&P1SEL BIC #CCIFG,&CCTL2 ;CLEAR PENDING INTS BIS #CCIE+CAP+CM0,&CCTL2 ;ENABLE ;INT/CAP/RISING/SOURCE=PIN bis.w #MC0,&TACTL ; Start Timer_A in up mode eint ret TB2INT: BIC #CCIFG,&CCTL2 BIT #CM0,&CCTL2 JZ TTRAIL MOV &TBR,&TOP_FRONT XOR #CM1+CM0,&CCTL2 RETI TTRAIL: MOV &TBR,&TOP_TRAIL XOR #CM1+CM0,&CCTL2 RETI ORG 0FFF2h DW TB2INT ORG 0FFFEh DW RESET end
measure pulse width
Started by ●April 7, 2004